1 #include "Statement.hpp"
2 #include <soulng/util/Unicode.hpp>
3 #include <sngcm/cmparser/Expression.hpp>
4 #include <sngcm/cmparser/TypeExpr.hpp>
5 #include <sngcm/cmparser/Identifier.hpp>
6 #include <sngcm/cmlexer/CmajorLexer.hpp>
7 #include <sngcm/cmlexer/CmajorTokens.hpp>
8
9
10
11 using namespace soulng::unicode;
12 using namespace sngcm::ast;
13 using namespace CmajorTokens;
14
15 soulng::parser::Match StatementParser::Statement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
16 {
17 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
18
19
20
21
22
23
24
25 #endif // SOULNG_PARSER_DEBUG_SUPPORT
26 std::unique_ptr<StatementNode> labeledStatement;
27 std::unique_ptr<StatementNode> controlStatement;
28 std::unique_ptr<StatementNode> expressionStatement;
29 std::unique_ptr<StatementNode> assignmentStatement;
30 std::unique_ptr<ConstructionStatementNode> constructionStatement;
31 std::unique_ptr<StatementNode> deleteStatement;
32 std::unique_ptr<StatementNode> destroyStatement;
33 std::unique_ptr<StatementNode> emptyStatement;
34 std::unique_ptr<StatementNode> throwStatement;
35 std::unique_ptr<TryStatementNode> tryStatement;
36 std::unique_ptr<StatementNode> assertStatement;
37 std::unique_ptr<ConditionalCompilationStatementNode> condCompStatement;
38 soulng::parser::Match match(false);
39 soulng::parser::Match* parentMatch0 = &match;
40 {
41 int64_t save = lexer.GetPos();
42 soulng::parser::Match match(false);
43 soulng::parser::Match* parentMatch1 = &match;
44 {
45 int64_t save = lexer.GetPos();
46 soulng::parser::Match match(false);
47 soulng::parser::Match* parentMatch2 = &match;
48 {
49 int64_t save = lexer.GetPos();
50 soulng::parser::Match match(false);
51 soulng::parser::Match* parentMatch3 = &match;
52 {
53 int64_t save = lexer.GetPos();
54 soulng::parser::Match match(false);
55 soulng::parser::Match* parentMatch4 = &match;
56 {
57 int64_t save = lexer.GetPos();
58 soulng::parser::Match match(false);
59 soulng::parser::Match* parentMatch5 = &match;
60 {
61 int64_t save = lexer.GetPos();
62 soulng::parser::Match match(false);
63 soulng::parser::Match* parentMatch6 = &match;
64 {
65 int64_t save = lexer.GetPos();
66 soulng::parser::Match match(false);
67 soulng::parser::Match* parentMatch7 = &match;
68 {
69 int64_t save = lexer.GetPos();
70 soulng::parser::Match match(false);
71 soulng::parser::Match* parentMatch8 = &match;
72 {
73 int64_t save = lexer.GetPos();
74 soulng::parser::Match match(false);
75 soulng::parser::Match* parentMatch9 = &match;
76 {
77 int64_t save = lexer.GetPos();
78 soulng::parser::Match match(false);
79 soulng::parser::Match* parentMatch10 = &match;
80 {
81 int64_t save = lexer.GetPos();
82 soulng::parser::Match match(false);
83 soulng::parser::Match* parentMatch11 = &match;
84 {
85 int64_t pos = lexer.GetPos();
86 soulng::parser::Match match = StatementParser::LabeledStatement(lexer, moduleId, ctx);
87 labeledStatement.reset(static_cast<StatementNode*>(match.value));
88 if (match.hit)
89 {
90 {
91 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
92
93 #endif // SOULNG_PARSER_DEBUG_SUPPORT
94 return soulng::parser::Match(true, labeledStatement.release());
95 }
96 }
97 *parentMatch11 = match;
98 }
99 *parentMatch10 = match;
100 if (!match.hit)
101 {
102 soulng::parser::Match match(false);
103 soulng::parser::Match* parentMatch12 = &match;
104 lexer.SetPos(save);
105 {
106 soulng::parser::Match match(false);
107 soulng::parser::Match* parentMatch13 = &match;
108 {
109 int64_t pos = lexer.GetPos();
110 soulng::parser::Match match = StatementParser::ControlStatement(lexer, moduleId, ctx);
111 controlStatement.reset(static_cast<StatementNode*>(match.value));
112 if (match.hit)
113 {
114 {
115 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
116
117 #endif // SOULNG_PARSER_DEBUG_SUPPORT
118 return soulng::parser::Match(true, controlStatement.release());
119 }
120 }
121 *parentMatch13 = match;
122 }
123 *parentMatch12 = match;
124 }
125 *parentMatch10 = match;
126 }
127 }
128 *parentMatch9 = match;
129 if (!match.hit)
130 {
131 soulng::parser::Match match(false);
132 soulng::parser::Match* parentMatch14 = &match;
133 lexer.SetPos(save);
134 {
135 soulng::parser::Match match(false);
136 soulng::parser::Match* parentMatch15 = &match;
137 {
138 int64_t pos = lexer.GetPos();
139 soulng::parser::Match match = StatementParser::ExpressionStatement(lexer, moduleId, ctx);
140 expressionStatement.reset(static_cast<StatementNode*>(match.value));
141 if (match.hit)
142 {
143 {
144 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
145
146 #endif // SOULNG_PARSER_DEBUG_SUPPORT
147 return soulng::parser::Match(true, expressionStatement.release());
148 }
149 }
150 *parentMatch15 = match;
151 }
152 *parentMatch14 = match;
153 }
154 *parentMatch9 = match;
155 }
156 }
157 *parentMatch8 = match;
158 if (!match.hit)
159 {
160 soulng::parser::Match match(false);
161 soulng::parser::Match* parentMatch16 = &match;
162 lexer.SetPos(save);
163 {
164 soulng::parser::Match match(false);
165 soulng::parser::Match* parentMatch17 = &match;
166 {
167 int64_t pos = lexer.GetPos();
168 soulng::parser::Match match = StatementParser::AssignmentStatement(lexer, moduleId, ctx);
169 assignmentStatement.reset(static_cast<StatementNode*>(match.value));
170 if (match.hit)
171 {
172 {
173 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
174
175 #endif // SOULNG_PARSER_DEBUG_SUPPORT
176 return soulng::parser::Match(true, assignmentStatement.release());
177 }
178 }
179 *parentMatch17 = match;
180 }
181 *parentMatch16 = match;
182 }
183 *parentMatch8 = match;
184 }
185 }
186 *parentMatch7 = match;
187 if (!match.hit)
188 {
189 soulng::parser::Match match(false);
190 soulng::parser::Match* parentMatch18 = &match;
191 lexer.SetPos(save);
192 {
193 soulng::parser::Match match(false);
194 soulng::parser::Match* parentMatch19 = &match;
195 {
196 int64_t pos = lexer.GetPos();
197 soulng::parser::Match match = StatementParser::ConstructionStatement(lexer, moduleId, ctx);
198 constructionStatement.reset(static_cast<ConstructionStatementNode*>(match.value));
199 if (match.hit)
200 {
201 {
202 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
203
204 #endif // SOULNG_PARSER_DEBUG_SUPPORT
205 return soulng::parser::Match(true, constructionStatement.release());
206 }
207 }
208 *parentMatch19 = match;
209 }
210 *parentMatch18 = match;
211 }
212 *parentMatch7 = match;
213 }
214 }
215 *parentMatch6 = match;
216 if (!match.hit)
217 {
218 soulng::parser::Match match(false);
219 soulng::parser::Match* parentMatch20 = &match;
220 lexer.SetPos(save);
221 {
222 soulng::parser::Match match(false);
223 soulng::parser::Match* parentMatch21 = &match;
224 {
225 int64_t pos = lexer.GetPos();
226 soulng::parser::Match match = StatementParser::DeleteStatement(lexer, moduleId, ctx);
227 deleteStatement.reset(static_cast<StatementNode*>(match.value));
228 if (match.hit)
229 {
230 {
231 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
232
233 #endif // SOULNG_PARSER_DEBUG_SUPPORT
234 return soulng::parser::Match(true, deleteStatement.release());
235 }
236 }
237 *parentMatch21 = match;
238 }
239 *parentMatch20 = match;
240 }
241 *parentMatch6 = match;
242 }
243 }
244 *parentMatch5 = match;
245 if (!match.hit)
246 {
247 soulng::parser::Match match(false);
248 soulng::parser::Match* parentMatch22 = &match;
249 lexer.SetPos(save);
250 {
251 soulng::parser::Match match(false);
252 soulng::parser::Match* parentMatch23 = &match;
253 {
254 int64_t pos = lexer.GetPos();
255 soulng::parser::Match match = StatementParser::DestroyStatement(lexer, moduleId, ctx);
256 destroyStatement.reset(static_cast<StatementNode*>(match.value));
257 if (match.hit)
258 {
259 {
260 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
261
262 #endif // SOULNG_PARSER_DEBUG_SUPPORT
263 return soulng::parser::Match(true, destroyStatement.release());
264 }
265 }
266 *parentMatch23 = match;
267 }
268 *parentMatch22 = match;
269 }
270 *parentMatch5 = match;
271 }
272 }
273 *parentMatch4 = match;
274 if (!match.hit)
275 {
276 soulng::parser::Match match(false);
277 soulng::parser::Match* parentMatch24 = &match;
278 lexer.SetPos(save);
279 {
280 soulng::parser::Match match(false);
281 soulng::parser::Match* parentMatch25 = &match;
282 {
283 int64_t pos = lexer.GetPos();
284 soulng::parser::Match match = StatementParser::EmptyStatement(lexer, moduleId, ctx);
285 emptyStatement.reset(static_cast<StatementNode*>(match.value));
286 if (match.hit)
287 {
288 {
289 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
290
291 #endif // SOULNG_PARSER_DEBUG_SUPPORT
292 return soulng::parser::Match(true, emptyStatement.release());
293 }
294 }
295 *parentMatch25 = match;
296 }
297 *parentMatch24 = match;
298 }
299 *parentMatch4 = match;
300 }
301 }
302 *parentMatch3 = match;
303 if (!match.hit)
304 {
305 soulng::parser::Match match(false);
306 soulng::parser::Match* parentMatch26 = &match;
307 lexer.SetPos(save);
308 {
309 soulng::parser::Match match(false);
310 soulng::parser::Match* parentMatch27 = &match;
311 {
312 int64_t pos = lexer.GetPos();
313 soulng::parser::Match match = StatementParser::ThrowStatement(lexer, moduleId, ctx);
314 throwStatement.reset(static_cast<StatementNode*>(match.value));
315 if (match.hit)
316 {
317 {
318 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
319
320 #endif // SOULNG_PARSER_DEBUG_SUPPORT
321 return soulng::parser::Match(true, throwStatement.release());
322 }
323 }
324 *parentMatch27 = match;
325 }
326 *parentMatch26 = match;
327 }
328 *parentMatch3 = match;
329 }
330 }
331 *parentMatch2 = match;
332 if (!match.hit)
333 {
334 soulng::parser::Match match(false);
335 soulng::parser::Match* parentMatch28 = &match;
336 lexer.SetPos(save);
337 {
338 soulng::parser::Match match(false);
339 soulng::parser::Match* parentMatch29 = &match;
340 {
341 int64_t pos = lexer.GetPos();
342 soulng::parser::Match match = StatementParser::TryStatement(lexer, moduleId, ctx);
343 tryStatement.reset(static_cast<TryStatementNode*>(match.value));
344 if (match.hit)
345 {
346 {
347 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
348
349 #endif // SOULNG_PARSER_DEBUG_SUPPORT
350 return soulng::parser::Match(true, tryStatement.release());
351 }
352 }
353 *parentMatch29 = match;
354 }
355 *parentMatch28 = match;
356 }
357 *parentMatch2 = match;
358 }
359 }
360 *parentMatch1 = match;
361 if (!match.hit)
362 {
363 soulng::parser::Match match(false);
364 soulng::parser::Match* parentMatch30 = &match;
365 lexer.SetPos(save);
366 {
367 soulng::parser::Match match(false);
368 soulng::parser::Match* parentMatch31 = &match;
369 {
370 int64_t pos = lexer.GetPos();
371 soulng::parser::Match match = StatementParser::AssertStatement(lexer, moduleId, ctx);
372 assertStatement.reset(static_cast<StatementNode*>(match.value));
373 if (match.hit)
374 {
375 {
376 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
377
378 #endif // SOULNG_PARSER_DEBUG_SUPPORT
379 return soulng::parser::Match(true, assertStatement.release());
380 }
381 }
382 *parentMatch31 = match;
383 }
384 *parentMatch30 = match;
385 }
386 *parentMatch1 = match;
387 }
388 }
389 *parentMatch0 = match;
390 if (!match.hit)
391 {
392 soulng::parser::Match match(false);
393 soulng::parser::Match* parentMatch32 = &match;
394 lexer.SetPos(save);
395 {
396 soulng::parser::Match match(false);
397 soulng::parser::Match* parentMatch33 = &match;
398 {
399 int64_t pos = lexer.GetPos();
400 soulng::parser::Match match = StatementParser::ConditionalCompilationStatement(lexer, moduleId, ctx);
401 condCompStatement.reset(static_cast<ConditionalCompilationStatementNode*>(match.value));
402 if (match.hit)
403 {
404 {
405 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
406
407 #endif // SOULNG_PARSER_DEBUG_SUPPORT
408 return soulng::parser::Match(true, condCompStatement.release());
409 }
410 }
411 *parentMatch33 = match;
412 }
413 *parentMatch32 = match;
414 }
415 *parentMatch0 = match;
416 }
417 }
418 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
419
420
421
422
423
424 #endif // SOULNG_PARSER_DEBUG_SUPPORT
425 if (!match.hit)
426 {
427 match.value = nullptr;
428 }
429 return match;
430 }
431
432 soulng::parser::Match StatementParser::Label(CmajorLexer& lexer, boost::uuids::uuid* moduleId)
433 {
434 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
435
436
437
438
439
440
441
442 #endif // SOULNG_PARSER_DEBUG_SUPPORT
443 Span s = Span();
444 std::u32string label = std::u32string();
445 soulng::parser::Match match(false);
446 soulng::parser::Match* parentMatch0 = &match;
447 {
448 int64_t pos = lexer.GetPos();
449 soulng::parser::Match match(false);
450 soulng::parser::Match* parentMatch1 = &match;
451 {
452 soulng::parser::Match match(false);
453 soulng::parser::Match* parentMatch2 = &match;
454 {
455 soulng::parser::Match match(false);
456 soulng::parser::Match* parentMatch3 = &match;
457 {
458 int64_t pos = lexer.GetPos();
459 soulng::lexer::Span span = lexer.GetSpan();
460 soulng::parser::Match match(false);
461 if (*lexer == ID)
462 {
463 ++lexer;
464 match.hit = true;
465 }
466 if (match.hit)
467 {
468 s = span;
469 label = lexer.GetMatch(span);
470 }
471 *parentMatch3 = match;
472 }
473 *parentMatch2 = match;
474 }
475 if (match.hit)
476 {
477 soulng::parser::Match match(false);
478 soulng::parser::Match* parentMatch4 = &match;
479 {
480 soulng::parser::Match match(false);
481 soulng::parser::Match* parentMatch5 = &match;
482 {
483 int64_t pos = lexer.GetPos();
484 soulng::lexer::Span span = lexer.GetSpan();
485 soulng::parser::Match match(false);
486 if (*lexer == COLON)
487 {
488 ++lexer;
489 match.hit = true;
490 }
491 if (match.hit)
492 {
493 s.end = span.end;
494 }
495 *parentMatch5 = match;
496 }
497 *parentMatch4 = match;
498 }
499 *parentMatch2 = match;
500 }
501 *parentMatch1 = match;
502 }
503 if (match.hit)
504 {
505 {
506 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
507
508 #endif // SOULNG_PARSER_DEBUG_SUPPORT
509 return soulng::parser::Match(true, new LabelNode(s, *moduleId, label));
510 }
511 }
512 *parentMatch0 = match;
513 }
514 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
515
516
517
518
519
520 #endif // SOULNG_PARSER_DEBUG_SUPPORT
521 if (!match.hit)
522 {
523 match.value = nullptr;
524 }
525 return match;
526 }
527
528 soulng::parser::Match StatementParser::LabeledStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
529 {
530 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
531
532
533
534
535
536
537
538 #endif // SOULNG_PARSER_DEBUG_SUPPORT
539 std::unique_ptr<LabeledStatementNode> stmt = std::unique_ptr<LabeledStatementNode>();
540 std::unique_ptr<LabelNode> lbl;
541 std::unique_ptr<StatementNode> s;
542 soulng::parser::Match match(false);
543 soulng::parser::Match* parentMatch0 = &match;
544 {
545 soulng::parser::Match match = StatementParser::Label(lexer, moduleId);
546 lbl.reset(static_cast<LabelNode*>(match.value));
547 *parentMatch0 = match;
548 }
549 if (match.hit)
550 {
551 soulng::parser::Match match(false);
552 soulng::parser::Match* parentMatch1 = &match;
553 {
554 soulng::parser::Match match(false);
555 soulng::parser::Match* parentMatch2 = &match;
556 {
557 int64_t pos = lexer.GetPos();
558 soulng::lexer::Span span = lexer.GetSpan();
559 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
560 s.reset(static_cast<StatementNode*>(match.value));
561 if (match.hit)
562 {
563 stmt.reset(new LabeledStatementNode(span, *moduleId, s.release()));
564 stmt->SetLabelNode(lbl.release());
565 {
566 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
567
568 #endif // SOULNG_PARSER_DEBUG_SUPPORT
569 return soulng::parser::Match(true, stmt.release());
570 }
571 }
572 *parentMatch2 = match;
573 }
574 *parentMatch1 = match;
575 }
576 *parentMatch0 = match;
577 }
578 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
579
580
581
582
583
584 #endif // SOULNG_PARSER_DEBUG_SUPPORT
585 if (!match.hit)
586 {
587 match.value = nullptr;
588 }
589 return match;
590 }
591
592 soulng::parser::Match StatementParser::ControlStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
593 {
594 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
595
596
597
598
599
600
601
602 #endif // SOULNG_PARSER_DEBUG_SUPPORT
603 std::unique_ptr<CompoundStatementNode> compoundStatement;
604 std::unique_ptr<StatementNode> returnStatement;
605 std::unique_ptr<IfStatementNode> ifStatement;
606 std::unique_ptr<WhileStatementNode> whileStatement;
607 std::unique_ptr<DoStatementNode> doStatement;
608 std::unique_ptr<RangeForStatementNode> rangeForStatement;
609 std::unique_ptr<ForStatementNode> forStatement;
610 std::unique_ptr<StatementNode> breakStatement;
611 std::unique_ptr<StatementNode> continueStatement;
612 std::unique_ptr<StatementNode> gotoStatement;
613 std::unique_ptr<SwitchStatementNode> switchStatement;
614 std::unique_ptr<StatementNode> gotoCaseStatement;
615 std::unique_ptr<StatementNode> gotoDefaultStatement;
616 soulng::parser::Match match(false);
617 soulng::parser::Match* parentMatch0 = &match;
618 {
619 int64_t save = lexer.GetPos();
620 soulng::parser::Match match(false);
621 soulng::parser::Match* parentMatch1 = &match;
622 {
623 int64_t save = lexer.GetPos();
624 soulng::parser::Match match(false);
625 soulng::parser::Match* parentMatch2 = &match;
626 {
627 int64_t save = lexer.GetPos();
628 soulng::parser::Match match(false);
629 soulng::parser::Match* parentMatch3 = &match;
630 {
631 int64_t save = lexer.GetPos();
632 soulng::parser::Match match(false);
633 soulng::parser::Match* parentMatch4 = &match;
634 {
635 int64_t save = lexer.GetPos();
636 soulng::parser::Match match(false);
637 soulng::parser::Match* parentMatch5 = &match;
638 {
639 int64_t save = lexer.GetPos();
640 soulng::parser::Match match(false);
641 soulng::parser::Match* parentMatch6 = &match;
642 {
643 int64_t save = lexer.GetPos();
644 soulng::parser::Match match(false);
645 soulng::parser::Match* parentMatch7 = &match;
646 {
647 int64_t save = lexer.GetPos();
648 soulng::parser::Match match(false);
649 soulng::parser::Match* parentMatch8 = &match;
650 {
651 int64_t save = lexer.GetPos();
652 soulng::parser::Match match(false);
653 soulng::parser::Match* parentMatch9 = &match;
654 {
655 int64_t save = lexer.GetPos();
656 soulng::parser::Match match(false);
657 soulng::parser::Match* parentMatch10 = &match;
658 {
659 int64_t save = lexer.GetPos();
660 soulng::parser::Match match(false);
661 soulng::parser::Match* parentMatch11 = &match;
662 {
663 int64_t save = lexer.GetPos();
664 soulng::parser::Match match(false);
665 soulng::parser::Match* parentMatch12 = &match;
666 {
667 int64_t pos = lexer.GetPos();
668 soulng::parser::Match match = StatementParser::CompoundStatement(lexer, moduleId, ctx);
669 compoundStatement.reset(static_cast<CompoundStatementNode*>(match.value));
670 if (match.hit)
671 {
672 {
673 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
674
675 #endif // SOULNG_PARSER_DEBUG_SUPPORT
676 return soulng::parser::Match(true, compoundStatement.release());
677 }
678 }
679 *parentMatch12 = match;
680 }
681 *parentMatch11 = match;
682 if (!match.hit)
683 {
684 soulng::parser::Match match(false);
685 soulng::parser::Match* parentMatch13 = &match;
686 lexer.SetPos(save);
687 {
688 soulng::parser::Match match(false);
689 soulng::parser::Match* parentMatch14 = &match;
690 {
691 int64_t pos = lexer.GetPos();
692 soulng::parser::Match match = StatementParser::ReturnStatement(lexer, moduleId, ctx);
693 returnStatement.reset(static_cast<StatementNode*>(match.value));
694 if (match.hit)
695 {
696 {
697 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
698
699 #endif // SOULNG_PARSER_DEBUG_SUPPORT
700 return soulng::parser::Match(true, returnStatement.release());
701 }
702 }
703 *parentMatch14 = match;
704 }
705 *parentMatch13 = match;
706 }
707 *parentMatch11 = match;
708 }
709 }
710 *parentMatch10 = match;
711 if (!match.hit)
712 {
713 soulng::parser::Match match(false);
714 soulng::parser::Match* parentMatch15 = &match;
715 lexer.SetPos(save);
716 {
717 soulng::parser::Match match(false);
718 soulng::parser::Match* parentMatch16 = &match;
719 {
720 int64_t pos = lexer.GetPos();
721 soulng::parser::Match match = StatementParser::IfStatement(lexer, moduleId, ctx);
722 ifStatement.reset(static_cast<IfStatementNode*>(match.value));
723 if (match.hit)
724 {
725 {
726 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
727
728 #endif // SOULNG_PARSER_DEBUG_SUPPORT
729 return soulng::parser::Match(true, ifStatement.release());
730 }
731 }
732 *parentMatch16 = match;
733 }
734 *parentMatch15 = match;
735 }
736 *parentMatch10 = match;
737 }
738 }
739 *parentMatch9 = match;
740 if (!match.hit)
741 {
742 soulng::parser::Match match(false);
743 soulng::parser::Match* parentMatch17 = &match;
744 lexer.SetPos(save);
745 {
746 soulng::parser::Match match(false);
747 soulng::parser::Match* parentMatch18 = &match;
748 {
749 int64_t pos = lexer.GetPos();
750 soulng::parser::Match match = StatementParser::WhileStatement(lexer, moduleId, ctx);
751 whileStatement.reset(static_cast<WhileStatementNode*>(match.value));
752 if (match.hit)
753 {
754 {
755 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
756
757 #endif // SOULNG_PARSER_DEBUG_SUPPORT
758 return soulng::parser::Match(true, whileStatement.release());
759 }
760 }
761 *parentMatch18 = match;
762 }
763 *parentMatch17 = match;
764 }
765 *parentMatch9 = match;
766 }
767 }
768 *parentMatch8 = match;
769 if (!match.hit)
770 {
771 soulng::parser::Match match(false);
772 soulng::parser::Match* parentMatch19 = &match;
773 lexer.SetPos(save);
774 {
775 soulng::parser::Match match(false);
776 soulng::parser::Match* parentMatch20 = &match;
777 {
778 int64_t pos = lexer.GetPos();
779 soulng::parser::Match match = StatementParser::DoStatement(lexer, moduleId, ctx);
780 doStatement.reset(static_cast<DoStatementNode*>(match.value));
781 if (match.hit)
782 {
783 {
784 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
785
786 #endif // SOULNG_PARSER_DEBUG_SUPPORT
787 return soulng::parser::Match(true, doStatement.release());
788 }
789 }
790 *parentMatch20 = match;
791 }
792 *parentMatch19 = match;
793 }
794 *parentMatch8 = match;
795 }
796 }
797 *parentMatch7 = match;
798 if (!match.hit)
799 {
800 soulng::parser::Match match(false);
801 soulng::parser::Match* parentMatch21 = &match;
802 lexer.SetPos(save);
803 {
804 soulng::parser::Match match(false);
805 soulng::parser::Match* parentMatch22 = &match;
806 {
807 int64_t pos = lexer.GetPos();
808 soulng::parser::Match match = StatementParser::RangeForStatement(lexer, moduleId, ctx);
809 rangeForStatement.reset(static_cast<RangeForStatementNode*>(match.value));
810 if (match.hit)
811 {
812 {
813 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
814
815 #endif // SOULNG_PARSER_DEBUG_SUPPORT
816 return soulng::parser::Match(true, rangeForStatement.release());
817 }
818 }
819 *parentMatch22 = match;
820 }
821 *parentMatch21 = match;
822 }
823 *parentMatch7 = match;
824 }
825 }
826 *parentMatch6 = match;
827 if (!match.hit)
828 {
829 soulng::parser::Match match(false);
830 soulng::parser::Match* parentMatch23 = &match;
831 lexer.SetPos(save);
832 {
833 soulng::parser::Match match(false);
834 soulng::parser::Match* parentMatch24 = &match;
835 {
836 int64_t pos = lexer.GetPos();
837 soulng::parser::Match match = StatementParser::ForStatement(lexer, moduleId, ctx);
838 forStatement.reset(static_cast<ForStatementNode*>(match.value));
839 if (match.hit)
840 {
841 {
842 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
843
844 #endif // SOULNG_PARSER_DEBUG_SUPPORT
845 return soulng::parser::Match(true, forStatement.release());
846 }
847 }
848 *parentMatch24 = match;
849 }
850 *parentMatch23 = match;
851 }
852 *parentMatch6 = match;
853 }
854 }
855 *parentMatch5 = match;
856 if (!match.hit)
857 {
858 soulng::parser::Match match(false);
859 soulng::parser::Match* parentMatch25 = &match;
860 lexer.SetPos(save);
861 {
862 soulng::parser::Match match(false);
863 soulng::parser::Match* parentMatch26 = &match;
864 {
865 int64_t pos = lexer.GetPos();
866 soulng::parser::Match match = StatementParser::BreakStatement(lexer, moduleId, ctx);
867 breakStatement.reset(static_cast<StatementNode*>(match.value));
868 if (match.hit)
869 {
870 {
871 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
872
873 #endif // SOULNG_PARSER_DEBUG_SUPPORT
874 return soulng::parser::Match(true, breakStatement.release());
875 }
876 }
877 *parentMatch26 = match;
878 }
879 *parentMatch25 = match;
880 }
881 *parentMatch5 = match;
882 }
883 }
884 *parentMatch4 = match;
885 if (!match.hit)
886 {
887 soulng::parser::Match match(false);
888 soulng::parser::Match* parentMatch27 = &match;
889 lexer.SetPos(save);
890 {
891 soulng::parser::Match match(false);
892 soulng::parser::Match* parentMatch28 = &match;
893 {
894 int64_t pos = lexer.GetPos();
895 soulng::parser::Match match = StatementParser::ContinueStatement(lexer, moduleId, ctx);
896 continueStatement.reset(static_cast<StatementNode*>(match.value));
897 if (match.hit)
898 {
899 {
900 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
901
902 #endif // SOULNG_PARSER_DEBUG_SUPPORT
903 return soulng::parser::Match(true, continueStatement.release());
904 }
905 }
906 *parentMatch28 = match;
907 }
908 *parentMatch27 = match;
909 }
910 *parentMatch4 = match;
911 }
912 }
913 *parentMatch3 = match;
914 if (!match.hit)
915 {
916 soulng::parser::Match match(false);
917 soulng::parser::Match* parentMatch29 = &match;
918 lexer.SetPos(save);
919 {
920 soulng::parser::Match match(false);
921 soulng::parser::Match* parentMatch30 = &match;
922 {
923 int64_t pos = lexer.GetPos();
924 soulng::parser::Match match = StatementParser::GotoStatement(lexer, moduleId, ctx);
925 gotoStatement.reset(static_cast<StatementNode*>(match.value));
926 if (match.hit)
927 {
928 {
929 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
930
931 #endif // SOULNG_PARSER_DEBUG_SUPPORT
932 return soulng::parser::Match(true, gotoStatement.release());
933 }
934 }
935 *parentMatch30 = match;
936 }
937 *parentMatch29 = match;
938 }
939 *parentMatch3 = match;
940 }
941 }
942 *parentMatch2 = match;
943 if (!match.hit)
944 {
945 soulng::parser::Match match(false);
946 soulng::parser::Match* parentMatch31 = &match;
947 lexer.SetPos(save);
948 {
949 soulng::parser::Match match(false);
950 soulng::parser::Match* parentMatch32 = &match;
951 {
952 int64_t pos = lexer.GetPos();
953 soulng::parser::Match match = StatementParser::SwitchStatement(lexer, moduleId, ctx);
954 switchStatement.reset(static_cast<SwitchStatementNode*>(match.value));
955 if (match.hit)
956 {
957 {
958 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
959
960 #endif // SOULNG_PARSER_DEBUG_SUPPORT
961 return soulng::parser::Match(true, switchStatement.release());
962 }
963 }
964 *parentMatch32 = match;
965 }
966 *parentMatch31 = match;
967 }
968 *parentMatch2 = match;
969 }
970 }
971 *parentMatch1 = match;
972 if (!match.hit)
973 {
974 soulng::parser::Match match(false);
975 soulng::parser::Match* parentMatch33 = &match;
976 lexer.SetPos(save);
977 {
978 soulng::parser::Match match(false);
979 soulng::parser::Match* parentMatch34 = &match;
980 {
981 int64_t pos = lexer.GetPos();
982 soulng::parser::Match match = StatementParser::GotoCaseStatement(lexer, moduleId, ctx);
983 gotoCaseStatement.reset(static_cast<StatementNode*>(match.value));
984 if (match.hit)
985 {
986 {
987 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
988
989 #endif // SOULNG_PARSER_DEBUG_SUPPORT
990 return soulng::parser::Match(true, gotoCaseStatement.release());
991 }
992 }
993 *parentMatch34 = match;
994 }
995 *parentMatch33 = match;
996 }
997 *parentMatch1 = match;
998 }
999 }
1000 *parentMatch0 = match;
1001 if (!match.hit)
1002 {
1003 soulng::parser::Match match(false);
1004 soulng::parser::Match* parentMatch35 = &match;
1005 lexer.SetPos(save);
1006 {
1007 soulng::parser::Match match(false);
1008 soulng::parser::Match* parentMatch36 = &match;
1009 {
1010 int64_t pos = lexer.GetPos();
1011 soulng::parser::Match match = StatementParser::GotoDefaultStatement(lexer, moduleId, ctx);
1012 gotoDefaultStatement.reset(static_cast<StatementNode*>(match.value));
1013 if (match.hit)
1014 {
1015 {
1016 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1017
1018 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1019 return soulng::parser::Match(true, gotoDefaultStatement.release());
1020 }
1021 }
1022 *parentMatch36 = match;
1023 }
1024 *parentMatch35 = match;
1025 }
1026 *parentMatch0 = match;
1027 }
1028 }
1029 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1030
1031
1032
1033
1034
1035 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1036 if (!match.hit)
1037 {
1038 match.value = nullptr;
1039 }
1040 return match;
1041 }
1042
1043 soulng::parser::Match StatementParser::CompoundStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
1044 {
1045 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1046
1047
1048
1049
1050
1051
1052
1053 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1054 std::unique_ptr<CompoundStatementNode> compoundStatement = std::unique_ptr<CompoundStatementNode>();
1055 std::unique_ptr<StatementNode> stmt;
1056 soulng::parser::Match match(false);
1057 soulng::parser::Match* parentMatch0 = &match;
1058 {
1059 soulng::parser::Match match(false);
1060 soulng::parser::Match* parentMatch1 = &match;
1061 {
1062 soulng::parser::Match match(false);
1063 soulng::parser::Match* parentMatch2 = &match;
1064 {
1065 int64_t pos = lexer.GetPos();
1066 soulng::lexer::Span span = lexer.GetSpan();
1067 soulng::parser::Match match(false);
1068 if (*lexer == LBRACE)
1069 {
1070 ++lexer;
1071 match.hit = true;
1072 }
1073 if (match.hit)
1074 {
1075 compoundStatement.reset(new CompoundStatementNode(span, *moduleId));
1076 compoundStatement->SetBeginBraceSpan(span);
1077 }
1078 *parentMatch2 = match;
1079 }
1080 *parentMatch1 = match;
1081 }
1082 if (match.hit)
1083 {
1084 soulng::parser::Match match(false);
1085 soulng::parser::Match* parentMatch3 = &match;
1086 {
1087 soulng::parser::Match match(true);
1088 soulng::parser::Match* parentMatch4 = &match;
1089 {
1090 while (true)
1091 {
1092 int64_t save = lexer.GetPos();
1093 {
1094 soulng::parser::Match match(false);
1095 soulng::parser::Match* parentMatch5 = &match;
1096 {
1097 soulng::parser::Match match(false);
1098 soulng::parser::Match* parentMatch6 = &match;
1099 {
1100 int64_t pos = lexer.GetPos();
1101 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
1102 stmt.reset(static_cast<StatementNode*>(match.value));
1103 if (match.hit)
1104 {
1105 compoundStatement->AddStatement(stmt.release());
1106 }
1107 *parentMatch6 = match;
1108 }
1109 *parentMatch5 = match;
1110 }
1111 if (match.hit)
1112 {
1113 *parentMatch4 = match;
1114 }
1115 else
1116 {
1117 lexer.SetPos(save);
1118 break;
1119 }
1120 }
1121 }
1122 }
1123 *parentMatch3 = match;
1124 }
1125 *parentMatch1 = match;
1126 }
1127 *parentMatch0 = match;
1128 }
1129 if (match.hit)
1130 {
1131 soulng::parser::Match match(false);
1132 soulng::parser::Match* parentMatch7 = &match;
1133 {
1134 soulng::parser::Match match(false);
1135 soulng::parser::Match* parentMatch8 = &match;
1136 {
1137 int64_t pos = lexer.GetPos();
1138 soulng::lexer::Span span = lexer.GetSpan();
1139 soulng::parser::Match match(true);
1140 soulng::parser::Match* parentMatch9 = &match;
1141 {
1142 soulng::lexer::Span span = lexer.GetSpan();
1143 soulng::parser::Match match(false);
1144 if (*lexer == RBRACE)
1145 {
1146 ++lexer;
1147 match.hit = true;
1148 }
1149 if (match.hit)
1150 {
1151 *parentMatch9 = match;
1152 }
1153 else
1154 {
1155 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RBRACE)));
1156 }
1157 }
1158 if (match.hit)
1159 {
1160 compoundStatement->SetEndBraceSpan(span);
1161 compoundStatement->SetSpanEnd(span.end);
1162 {
1163 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1164
1165 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1166 return soulng::parser::Match(true, compoundStatement.release());
1167 }
1168 }
1169 *parentMatch8 = match;
1170 }
1171 *parentMatch7 = match;
1172 }
1173 *parentMatch0 = match;
1174 }
1175 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1176
1177
1178
1179
1180
1181 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1182 if (!match.hit)
1183 {
1184 match.value = nullptr;
1185 }
1186 return match;
1187 }
1188
1189 soulng::parser::Match StatementParser::ReturnStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
1190 {
1191 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1192
1193
1194
1195
1196
1197
1198
1199 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1200 Span s = Span();
1201 std::unique_ptr<Node> expr;
1202 soulng::parser::Match match(false);
1203 soulng::parser::Match* parentMatch0 = &match;
1204 {
1205 soulng::parser::Match match(false);
1206 soulng::parser::Match* parentMatch1 = &match;
1207 {
1208 soulng::parser::Match match(false);
1209 soulng::parser::Match* parentMatch2 = &match;
1210 {
1211 int64_t pos = lexer.GetPos();
1212 soulng::lexer::Span span = lexer.GetSpan();
1213 soulng::parser::Match match(false);
1214 if (*lexer == RETURN)
1215 {
1216 ++lexer;
1217 match.hit = true;
1218 }
1219 if (match.hit)
1220 {
1221 s = span;
1222 }
1223 *parentMatch2 = match;
1224 }
1225 *parentMatch1 = match;
1226 }
1227 if (match.hit)
1228 {
1229 soulng::parser::Match match(false);
1230 soulng::parser::Match* parentMatch3 = &match;
1231 {
1232 soulng::parser::Match match(true);
1233 int64_t save = lexer.GetPos();
1234 soulng::parser::Match* parentMatch4 = &match;
1235 {
1236 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
1237 expr.reset(static_cast<Node*>(match.value));
1238 if (match.hit)
1239 {
1240 *parentMatch4 = match;
1241 }
1242 else
1243 {
1244 lexer.SetPos(save);
1245 }
1246 }
1247 *parentMatch3 = match;
1248 }
1249 *parentMatch1 = match;
1250 }
1251 *parentMatch0 = match;
1252 }
1253 if (match.hit)
1254 {
1255 soulng::parser::Match match(false);
1256 soulng::parser::Match* parentMatch5 = &match;
1257 {
1258 soulng::parser::Match match(false);
1259 soulng::parser::Match* parentMatch6 = &match;
1260 {
1261 int64_t pos = lexer.GetPos();
1262 soulng::lexer::Span span = lexer.GetSpan();
1263 soulng::parser::Match match(true);
1264 soulng::parser::Match* parentMatch7 = &match;
1265 {
1266 soulng::lexer::Span span = lexer.GetSpan();
1267 soulng::parser::Match match(false);
1268 if (*lexer == SEMICOLON)
1269 {
1270 ++lexer;
1271 match.hit = true;
1272 }
1273 if (match.hit)
1274 {
1275 *parentMatch7 = match;
1276 }
1277 else
1278 {
1279 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
1280 }
1281 }
1282 if (match.hit)
1283 {
1284 s.end = span.end;
1285 {
1286 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1287
1288 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1289 return soulng::parser::Match(true, new ReturnStatementNode(s, *moduleId, expr.release()));
1290 }
1291 }
1292 *parentMatch6 = match;
1293 }
1294 *parentMatch5 = match;
1295 }
1296 *parentMatch0 = match;
1297 }
1298 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1299
1300
1301
1302
1303
1304 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1305 if (!match.hit)
1306 {
1307 match.value = nullptr;
1308 }
1309 return match;
1310 }
1311
1312 soulng::parser::Match StatementParser::IfStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
1313 {
1314 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1315
1316
1317
1318
1319
1320
1321
1322 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1323 Span s = Span();
1324 Span leftParenSpan = Span();
1325 Span rightParenSpan = Span();
1326 Span elseSpan = Span();
1327 std::unique_ptr<Node> condNode = std::unique_ptr<Node>();
1328 std::unique_ptr<Node> cond;
1329 std::unique_ptr<StatementNode> thenS;
1330 std::unique_ptr<StatementNode> elseS;
1331 soulng::parser::Match match(false);
1332 soulng::parser::Match* parentMatch0 = &match;
1333 {
1334 int64_t pos = lexer.GetPos();
1335 soulng::parser::Match match(false);
1336 soulng::parser::Match* parentMatch1 = &match;
1337 {
1338 soulng::parser::Match match(false);
1339 soulng::parser::Match* parentMatch2 = &match;
1340 {
1341 soulng::parser::Match match(false);
1342 soulng::parser::Match* parentMatch3 = &match;
1343 {
1344 soulng::parser::Match match(false);
1345 soulng::parser::Match* parentMatch4 = &match;
1346 {
1347 soulng::parser::Match match(false);
1348 soulng::parser::Match* parentMatch5 = &match;
1349 {
1350 soulng::parser::Match match(false);
1351 soulng::parser::Match* parentMatch6 = &match;
1352 {
1353 soulng::parser::Match match(false);
1354 soulng::parser::Match* parentMatch7 = &match;
1355 {
1356 int64_t pos = lexer.GetPos();
1357 soulng::lexer::Span span = lexer.GetSpan();
1358 soulng::parser::Match match(false);
1359 if (*lexer == IF)
1360 {
1361 ++lexer;
1362 match.hit = true;
1363 }
1364 if (match.hit)
1365 {
1366 s = span;
1367 }
1368 *parentMatch7 = match;
1369 }
1370 *parentMatch6 = match;
1371 }
1372 if (match.hit)
1373 {
1374 soulng::parser::Match match(false);
1375 soulng::parser::Match* parentMatch8 = &match;
1376 {
1377 soulng::parser::Match match(false);
1378 soulng::parser::Match* parentMatch9 = &match;
1379 {
1380 int64_t pos = lexer.GetPos();
1381 soulng::lexer::Span span = lexer.GetSpan();
1382 soulng::parser::Match match(false);
1383 if (*lexer == LPAREN)
1384 {
1385 ++lexer;
1386 match.hit = true;
1387 }
1388 if (match.hit)
1389 {
1390 leftParenSpan = span;
1391 }
1392 *parentMatch9 = match;
1393 }
1394 *parentMatch8 = match;
1395 }
1396 *parentMatch6 = match;
1397 }
1398 *parentMatch5 = match;
1399 }
1400 if (match.hit)
1401 {
1402 soulng::parser::Match match(false);
1403 soulng::parser::Match* parentMatch10 = &match;
1404 {
1405 soulng::parser::Match match(false);
1406 soulng::parser::Match* parentMatch11 = &match;
1407 {
1408 int64_t pos = lexer.GetPos();
1409 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
1410 cond.reset(static_cast<Node*>(match.value));
1411 if (match.hit)
1412 {
1413 condNode.reset(cond.release());
1414 s.end = condNode->GetSpan().end;
1415 }
1416 *parentMatch11 = match;
1417 }
1418 *parentMatch10 = match;
1419 }
1420 *parentMatch5 = match;
1421 }
1422 *parentMatch4 = match;
1423 }
1424 if (match.hit)
1425 {
1426 soulng::parser::Match match(false);
1427 soulng::parser::Match* parentMatch12 = &match;
1428 {
1429 soulng::parser::Match match(false);
1430 soulng::parser::Match* parentMatch13 = &match;
1431 {
1432 int64_t pos = lexer.GetPos();
1433 soulng::lexer::Span span = lexer.GetSpan();
1434 soulng::parser::Match match(false);
1435 if (*lexer == RPAREN)
1436 {
1437 ++lexer;
1438 match.hit = true;
1439 }
1440 if (match.hit)
1441 {
1442 rightParenSpan = span;
1443 s.end = span.end;
1444 }
1445 *parentMatch13 = match;
1446 }
1447 *parentMatch12 = match;
1448 }
1449 *parentMatch4 = match;
1450 }
1451 *parentMatch3 = match;
1452 }
1453 if (match.hit)
1454 {
1455 soulng::parser::Match match(false);
1456 soulng::parser::Match* parentMatch14 = &match;
1457 {
1458 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
1459 thenS.reset(static_cast<StatementNode*>(match.value));
1460 *parentMatch14 = match;
1461 }
1462 *parentMatch3 = match;
1463 }
1464 *parentMatch2 = match;
1465 }
1466 if (match.hit)
1467 {
1468 soulng::parser::Match match(false);
1469 soulng::parser::Match* parentMatch15 = &match;
1470 {
1471 soulng::parser::Match match(true);
1472 int64_t save = lexer.GetPos();
1473 soulng::parser::Match* parentMatch16 = &match;
1474 {
1475 soulng::parser::Match match(false);
1476 soulng::parser::Match* parentMatch17 = &match;
1477 {
1478 soulng::parser::Match match(false);
1479 soulng::parser::Match* parentMatch18 = &match;
1480 {
1481 soulng::parser::Match match(false);
1482 soulng::parser::Match* parentMatch19 = &match;
1483 {
1484 int64_t pos = lexer.GetPos();
1485 soulng::lexer::Span span = lexer.GetSpan();
1486 soulng::parser::Match match(false);
1487 if (*lexer == ELSE)
1488 {
1489 ++lexer;
1490 match.hit = true;
1491 }
1492 if (match.hit)
1493 {
1494 elseSpan = span;
1495 }
1496 *parentMatch19 = match;
1497 }
1498 *parentMatch18 = match;
1499 }
1500 if (match.hit)
1501 {
1502 soulng::parser::Match match(false);
1503 soulng::parser::Match* parentMatch20 = &match;
1504 {
1505 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
1506 elseS.reset(static_cast<StatementNode*>(match.value));
1507 *parentMatch20 = match;
1508 }
1509 *parentMatch18 = match;
1510 }
1511 *parentMatch17 = match;
1512 }
1513 if (match.hit)
1514 {
1515 *parentMatch16 = match;
1516 }
1517 else
1518 {
1519 lexer.SetPos(save);
1520 }
1521 }
1522 *parentMatch15 = match;
1523 }
1524 *parentMatch2 = match;
1525 }
1526 *parentMatch1 = match;
1527 }
1528 if (match.hit)
1529 {
1530 IfStatementNode* value = new IfStatementNode(s, *moduleId, condNode.release(), thenS.release(), elseS.release());
1531 value->SetLeftParenSpan(leftParenSpan);
1532 value->SetRightParenSpan(rightParenSpan);
1533 value->SetElseSpan(elseSpan);
1534 {
1535 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1536
1537 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1538 return soulng::parser::Match(true, value);
1539 }
1540 }
1541 *parentMatch0 = match;
1542 }
1543 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1544
1545
1546
1547
1548
1549 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1550 if (!match.hit)
1551 {
1552 match.value = nullptr;
1553 }
1554 return match;
1555 }
1556
1557 soulng::parser::Match StatementParser::WhileStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
1558 {
1559 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1560
1561
1562
1563
1564
1565
1566
1567 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1568 Span s = Span();
1569 Span leftParenSpan = Span();
1570 Span rightParenSpan = Span();
1571 std::unique_ptr<Node> cond;
1572 std::unique_ptr<StatementNode> stmt;
1573 soulng::parser::Match match(false);
1574 soulng::parser::Match* parentMatch0 = &match;
1575 {
1576 int64_t pos = lexer.GetPos();
1577 soulng::parser::Match match(false);
1578 soulng::parser::Match* parentMatch1 = &match;
1579 {
1580 soulng::parser::Match match(false);
1581 soulng::parser::Match* parentMatch2 = &match;
1582 {
1583 soulng::parser::Match match(false);
1584 soulng::parser::Match* parentMatch3 = &match;
1585 {
1586 soulng::parser::Match match(false);
1587 soulng::parser::Match* parentMatch4 = &match;
1588 {
1589 soulng::parser::Match match(false);
1590 soulng::parser::Match* parentMatch5 = &match;
1591 {
1592 soulng::parser::Match match(false);
1593 soulng::parser::Match* parentMatch6 = &match;
1594 {
1595 int64_t pos = lexer.GetPos();
1596 soulng::lexer::Span span = lexer.GetSpan();
1597 soulng::parser::Match match(false);
1598 if (*lexer == WHILE)
1599 {
1600 ++lexer;
1601 match.hit = true;
1602 }
1603 if (match.hit)
1604 {
1605 s = span;
1606 }
1607 *parentMatch6 = match;
1608 }
1609 *parentMatch5 = match;
1610 }
1611 if (match.hit)
1612 {
1613 soulng::parser::Match match(false);
1614 soulng::parser::Match* parentMatch7 = &match;
1615 {
1616 soulng::parser::Match match(false);
1617 soulng::parser::Match* parentMatch8 = &match;
1618 {
1619 int64_t pos = lexer.GetPos();
1620 soulng::lexer::Span span = lexer.GetSpan();
1621 soulng::parser::Match match(true);
1622 soulng::parser::Match* parentMatch9 = &match;
1623 {
1624 soulng::lexer::Span span = lexer.GetSpan();
1625 soulng::parser::Match match(false);
1626 if (*lexer == LPAREN)
1627 {
1628 ++lexer;
1629 match.hit = true;
1630 }
1631 if (match.hit)
1632 {
1633 *parentMatch9 = match;
1634 }
1635 else
1636 {
1637 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LPAREN)));
1638 }
1639 }
1640 if (match.hit)
1641 {
1642 leftParenSpan = span;
1643 }
1644 *parentMatch8 = match;
1645 }
1646 *parentMatch7 = match;
1647 }
1648 *parentMatch5 = match;
1649 }
1650 *parentMatch4 = match;
1651 }
1652 if (match.hit)
1653 {
1654 soulng::parser::Match match(false);
1655 soulng::parser::Match* parentMatch10 = &match;
1656 {
1657 soulng::parser::Match match(true);
1658 soulng::parser::Match* parentMatch11 = &match;
1659 {
1660 soulng::lexer::Span span = lexer.GetSpan();
1661 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
1662 cond.reset(static_cast<Node*>(match.value));
1663 if (match.hit)
1664 {
1665 *parentMatch11 = match;
1666 }
1667 else
1668 {
1669 lexer.ThrowExpectationFailure(span, U"expression");
1670 }
1671 }
1672 *parentMatch10 = match;
1673 }
1674 *parentMatch4 = match;
1675 }
1676 *parentMatch3 = match;
1677 }
1678 if (match.hit)
1679 {
1680 soulng::parser::Match match(false);
1681 soulng::parser::Match* parentMatch12 = &match;
1682 {
1683 soulng::parser::Match match(false);
1684 soulng::parser::Match* parentMatch13 = &match;
1685 {
1686 int64_t pos = lexer.GetPos();
1687 soulng::lexer::Span span = lexer.GetSpan();
1688 soulng::parser::Match match(true);
1689 soulng::parser::Match* parentMatch14 = &match;
1690 {
1691 soulng::lexer::Span span = lexer.GetSpan();
1692 soulng::parser::Match match(false);
1693 if (*lexer == RPAREN)
1694 {
1695 ++lexer;
1696 match.hit = true;
1697 }
1698 if (match.hit)
1699 {
1700 *parentMatch14 = match;
1701 }
1702 else
1703 {
1704 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
1705 }
1706 }
1707 if (match.hit)
1708 {
1709 rightParenSpan = span;
1710 }
1711 *parentMatch13 = match;
1712 }
1713 *parentMatch12 = match;
1714 }
1715 *parentMatch3 = match;
1716 }
1717 *parentMatch2 = match;
1718 }
1719 if (match.hit)
1720 {
1721 soulng::parser::Match match(false);
1722 soulng::parser::Match* parentMatch15 = &match;
1723 {
1724 soulng::parser::Match match(false);
1725 soulng::parser::Match* parentMatch16 = &match;
1726 {
1727 int64_t pos = lexer.GetPos();
1728 soulng::lexer::Span span = lexer.GetSpan();
1729 soulng::parser::Match match(true);
1730 soulng::parser::Match* parentMatch17 = &match;
1731 {
1732 soulng::lexer::Span span = lexer.GetSpan();
1733 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
1734 stmt.reset(static_cast<StatementNode*>(match.value));
1735 if (match.hit)
1736 {
1737 *parentMatch17 = match;
1738 }
1739 else
1740 {
1741 lexer.ThrowExpectationFailure(span, U"statement");
1742 }
1743 }
1744 if (match.hit)
1745 {
1746 s.end = span.end;
1747 }
1748 *parentMatch16 = match;
1749 }
1750 *parentMatch15 = match;
1751 }
1752 *parentMatch2 = match;
1753 }
1754 *parentMatch1 = match;
1755 }
1756 if (match.hit)
1757 {
1758 WhileStatementNode* value = new WhileStatementNode(s, *moduleId, cond.release(), stmt.release());
1759 value->SetLeftParenSpan(leftParenSpan);
1760 value->SetRightParenSpan(rightParenSpan);
1761 {
1762 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1763
1764 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1765 return soulng::parser::Match(true, value);
1766 }
1767 }
1768 *parentMatch0 = match;
1769 }
1770 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1771
1772
1773
1774
1775
1776 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1777 if (!match.hit)
1778 {
1779 match.value = nullptr;
1780 }
1781 return match;
1782 }
1783
1784 soulng::parser::Match StatementParser::DoStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
1785 {
1786 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1787
1788
1789
1790
1791
1792
1793
1794 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1795 Span s = Span();
1796 Span whileSpan = Span();
1797 Span leftParenSpan = Span();
1798 Span rightParenSpan = Span();
1799 std::unique_ptr<StatementNode> stmt;
1800 std::unique_ptr<Node> cond;
1801 soulng::parser::Match match(false);
1802 soulng::parser::Match* parentMatch0 = &match;
1803 {
1804 int64_t pos = lexer.GetPos();
1805 soulng::parser::Match match(false);
1806 soulng::parser::Match* parentMatch1 = &match;
1807 {
1808 soulng::parser::Match match(false);
1809 soulng::parser::Match* parentMatch2 = &match;
1810 {
1811 soulng::parser::Match match(false);
1812 soulng::parser::Match* parentMatch3 = &match;
1813 {
1814 soulng::parser::Match match(false);
1815 soulng::parser::Match* parentMatch4 = &match;
1816 {
1817 soulng::parser::Match match(false);
1818 soulng::parser::Match* parentMatch5 = &match;
1819 {
1820 soulng::parser::Match match(false);
1821 soulng::parser::Match* parentMatch6 = &match;
1822 {
1823 soulng::parser::Match match(false);
1824 soulng::parser::Match* parentMatch7 = &match;
1825 {
1826 soulng::parser::Match match(false);
1827 soulng::parser::Match* parentMatch8 = &match;
1828 {
1829 int64_t pos = lexer.GetPos();
1830 soulng::lexer::Span span = lexer.GetSpan();
1831 soulng::parser::Match match(false);
1832 if (*lexer == DO)
1833 {
1834 ++lexer;
1835 match.hit = true;
1836 }
1837 if (match.hit)
1838 {
1839 s = span;
1840 }
1841 *parentMatch8 = match;
1842 }
1843 *parentMatch7 = match;
1844 }
1845 if (match.hit)
1846 {
1847 soulng::parser::Match match(false);
1848 soulng::parser::Match* parentMatch9 = &match;
1849 {
1850 soulng::parser::Match match(true);
1851 soulng::parser::Match* parentMatch10 = &match;
1852 {
1853 soulng::lexer::Span span = lexer.GetSpan();
1854 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
1855 stmt.reset(static_cast<StatementNode*>(match.value));
1856 if (match.hit)
1857 {
1858 *parentMatch10 = match;
1859 }
1860 else
1861 {
1862 lexer.ThrowExpectationFailure(span, U"statement");
1863 }
1864 }
1865 *parentMatch9 = match;
1866 }
1867 *parentMatch7 = match;
1868 }
1869 *parentMatch6 = match;
1870 }
1871 if (match.hit)
1872 {
1873 soulng::parser::Match match(false);
1874 soulng::parser::Match* parentMatch11 = &match;
1875 {
1876 soulng::parser::Match match(false);
1877 soulng::parser::Match* parentMatch12 = &match;
1878 {
1879 int64_t pos = lexer.GetPos();
1880 soulng::lexer::Span span = lexer.GetSpan();
1881 soulng::parser::Match match(true);
1882 soulng::parser::Match* parentMatch13 = &match;
1883 {
1884 soulng::lexer::Span span = lexer.GetSpan();
1885 soulng::parser::Match match(false);
1886 if (*lexer == WHILE)
1887 {
1888 ++lexer;
1889 match.hit = true;
1890 }
1891 if (match.hit)
1892 {
1893 *parentMatch13 = match;
1894 }
1895 else
1896 {
1897 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(WHILE)));
1898 }
1899 }
1900 if (match.hit)
1901 {
1902 whileSpan = span;
1903 }
1904 *parentMatch12 = match;
1905 }
1906 *parentMatch11 = match;
1907 }
1908 *parentMatch6 = match;
1909 }
1910 *parentMatch5 = match;
1911 }
1912 if (match.hit)
1913 {
1914 soulng::parser::Match match(false);
1915 soulng::parser::Match* parentMatch14 = &match;
1916 {
1917 soulng::parser::Match match(false);
1918 soulng::parser::Match* parentMatch15 = &match;
1919 {
1920 int64_t pos = lexer.GetPos();
1921 soulng::lexer::Span span = lexer.GetSpan();
1922 soulng::parser::Match match(true);
1923 soulng::parser::Match* parentMatch16 = &match;
1924 {
1925 soulng::lexer::Span span = lexer.GetSpan();
1926 soulng::parser::Match match(false);
1927 if (*lexer == LPAREN)
1928 {
1929 ++lexer;
1930 match.hit = true;
1931 }
1932 if (match.hit)
1933 {
1934 *parentMatch16 = match;
1935 }
1936 else
1937 {
1938 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LPAREN)));
1939 }
1940 }
1941 if (match.hit)
1942 {
1943 leftParenSpan = span;
1944 }
1945 *parentMatch15 = match;
1946 }
1947 *parentMatch14 = match;
1948 }
1949 *parentMatch5 = match;
1950 }
1951 *parentMatch4 = match;
1952 }
1953 if (match.hit)
1954 {
1955 soulng::parser::Match match(false);
1956 soulng::parser::Match* parentMatch17 = &match;
1957 {
1958 soulng::parser::Match match(true);
1959 soulng::parser::Match* parentMatch18 = &match;
1960 {
1961 soulng::lexer::Span span = lexer.GetSpan();
1962 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
1963 cond.reset(static_cast<Node*>(match.value));
1964 if (match.hit)
1965 {
1966 *parentMatch18 = match;
1967 }
1968 else
1969 {
1970 lexer.ThrowExpectationFailure(span, U"expression");
1971 }
1972 }
1973 *parentMatch17 = match;
1974 }
1975 *parentMatch4 = match;
1976 }
1977 *parentMatch3 = match;
1978 }
1979 if (match.hit)
1980 {
1981 soulng::parser::Match match(false);
1982 soulng::parser::Match* parentMatch19 = &match;
1983 {
1984 soulng::parser::Match match(false);
1985 soulng::parser::Match* parentMatch20 = &match;
1986 {
1987 int64_t pos = lexer.GetPos();
1988 soulng::lexer::Span span = lexer.GetSpan();
1989 soulng::parser::Match match(true);
1990 soulng::parser::Match* parentMatch21 = &match;
1991 {
1992 soulng::lexer::Span span = lexer.GetSpan();
1993 soulng::parser::Match match(false);
1994 if (*lexer == RPAREN)
1995 {
1996 ++lexer;
1997 match.hit = true;
1998 }
1999 if (match.hit)
2000 {
2001 *parentMatch21 = match;
2002 }
2003 else
2004 {
2005 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
2006 }
2007 }
2008 if (match.hit)
2009 {
2010 rightParenSpan = span;
2011 }
2012 *parentMatch20 = match;
2013 }
2014 *parentMatch19 = match;
2015 }
2016 *parentMatch3 = match;
2017 }
2018 *parentMatch2 = match;
2019 }
2020 if (match.hit)
2021 {
2022 soulng::parser::Match match(false);
2023 soulng::parser::Match* parentMatch22 = &match;
2024 {
2025 soulng::parser::Match match(false);
2026 soulng::parser::Match* parentMatch23 = &match;
2027 {
2028 int64_t pos = lexer.GetPos();
2029 soulng::lexer::Span span = lexer.GetSpan();
2030 soulng::parser::Match match(true);
2031 soulng::parser::Match* parentMatch24 = &match;
2032 {
2033 soulng::lexer::Span span = lexer.GetSpan();
2034 soulng::parser::Match match(false);
2035 if (*lexer == SEMICOLON)
2036 {
2037 ++lexer;
2038 match.hit = true;
2039 }
2040 if (match.hit)
2041 {
2042 *parentMatch24 = match;
2043 }
2044 else
2045 {
2046 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
2047 }
2048 }
2049 if (match.hit)
2050 {
2051 s.end = span.end;
2052 }
2053 *parentMatch23 = match;
2054 }
2055 *parentMatch22 = match;
2056 }
2057 *parentMatch2 = match;
2058 }
2059 *parentMatch1 = match;
2060 }
2061 if (match.hit)
2062 {
2063 DoStatementNode* value = new DoStatementNode(s, *moduleId, stmt.release(), cond.release());
2064 value->SetWhileSpan(whileSpan);
2065 value->SetLeftParenSpan(leftParenSpan);
2066 value->SetRightParenSpan(rightParenSpan);
2067 {
2068 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2069
2070 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2071 return soulng::parser::Match(true, value);
2072 }
2073 }
2074 *parentMatch0 = match;
2075 }
2076 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2077
2078
2079
2080
2081
2082 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2083 if (!match.hit)
2084 {
2085 match.value = nullptr;
2086 }
2087 return match;
2088 }
2089
2090 soulng::parser::Match StatementParser::ForStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
2091 {
2092 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2093
2094
2095
2096
2097
2098
2099
2100 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2101 Span s = Span();
2102 Span leftParenSpan = Span();
2103 Span rightParenSpan = Span();
2104 std::unique_ptr<StatementNode> init;
2105 std::unique_ptr<Node> cond;
2106 std::unique_ptr<StatementNode> loop;
2107 std::unique_ptr<StatementNode> stmt;
2108 soulng::parser::Match match(false);
2109 soulng::parser::Match* parentMatch0 = &match;
2110 {
2111 int64_t pos = lexer.GetPos();
2112 soulng::parser::Match match(false);
2113 soulng::parser::Match* parentMatch1 = &match;
2114 {
2115 soulng::parser::Match match(false);
2116 soulng::parser::Match* parentMatch2 = &match;
2117 {
2118 soulng::parser::Match match(false);
2119 soulng::parser::Match* parentMatch3 = &match;
2120 {
2121 soulng::parser::Match match(false);
2122 soulng::parser::Match* parentMatch4 = &match;
2123 {
2124 soulng::parser::Match match(false);
2125 soulng::parser::Match* parentMatch5 = &match;
2126 {
2127 soulng::parser::Match match(false);
2128 soulng::parser::Match* parentMatch6 = &match;
2129 {
2130 soulng::parser::Match match(false);
2131 soulng::parser::Match* parentMatch7 = &match;
2132 {
2133 soulng::parser::Match match(false);
2134 soulng::parser::Match* parentMatch8 = &match;
2135 {
2136 soulng::parser::Match match(false);
2137 soulng::parser::Match* parentMatch9 = &match;
2138 {
2139 int64_t pos = lexer.GetPos();
2140 soulng::lexer::Span span = lexer.GetSpan();
2141 soulng::parser::Match match(false);
2142 if (*lexer == FOR)
2143 {
2144 ++lexer;
2145 match.hit = true;
2146 }
2147 if (match.hit)
2148 {
2149 s = span;
2150 }
2151 *parentMatch9 = match;
2152 }
2153 *parentMatch8 = match;
2154 }
2155 if (match.hit)
2156 {
2157 soulng::parser::Match match(false);
2158 soulng::parser::Match* parentMatch10 = &match;
2159 {
2160 soulng::parser::Match match(false);
2161 soulng::parser::Match* parentMatch11 = &match;
2162 {
2163 int64_t pos = lexer.GetPos();
2164 soulng::lexer::Span span = lexer.GetSpan();
2165 soulng::parser::Match match(false);
2166 if (*lexer == LPAREN)
2167 {
2168 ++lexer;
2169 match.hit = true;
2170 }
2171 if (match.hit)
2172 {
2173 leftParenSpan = span;
2174 }
2175 *parentMatch11 = match;
2176 }
2177 *parentMatch10 = match;
2178 }
2179 *parentMatch8 = match;
2180 }
2181 *parentMatch7 = match;
2182 }
2183 if (match.hit)
2184 {
2185 soulng::parser::Match match(false);
2186 soulng::parser::Match* parentMatch12 = &match;
2187 {
2188 soulng::parser::Match match(true);
2189 soulng::parser::Match* parentMatch13 = &match;
2190 {
2191 soulng::lexer::Span span = lexer.GetSpan();
2192 soulng::parser::Match match = StatementParser::ForInitStatement(lexer, moduleId, ctx);
2193 init.reset(static_cast<StatementNode*>(match.value));
2194 if (match.hit)
2195 {
2196 *parentMatch13 = match;
2197 }
2198 else
2199 {
2200 lexer.ThrowExpectationFailure(span, U"for initialization statement");
2201 }
2202 }
2203 *parentMatch12 = match;
2204 }
2205 *parentMatch7 = match;
2206 }
2207 *parentMatch6 = match;
2208 }
2209 if (match.hit)
2210 {
2211 soulng::parser::Match match(false);
2212 soulng::parser::Match* parentMatch14 = &match;
2213 {
2214 soulng::parser::Match match(true);
2215 int64_t save = lexer.GetPos();
2216 soulng::parser::Match* parentMatch15 = &match;
2217 {
2218 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
2219 cond.reset(static_cast<Node*>(match.value));
2220 if (match.hit)
2221 {
2222 *parentMatch15 = match;
2223 }
2224 else
2225 {
2226 lexer.SetPos(save);
2227 }
2228 }
2229 *parentMatch14 = match;
2230 }
2231 *parentMatch6 = match;
2232 }
2233 *parentMatch5 = match;
2234 }
2235 if (match.hit)
2236 {
2237 soulng::parser::Match match(false);
2238 soulng::parser::Match* parentMatch16 = &match;
2239 {
2240 soulng::parser::Match match(true);
2241 soulng::parser::Match* parentMatch17 = &match;
2242 {
2243 soulng::lexer::Span span = lexer.GetSpan();
2244 soulng::parser::Match match(false);
2245 if (*lexer == SEMICOLON)
2246 {
2247 ++lexer;
2248 match.hit = true;
2249 }
2250 if (match.hit)
2251 {
2252 *parentMatch17 = match;
2253 }
2254 else
2255 {
2256 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
2257 }
2258 }
2259 *parentMatch16 = match;
2260 }
2261 *parentMatch5 = match;
2262 }
2263 *parentMatch4 = match;
2264 }
2265 if (match.hit)
2266 {
2267 soulng::parser::Match match(false);
2268 soulng::parser::Match* parentMatch18 = &match;
2269 {
2270 soulng::parser::Match match(true);
2271 soulng::parser::Match* parentMatch19 = &match;
2272 {
2273 soulng::lexer::Span span = lexer.GetSpan();
2274 soulng::parser::Match match = StatementParser::ForLoopStatementExpr(lexer, moduleId, ctx);
2275 loop.reset(static_cast<StatementNode*>(match.value));
2276 if (match.hit)
2277 {
2278 *parentMatch19 = match;
2279 }
2280 else
2281 {
2282 lexer.ThrowExpectationFailure(span, U"for loop expression");
2283 }
2284 }
2285 *parentMatch18 = match;
2286 }
2287 *parentMatch4 = match;
2288 }
2289 *parentMatch3 = match;
2290 }
2291 if (match.hit)
2292 {
2293 soulng::parser::Match match(false);
2294 soulng::parser::Match* parentMatch20 = &match;
2295 {
2296 soulng::parser::Match match(false);
2297 soulng::parser::Match* parentMatch21 = &match;
2298 {
2299 int64_t pos = lexer.GetPos();
2300 soulng::lexer::Span span = lexer.GetSpan();
2301 soulng::parser::Match match(true);
2302 soulng::parser::Match* parentMatch22 = &match;
2303 {
2304 soulng::lexer::Span span = lexer.GetSpan();
2305 soulng::parser::Match match(false);
2306 if (*lexer == RPAREN)
2307 {
2308 ++lexer;
2309 match.hit = true;
2310 }
2311 if (match.hit)
2312 {
2313 *parentMatch22 = match;
2314 }
2315 else
2316 {
2317 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
2318 }
2319 }
2320 if (match.hit)
2321 {
2322 rightParenSpan = span;
2323 }
2324 *parentMatch21 = match;
2325 }
2326 *parentMatch20 = match;
2327 }
2328 *parentMatch3 = match;
2329 }
2330 *parentMatch2 = match;
2331 }
2332 if (match.hit)
2333 {
2334 soulng::parser::Match match(false);
2335 soulng::parser::Match* parentMatch23 = &match;
2336 {
2337 soulng::parser::Match match(false);
2338 soulng::parser::Match* parentMatch24 = &match;
2339 {
2340 int64_t pos = lexer.GetPos();
2341 soulng::lexer::Span span = lexer.GetSpan();
2342 soulng::parser::Match match(true);
2343 soulng::parser::Match* parentMatch25 = &match;
2344 {
2345 soulng::lexer::Span span = lexer.GetSpan();
2346 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
2347 stmt.reset(static_cast<StatementNode*>(match.value));
2348 if (match.hit)
2349 {
2350 *parentMatch25 = match;
2351 }
2352 else
2353 {
2354 lexer.ThrowExpectationFailure(span, U"statement");
2355 }
2356 }
2357 if (match.hit)
2358 {
2359 s.end = span.end;
2360 }
2361 *parentMatch24 = match;
2362 }
2363 *parentMatch23 = match;
2364 }
2365 *parentMatch2 = match;
2366 }
2367 *parentMatch1 = match;
2368 }
2369 if (match.hit)
2370 {
2371 ForStatementNode* value = new ForStatementNode(s, *moduleId, init.release(), cond.release(), loop.release(), stmt.release());
2372 value->SetLeftParenSpan(leftParenSpan);
2373 value->SetRightParenSpan(rightParenSpan);
2374 {
2375 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2376
2377 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2378 return soulng::parser::Match(true, value);
2379 }
2380 }
2381 *parentMatch0 = match;
2382 }
2383 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2384
2385
2386
2387
2388
2389 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2390 if (!match.hit)
2391 {
2392 match.value = nullptr;
2393 }
2394 return match;
2395 }
2396
2397 soulng::parser::Match StatementParser::ForInitStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
2398 {
2399 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2400
2401
2402
2403
2404
2405
2406
2407 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2408 std::unique_ptr<StatementNode> assignmentStatement;
2409 std::unique_ptr<ConstructionStatementNode> constructionStatement;
2410 std::unique_ptr<StatementNode> emptyStatement;
2411 soulng::parser::Match match(false);
2412 soulng::parser::Match* parentMatch0 = &match;
2413 {
2414 int64_t save = lexer.GetPos();
2415 soulng::parser::Match match(false);
2416 soulng::parser::Match* parentMatch1 = &match;
2417 {
2418 int64_t save = lexer.GetPos();
2419 soulng::parser::Match match(false);
2420 soulng::parser::Match* parentMatch2 = &match;
2421 {
2422 int64_t pos = lexer.GetPos();
2423 soulng::parser::Match match = StatementParser::AssignmentStatement(lexer, moduleId, ctx);
2424 assignmentStatement.reset(static_cast<StatementNode*>(match.value));
2425 if (match.hit)
2426 {
2427 {
2428 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2429
2430 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2431 return soulng::parser::Match(true, assignmentStatement.release());
2432 }
2433 }
2434 *parentMatch2 = match;
2435 }
2436 *parentMatch1 = match;
2437 if (!match.hit)
2438 {
2439 soulng::parser::Match match(false);
2440 soulng::parser::Match* parentMatch3 = &match;
2441 lexer.SetPos(save);
2442 {
2443 soulng::parser::Match match(false);
2444 soulng::parser::Match* parentMatch4 = &match;
2445 {
2446 int64_t pos = lexer.GetPos();
2447 soulng::parser::Match match = StatementParser::ConstructionStatement(lexer, moduleId, ctx);
2448 constructionStatement.reset(static_cast<ConstructionStatementNode*>(match.value));
2449 if (match.hit)
2450 {
2451 {
2452 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2453
2454 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2455 return soulng::parser::Match(true, constructionStatement.release());
2456 }
2457 }
2458 *parentMatch4 = match;
2459 }
2460 *parentMatch3 = match;
2461 }
2462 *parentMatch1 = match;
2463 }
2464 }
2465 *parentMatch0 = match;
2466 if (!match.hit)
2467 {
2468 soulng::parser::Match match(false);
2469 soulng::parser::Match* parentMatch5 = &match;
2470 lexer.SetPos(save);
2471 {
2472 soulng::parser::Match match(false);
2473 soulng::parser::Match* parentMatch6 = &match;
2474 {
2475 int64_t pos = lexer.GetPos();
2476 soulng::parser::Match match = StatementParser::EmptyStatement(lexer, moduleId, ctx);
2477 emptyStatement.reset(static_cast<StatementNode*>(match.value));
2478 if (match.hit)
2479 {
2480 {
2481 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2482
2483 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2484 return soulng::parser::Match(true, emptyStatement.release());
2485 }
2486 }
2487 *parentMatch6 = match;
2488 }
2489 *parentMatch5 = match;
2490 }
2491 *parentMatch0 = match;
2492 }
2493 }
2494 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2495
2496
2497
2498
2499
2500 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2501 if (!match.hit)
2502 {
2503 match.value = nullptr;
2504 }
2505 return match;
2506 }
2507
2508 soulng::parser::Match StatementParser::ForLoopStatementExpr(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
2509 {
2510 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2511
2512
2513
2514
2515
2516
2517
2518 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2519 std::unique_ptr<Node> exprNode = std::unique_ptr<Node>();
2520 std::unique_ptr<StatementNode> assignmentStatementExpr;
2521 std::unique_ptr<Node> expr;
2522 soulng::parser::Match match(false);
2523 soulng::parser::Match* parentMatch0 = &match;
2524 {
2525 int64_t save = lexer.GetPos();
2526 soulng::parser::Match match(false);
2527 soulng::parser::Match* parentMatch1 = &match;
2528 {
2529 int64_t save = lexer.GetPos();
2530 soulng::parser::Match match(false);
2531 soulng::parser::Match* parentMatch2 = &match;
2532 {
2533 int64_t pos = lexer.GetPos();
2534 soulng::parser::Match match = StatementParser::AssignmentStatementExpr(lexer, moduleId, ctx);
2535 assignmentStatementExpr.reset(static_cast<StatementNode*>(match.value));
2536 if (match.hit)
2537 {
2538 {
2539 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2540
2541 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2542 return soulng::parser::Match(true, assignmentStatementExpr.release());
2543 }
2544 }
2545 *parentMatch2 = match;
2546 }
2547 *parentMatch1 = match;
2548 if (!match.hit)
2549 {
2550 soulng::parser::Match match(false);
2551 soulng::parser::Match* parentMatch3 = &match;
2552 lexer.SetPos(save);
2553 {
2554 soulng::parser::Match match(false);
2555 soulng::parser::Match* parentMatch4 = &match;
2556 {
2557 int64_t pos = lexer.GetPos();
2558 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
2559 expr.reset(static_cast<Node*>(match.value));
2560 if (match.hit)
2561 {
2562 exprNode.reset(expr.release());
2563 Span s = exprNode->GetSpan();
2564 ExpressionStatementNode* expressionStatementNode = new ExpressionStatementNode(s, *moduleId, exprNode.release());
2565 {
2566 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2567
2568 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2569 return soulng::parser::Match(true, expressionStatementNode);
2570 }
2571 }
2572 *parentMatch4 = match;
2573 }
2574 *parentMatch3 = match;
2575 }
2576 *parentMatch1 = match;
2577 }
2578 }
2579 *parentMatch0 = match;
2580 if (!match.hit)
2581 {
2582 soulng::parser::Match match(false);
2583 soulng::parser::Match* parentMatch5 = &match;
2584 lexer.SetPos(save);
2585 {
2586 soulng::parser::Match match(false);
2587 soulng::parser::Match* parentMatch6 = &match;
2588 {
2589 int64_t pos = lexer.GetPos();
2590 soulng::lexer::Span span = lexer.GetSpan();
2591 soulng::parser::Match match(true);
2592 if (match.hit)
2593 {
2594 EmptyStatementNode* emptyStatementNode = new EmptyStatementNode(span, *moduleId);
2595 {
2596 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2597
2598 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2599 return soulng::parser::Match(true, emptyStatementNode);
2600 }
2601 }
2602 *parentMatch6 = match;
2603 }
2604 *parentMatch5 = match;
2605 }
2606 *parentMatch0 = match;
2607 }
2608 }
2609 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2610
2611
2612
2613
2614
2615 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2616 if (!match.hit)
2617 {
2618 match.value = nullptr;
2619 }
2620 return match;
2621 }
2622
2623 soulng::parser::Match StatementParser::RangeForStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
2624 {
2625 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2626
2627
2628
2629
2630
2631
2632
2633 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2634 Span s = Span();
2635 Span leftParenSpan = Span();
2636 Span rightParenSpan = Span();
2637 Span colonSpan = Span();
2638 std::unique_ptr<sngcm::ast::Node> type;
2639 std::unique_ptr<IdentifierNode> id;
2640 std::unique_ptr<Node> container;
2641 std::unique_ptr<StatementNode> action;
2642 soulng::parser::Match match(false);
2643 soulng::parser::Match* parentMatch0 = &match;
2644 {
2645 int64_t pos = lexer.GetPos();
2646 soulng::parser::Match match(false);
2647 soulng::parser::Match* parentMatch1 = &match;
2648 {
2649 soulng::parser::Match match(false);
2650 soulng::parser::Match* parentMatch2 = &match;
2651 {
2652 soulng::parser::Match match(false);
2653 soulng::parser::Match* parentMatch3 = &match;
2654 {
2655 soulng::parser::Match match(false);
2656 soulng::parser::Match* parentMatch4 = &match;
2657 {
2658 soulng::parser::Match match(false);
2659 soulng::parser::Match* parentMatch5 = &match;
2660 {
2661 soulng::parser::Match match(false);
2662 soulng::parser::Match* parentMatch6 = &match;
2663 {
2664 soulng::parser::Match match(false);
2665 soulng::parser::Match* parentMatch7 = &match;
2666 {
2667 soulng::parser::Match match(false);
2668 soulng::parser::Match* parentMatch8 = &match;
2669 {
2670 soulng::parser::Match match(false);
2671 soulng::parser::Match* parentMatch9 = &match;
2672 {
2673 int64_t pos = lexer.GetPos();
2674 soulng::lexer::Span span = lexer.GetSpan();
2675 soulng::parser::Match match(false);
2676 if (*lexer == FOR)
2677 {
2678 ++lexer;
2679 match.hit = true;
2680 }
2681 if (match.hit)
2682 {
2683 s = span;
2684 }
2685 *parentMatch9 = match;
2686 }
2687 *parentMatch8 = match;
2688 }
2689 if (match.hit)
2690 {
2691 soulng::parser::Match match(false);
2692 soulng::parser::Match* parentMatch10 = &match;
2693 {
2694 soulng::parser::Match match(false);
2695 soulng::parser::Match* parentMatch11 = &match;
2696 {
2697 int64_t pos = lexer.GetPos();
2698 soulng::lexer::Span span = lexer.GetSpan();
2699 soulng::parser::Match match(false);
2700 if (*lexer == LPAREN)
2701 {
2702 ++lexer;
2703 match.hit = true;
2704 }
2705 if (match.hit)
2706 {
2707 leftParenSpan = span;
2708 }
2709 *parentMatch11 = match;
2710 }
2711 *parentMatch10 = match;
2712 }
2713 *parentMatch8 = match;
2714 }
2715 *parentMatch7 = match;
2716 }
2717 if (match.hit)
2718 {
2719 soulng::parser::Match match(false);
2720 soulng::parser::Match* parentMatch12 = &match;
2721 {
2722 soulng::parser::Match match = TypeExprParser::TypeExpr(lexer, moduleId, ctx);
2723 type.reset(static_cast<sngcm::ast::Node*>(match.value));
2724 *parentMatch12 = match;
2725 }
2726 *parentMatch7 = match;
2727 }
2728 *parentMatch6 = match;
2729 }
2730 if (match.hit)
2731 {
2732 soulng::parser::Match match(false);
2733 soulng::parser::Match* parentMatch13 = &match;
2734 {
2735 soulng::parser::Match match = IdentifierParser::Identifier(lexer, moduleId);
2736 id.reset(static_cast<IdentifierNode*>(match.value));
2737 *parentMatch13 = match;
2738 }
2739 *parentMatch6 = match;
2740 }
2741 *parentMatch5 = match;
2742 }
2743 if (match.hit)
2744 {
2745 soulng::parser::Match match(false);
2746 soulng::parser::Match* parentMatch14 = &match;
2747 {
2748 soulng::parser::Match match(false);
2749 soulng::parser::Match* parentMatch15 = &match;
2750 {
2751 int64_t pos = lexer.GetPos();
2752 soulng::lexer::Span span = lexer.GetSpan();
2753 soulng::parser::Match match(false);
2754 if (*lexer == COLON)
2755 {
2756 ++lexer;
2757 match.hit = true;
2758 }
2759 if (match.hit)
2760 {
2761 colonSpan = span;
2762 }
2763 *parentMatch15 = match;
2764 }
2765 *parentMatch14 = match;
2766 }
2767 *parentMatch5 = match;
2768 }
2769 *parentMatch4 = match;
2770 }
2771 if (match.hit)
2772 {
2773 soulng::parser::Match match(false);
2774 soulng::parser::Match* parentMatch16 = &match;
2775 {
2776 soulng::parser::Match match(true);
2777 soulng::parser::Match* parentMatch17 = &match;
2778 {
2779 soulng::lexer::Span span = lexer.GetSpan();
2780 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
2781 container.reset(static_cast<Node*>(match.value));
2782 if (match.hit)
2783 {
2784 *parentMatch17 = match;
2785 }
2786 else
2787 {
2788 lexer.ThrowExpectationFailure(span, U"expression");
2789 }
2790 }
2791 *parentMatch16 = match;
2792 }
2793 *parentMatch4 = match;
2794 }
2795 *parentMatch3 = match;
2796 }
2797 if (match.hit)
2798 {
2799 soulng::parser::Match match(false);
2800 soulng::parser::Match* parentMatch18 = &match;
2801 {
2802 soulng::parser::Match match(false);
2803 soulng::parser::Match* parentMatch19 = &match;
2804 {
2805 int64_t pos = lexer.GetPos();
2806 soulng::lexer::Span span = lexer.GetSpan();
2807 soulng::parser::Match match(true);
2808 soulng::parser::Match* parentMatch20 = &match;
2809 {
2810 soulng::lexer::Span span = lexer.GetSpan();
2811 soulng::parser::Match match(false);
2812 if (*lexer == RPAREN)
2813 {
2814 ++lexer;
2815 match.hit = true;
2816 }
2817 if (match.hit)
2818 {
2819 *parentMatch20 = match;
2820 }
2821 else
2822 {
2823 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
2824 }
2825 }
2826 if (match.hit)
2827 {
2828 rightParenSpan = span;
2829 }
2830 *parentMatch19 = match;
2831 }
2832 *parentMatch18 = match;
2833 }
2834 *parentMatch3 = match;
2835 }
2836 *parentMatch2 = match;
2837 }
2838 if (match.hit)
2839 {
2840 soulng::parser::Match match(false);
2841 soulng::parser::Match* parentMatch21 = &match;
2842 {
2843 soulng::parser::Match match(false);
2844 soulng::parser::Match* parentMatch22 = &match;
2845 {
2846 int64_t pos = lexer.GetPos();
2847 soulng::lexer::Span span = lexer.GetSpan();
2848 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
2849 action.reset(static_cast<StatementNode*>(match.value));
2850 if (match.hit)
2851 {
2852 s.end = span.end;
2853 }
2854 *parentMatch22 = match;
2855 }
2856 *parentMatch21 = match;
2857 }
2858 *parentMatch2 = match;
2859 }
2860 *parentMatch1 = match;
2861 }
2862 if (match.hit)
2863 {
2864 RangeForStatementNode* value = new RangeForStatementNode(s, *moduleId, type.release(), id.release(), container.release(), action.release());
2865 value->SetLeftParenSpan(leftParenSpan);
2866 value->SetRightParenSpan(rightParenSpan);
2867 value->SetColonSpan(colonSpan);
2868 {
2869 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2870
2871 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2872 return soulng::parser::Match(true, value);
2873 }
2874 }
2875 *parentMatch0 = match;
2876 }
2877 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2878
2879
2880
2881
2882
2883 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2884 if (!match.hit)
2885 {
2886 match.value = nullptr;
2887 }
2888 return match;
2889 }
2890
2891 soulng::parser::Match StatementParser::BreakStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
2892 {
2893 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2894
2895
2896
2897
2898
2899
2900
2901 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2902 Span s = Span();
2903 soulng::parser::Match match(false);
2904 soulng::parser::Match* parentMatch0 = &match;
2905 {
2906 soulng::parser::Match match(false);
2907 soulng::parser::Match* parentMatch1 = &match;
2908 {
2909 int64_t pos = lexer.GetPos();
2910 soulng::lexer::Span span = lexer.GetSpan();
2911 soulng::parser::Match match(false);
2912 if (*lexer == BREAK)
2913 {
2914 ++lexer;
2915 match.hit = true;
2916 }
2917 if (match.hit)
2918 {
2919 s = span;
2920 }
2921 *parentMatch1 = match;
2922 }
2923 *parentMatch0 = match;
2924 }
2925 if (match.hit)
2926 {
2927 soulng::parser::Match match(false);
2928 soulng::parser::Match* parentMatch2 = &match;
2929 {
2930 soulng::parser::Match match(false);
2931 soulng::parser::Match* parentMatch3 = &match;
2932 {
2933 int64_t pos = lexer.GetPos();
2934 soulng::lexer::Span span = lexer.GetSpan();
2935 soulng::parser::Match match(true);
2936 soulng::parser::Match* parentMatch4 = &match;
2937 {
2938 soulng::lexer::Span span = lexer.GetSpan();
2939 soulng::parser::Match match(false);
2940 if (*lexer == SEMICOLON)
2941 {
2942 ++lexer;
2943 match.hit = true;
2944 }
2945 if (match.hit)
2946 {
2947 *parentMatch4 = match;
2948 }
2949 else
2950 {
2951 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
2952 }
2953 }
2954 if (match.hit)
2955 {
2956 s.end = span.end;
2957 {
2958 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2959
2960 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2961 return soulng::parser::Match(true, new BreakStatementNode(s, *moduleId));
2962 }
2963 }
2964 *parentMatch3 = match;
2965 }
2966 *parentMatch2 = match;
2967 }
2968 *parentMatch0 = match;
2969 }
2970 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2971
2972
2973
2974
2975
2976 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2977 if (!match.hit)
2978 {
2979 match.value = nullptr;
2980 }
2981 return match;
2982 }
2983
2984 soulng::parser::Match StatementParser::ContinueStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
2985 {
2986 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2987
2988
2989
2990
2991
2992
2993
2994 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2995 Span s = Span();
2996 soulng::parser::Match match(false);
2997 soulng::parser::Match* parentMatch0 = &match;
2998 {
2999 soulng::parser::Match match(false);
3000 soulng::parser::Match* parentMatch1 = &match;
3001 {
3002 int64_t pos = lexer.GetPos();
3003 soulng::lexer::Span span = lexer.GetSpan();
3004 soulng::parser::Match match(false);
3005 if (*lexer == CONTINUE)
3006 {
3007 ++lexer;
3008 match.hit = true;
3009 }
3010 if (match.hit)
3011 {
3012 s = span;
3013 }
3014 *parentMatch1 = match;
3015 }
3016 *parentMatch0 = match;
3017 }
3018 if (match.hit)
3019 {
3020 soulng::parser::Match match(false);
3021 soulng::parser::Match* parentMatch2 = &match;
3022 {
3023 soulng::parser::Match match(false);
3024 soulng::parser::Match* parentMatch3 = &match;
3025 {
3026 int64_t pos = lexer.GetPos();
3027 soulng::lexer::Span span = lexer.GetSpan();
3028 soulng::parser::Match match(true);
3029 soulng::parser::Match* parentMatch4 = &match;
3030 {
3031 soulng::lexer::Span span = lexer.GetSpan();
3032 soulng::parser::Match match(false);
3033 if (*lexer == SEMICOLON)
3034 {
3035 ++lexer;
3036 match.hit = true;
3037 }
3038 if (match.hit)
3039 {
3040 *parentMatch4 = match;
3041 }
3042 else
3043 {
3044 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
3045 }
3046 }
3047 if (match.hit)
3048 {
3049 s.end = span.end;
3050 {
3051 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3052
3053 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3054 return soulng::parser::Match(true, new ContinueStatementNode(s, *moduleId));
3055 }
3056 }
3057 *parentMatch3 = match;
3058 }
3059 *parentMatch2 = match;
3060 }
3061 *parentMatch0 = match;
3062 }
3063 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3064
3065
3066
3067
3068
3069 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3070 if (!match.hit)
3071 {
3072 match.value = nullptr;
3073 }
3074 return match;
3075 }
3076
3077 soulng::parser::Match StatementParser::GotoStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
3078 {
3079 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3080
3081
3082
3083
3084
3085
3086
3087 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3088 std::u32string label = std::u32string();
3089 Span s = Span();
3090 soulng::parser::Match match(false);
3091 soulng::parser::Match* parentMatch0 = &match;
3092 {
3093 soulng::parser::Match match(false);
3094 soulng::parser::Match* parentMatch1 = &match;
3095 {
3096 soulng::parser::Match match(false);
3097 soulng::parser::Match* parentMatch2 = &match;
3098 {
3099 int64_t pos = lexer.GetPos();
3100 soulng::lexer::Span span = lexer.GetSpan();
3101 soulng::parser::Match match(false);
3102 if (*lexer == GOTO)
3103 {
3104 ++lexer;
3105 match.hit = true;
3106 }
3107 if (match.hit)
3108 {
3109 s = span;
3110 }
3111 *parentMatch2 = match;
3112 }
3113 *parentMatch1 = match;
3114 }
3115 if (match.hit)
3116 {
3117 soulng::parser::Match match(false);
3118 soulng::parser::Match* parentMatch3 = &match;
3119 {
3120 soulng::parser::Match match(false);
3121 soulng::parser::Match* parentMatch4 = &match;
3122 {
3123 int64_t pos = lexer.GetPos();
3124 soulng::lexer::Span span = lexer.GetSpan();
3125 soulng::parser::Match match(false);
3126 if (*lexer == ID)
3127 {
3128 ++lexer;
3129 match.hit = true;
3130 }
3131 if (match.hit)
3132 {
3133 label = lexer.GetMatch(span);
3134 }
3135 *parentMatch4 = match;
3136 }
3137 *parentMatch3 = match;
3138 }
3139 *parentMatch1 = match;
3140 }
3141 *parentMatch0 = match;
3142 }
3143 if (match.hit)
3144 {
3145 soulng::parser::Match match(false);
3146 soulng::parser::Match* parentMatch5 = &match;
3147 {
3148 soulng::parser::Match match(false);
3149 soulng::parser::Match* parentMatch6 = &match;
3150 {
3151 int64_t pos = lexer.GetPos();
3152 soulng::lexer::Span span = lexer.GetSpan();
3153 soulng::parser::Match match(true);
3154 soulng::parser::Match* parentMatch7 = &match;
3155 {
3156 soulng::lexer::Span span = lexer.GetSpan();
3157 soulng::parser::Match match(false);
3158 if (*lexer == SEMICOLON)
3159 {
3160 ++lexer;
3161 match.hit = true;
3162 }
3163 if (match.hit)
3164 {
3165 *parentMatch7 = match;
3166 }
3167 else
3168 {
3169 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
3170 }
3171 }
3172 if (match.hit)
3173 {
3174 s.end = span.end;
3175 {
3176 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3177
3178 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3179 return soulng::parser::Match(true, new GotoStatementNode(s, *moduleId, label));
3180 }
3181 }
3182 *parentMatch6 = match;
3183 }
3184 *parentMatch5 = match;
3185 }
3186 *parentMatch0 = match;
3187 }
3188 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3189
3190
3191
3192
3193
3194 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3195 if (!match.hit)
3196 {
3197 match.value = nullptr;
3198 }
3199 return match;
3200 }
3201
3202 soulng::parser::Match StatementParser::SwitchStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
3203 {
3204 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3205
3206
3207
3208
3209
3210
3211
3212 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3213 std::unique_ptr<SwitchStatementNode> switchStatement = std::unique_ptr<SwitchStatementNode>();
3214 Span leftParenSpan = Span();
3215 Span rightParenSpan = Span();
3216 Span beginBraceSpan = Span();
3217 Span endBraceSpan = Span();
3218 std::unique_ptr<Node> cond;
3219 std::unique_ptr<CaseStatementNode> caseStatement;
3220 std::unique_ptr<DefaultStatementNode> defaultStatement;
3221 soulng::parser::Match match(false);
3222 soulng::parser::Match* parentMatch0 = &match;
3223 {
3224 soulng::parser::Match match(false);
3225 soulng::parser::Match* parentMatch1 = &match;
3226 {
3227 soulng::parser::Match match(false);
3228 soulng::parser::Match* parentMatch2 = &match;
3229 {
3230 soulng::parser::Match match(false);
3231 soulng::parser::Match* parentMatch3 = &match;
3232 {
3233 int64_t pos = lexer.GetPos();
3234 soulng::lexer::Span span = lexer.GetSpan();
3235 soulng::parser::Match match(false);
3236 soulng::parser::Match* parentMatch4 = &match;
3237 {
3238 soulng::parser::Match match(false);
3239 soulng::parser::Match* parentMatch5 = &match;
3240 {
3241 soulng::parser::Match match(false);
3242 soulng::parser::Match* parentMatch6 = &match;
3243 {
3244 soulng::parser::Match match(false);
3245 soulng::parser::Match* parentMatch7 = &match;
3246 {
3247 soulng::parser::Match match(false);
3248 if (*lexer == SWITCH)
3249 {
3250 ++lexer;
3251 match.hit = true;
3252 }
3253 *parentMatch7 = match;
3254 }
3255 if (match.hit)
3256 {
3257 soulng::parser::Match match(false);
3258 soulng::parser::Match* parentMatch8 = &match;
3259 {
3260 soulng::parser::Match match(false);
3261 soulng::parser::Match* parentMatch9 = &match;
3262 {
3263 int64_t pos = lexer.GetPos();
3264 soulng::lexer::Span span = lexer.GetSpan();
3265 soulng::parser::Match match(true);
3266 soulng::parser::Match* parentMatch10 = &match;
3267 {
3268 soulng::lexer::Span span = lexer.GetSpan();
3269 soulng::parser::Match match(false);
3270 if (*lexer == LPAREN)
3271 {
3272 ++lexer;
3273 match.hit = true;
3274 }
3275 if (match.hit)
3276 {
3277 *parentMatch10 = match;
3278 }
3279 else
3280 {
3281 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LPAREN)));
3282 }
3283 }
3284 if (match.hit)
3285 {
3286 leftParenSpan = span;
3287 }
3288 *parentMatch9 = match;
3289 }
3290 *parentMatch8 = match;
3291 }
3292 *parentMatch7 = match;
3293 }
3294 *parentMatch6 = match;
3295 }
3296 if (match.hit)
3297 {
3298 soulng::parser::Match match(false);
3299 soulng::parser::Match* parentMatch11 = &match;
3300 {
3301 soulng::parser::Match match(true);
3302 soulng::parser::Match* parentMatch12 = &match;
3303 {
3304 soulng::lexer::Span span = lexer.GetSpan();
3305 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
3306 cond.reset(static_cast<Node*>(match.value));
3307 if (match.hit)
3308 {
3309 *parentMatch12 = match;
3310 }
3311 else
3312 {
3313 lexer.ThrowExpectationFailure(span, U"expression");
3314 }
3315 }
3316 *parentMatch11 = match;
3317 }
3318 *parentMatch6 = match;
3319 }
3320 *parentMatch5 = match;
3321 }
3322 if (match.hit)
3323 {
3324 soulng::parser::Match match(false);
3325 soulng::parser::Match* parentMatch13 = &match;
3326 {
3327 soulng::parser::Match match(true);
3328 soulng::parser::Match* parentMatch14 = &match;
3329 {
3330 soulng::lexer::Span span = lexer.GetSpan();
3331 soulng::parser::Match match(false);
3332 if (*lexer == RPAREN)
3333 {
3334 ++lexer;
3335 match.hit = true;
3336 }
3337 if (match.hit)
3338 {
3339 *parentMatch14 = match;
3340 }
3341 else
3342 {
3343 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
3344 }
3345 }
3346 *parentMatch13 = match;
3347 }
3348 *parentMatch5 = match;
3349 }
3350 *parentMatch4 = match;
3351 }
3352 if (match.hit)
3353 {
3354 rightParenSpan = span;
3355 switchStatement.reset(new SwitchStatementNode(span, *moduleId, cond.release()));
3356 switchStatement->SetLeftParenSpan(leftParenSpan);
3357 switchStatement->SetRightParenSpan(rightParenSpan);
3358 }
3359 *parentMatch3 = match;
3360 }
3361 *parentMatch2 = match;
3362 }
3363 if (match.hit)
3364 {
3365 soulng::parser::Match match(false);
3366 soulng::parser::Match* parentMatch15 = &match;
3367 {
3368 soulng::parser::Match match(false);
3369 soulng::parser::Match* parentMatch16 = &match;
3370 {
3371 int64_t pos = lexer.GetPos();
3372 soulng::lexer::Span span = lexer.GetSpan();
3373 soulng::parser::Match match(true);
3374 soulng::parser::Match* parentMatch17 = &match;
3375 {
3376 soulng::lexer::Span span = lexer.GetSpan();
3377 soulng::parser::Match match(false);
3378 if (*lexer == LBRACE)
3379 {
3380 ++lexer;
3381 match.hit = true;
3382 }
3383 if (match.hit)
3384 {
3385 *parentMatch17 = match;
3386 }
3387 else
3388 {
3389 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LBRACE)));
3390 }
3391 }
3392 if (match.hit)
3393 {
3394 beginBraceSpan = span;
3395 }
3396 *parentMatch16 = match;
3397 }
3398 *parentMatch15 = match;
3399 }
3400 *parentMatch2 = match;
3401 }
3402 *parentMatch1 = match;
3403 }
3404 if (match.hit)
3405 {
3406 soulng::parser::Match match(false);
3407 soulng::parser::Match* parentMatch18 = &match;
3408 {
3409 soulng::parser::Match match(true);
3410 soulng::parser::Match* parentMatch19 = &match;
3411 {
3412 while (true)
3413 {
3414 int64_t save = lexer.GetPos();
3415 {
3416 soulng::parser::Match match(false);
3417 soulng::parser::Match* parentMatch20 = &match;
3418 {
3419 soulng::parser::Match match(false);
3420 soulng::parser::Match* parentMatch21 = &match;
3421 {
3422 int64_t save = lexer.GetPos();
3423 soulng::parser::Match match(false);
3424 soulng::parser::Match* parentMatch22 = &match;
3425 {
3426 int64_t pos = lexer.GetPos();
3427 soulng::parser::Match match = StatementParser::CaseStatement(lexer, moduleId, ctx);
3428 caseStatement.reset(static_cast<CaseStatementNode*>(match.value));
3429 if (match.hit)
3430 {
3431 switchStatement->AddCase(caseStatement.release());
3432 }
3433 *parentMatch22 = match;
3434 }
3435 *parentMatch21 = match;
3436 if (!match.hit)
3437 {
3438 soulng::parser::Match match(false);
3439 soulng::parser::Match* parentMatch23 = &match;
3440 lexer.SetPos(save);
3441 {
3442 soulng::parser::Match match(false);
3443 soulng::parser::Match* parentMatch24 = &match;
3444 {
3445 int64_t pos = lexer.GetPos();
3446 soulng::parser::Match match = StatementParser::DefaultStatement(lexer, moduleId, ctx);
3447 defaultStatement.reset(static_cast<DefaultStatementNode*>(match.value));
3448 if (match.hit)
3449 {
3450 switchStatement->SetDefault(defaultStatement.release());
3451 }
3452 *parentMatch24 = match;
3453 }
3454 *parentMatch23 = match;
3455 }
3456 *parentMatch21 = match;
3457 }
3458 }
3459 *parentMatch20 = match;
3460 }
3461 if (match.hit)
3462 {
3463 *parentMatch19 = match;
3464 }
3465 else
3466 {
3467 lexer.SetPos(save);
3468 break;
3469 }
3470 }
3471 }
3472 }
3473 *parentMatch18 = match;
3474 }
3475 *parentMatch1 = match;
3476 }
3477 *parentMatch0 = match;
3478 }
3479 if (match.hit)
3480 {
3481 soulng::parser::Match match(false);
3482 soulng::parser::Match* parentMatch25 = &match;
3483 {
3484 soulng::parser::Match match(false);
3485 soulng::parser::Match* parentMatch26 = &match;
3486 {
3487 int64_t pos = lexer.GetPos();
3488 soulng::lexer::Span span = lexer.GetSpan();
3489 soulng::parser::Match match(true);
3490 soulng::parser::Match* parentMatch27 = &match;
3491 {
3492 soulng::lexer::Span span = lexer.GetSpan();
3493 soulng::parser::Match match(false);
3494 if (*lexer == RBRACE)
3495 {
3496 ++lexer;
3497 match.hit = true;
3498 }
3499 if (match.hit)
3500 {
3501 *parentMatch27 = match;
3502 }
3503 else
3504 {
3505 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RBRACE)));
3506 }
3507 }
3508 if (match.hit)
3509 {
3510 endBraceSpan = span;
3511 switchStatement->SetBeginBraceSpan(beginBraceSpan);
3512 switchStatement->SetEndBraceSpan(endBraceSpan);
3513 {
3514 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3515
3516 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3517 return soulng::parser::Match(true, switchStatement.release());
3518 }
3519 }
3520 *parentMatch26 = match;
3521 }
3522 *parentMatch25 = match;
3523 }
3524 *parentMatch0 = match;
3525 }
3526 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3527
3528
3529
3530
3531
3532 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3533 if (!match.hit)
3534 {
3535 match.value = nullptr;
3536 }
3537 return match;
3538 }
3539
3540 soulng::parser::Match StatementParser::CaseStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
3541 {
3542 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3543
3544
3545
3546
3547
3548
3549
3550 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3551 std::unique_ptr<CaseStatementNode> caseS = std::unique_ptr<CaseStatementNode>();
3552 Span s = Span();
3553 Span caseSpan = Span();
3554 std::unique_ptr<Node> caseExpr;
3555 std::unique_ptr<StatementNode> stmt;
3556 soulng::parser::Match match(false);
3557 soulng::parser::Match* parentMatch0 = &match;
3558 {
3559 soulng::parser::Match match(false);
3560 soulng::parser::Match* parentMatch1 = &match;
3561 {
3562 int64_t pos = lexer.GetPos();
3563 soulng::lexer::Span span = lexer.GetSpan();
3564 soulng::parser::Match match(true);
3565 if (match.hit)
3566 {
3567 caseS.reset(new CaseStatementNode(span, *moduleId));
3568 s = span;
3569 }
3570 *parentMatch1 = match;
3571 }
3572 *parentMatch0 = match;
3573 }
3574 if (match.hit)
3575 {
3576 soulng::parser::Match match(false);
3577 soulng::parser::Match* parentMatch2 = &match;
3578 {
3579 soulng::parser::Match match(false);
3580 soulng::parser::Match* parentMatch3 = &match;
3581 {
3582 int64_t pos = lexer.GetPos();
3583 soulng::parser::Match match(false);
3584 soulng::parser::Match* parentMatch4 = &match;
3585 {
3586 soulng::parser::Match match(false);
3587 soulng::parser::Match* parentMatch5 = &match;
3588 {
3589 soulng::parser::Match match(false);
3590 soulng::parser::Match* parentMatch6 = &match;
3591 {
3592 int64_t pos = lexer.GetPos();
3593 soulng::lexer::Span span = lexer.GetSpan();
3594 soulng::parser::Match match(false);
3595 soulng::parser::Match* parentMatch7 = &match;
3596 {
3597 soulng::parser::Match match(false);
3598 soulng::parser::Match* parentMatch8 = &match;
3599 {
3600 soulng::parser::Match match(false);
3601 soulng::parser::Match* parentMatch9 = &match;
3602 {
3603 soulng::parser::Match match(false);
3604 soulng::parser::Match* parentMatch10 = &match;
3605 {
3606 soulng::parser::Match match(false);
3607 soulng::parser::Match* parentMatch11 = &match;
3608 {
3609 soulng::parser::Match match(false);
3610 soulng::parser::Match* parentMatch12 = &match;
3611 {
3612 int64_t pos = lexer.GetPos();
3613 soulng::lexer::Span span = lexer.GetSpan();
3614 soulng::parser::Match match(false);
3615 if (*lexer == CASE)
3616 {
3617 ++lexer;
3618 match.hit = true;
3619 }
3620 if (match.hit)
3621 {
3622 caseSpan = span;
3623 }
3624 *parentMatch12 = match;
3625 }
3626 *parentMatch11 = match;
3627 }
3628 if (match.hit)
3629 {
3630 soulng::parser::Match match(false);
3631 soulng::parser::Match* parentMatch13 = &match;
3632 {
3633 soulng::parser::Match match(false);
3634 soulng::parser::Match* parentMatch14 = &match;
3635 {
3636 int64_t pos = lexer.GetPos();
3637 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
3638 caseExpr.reset(static_cast<Node*>(match.value));
3639 if (match.hit)
3640 {
3641 caseS->AddCaseSpan(caseSpan);
3642 caseS->AddCaseExpr(caseExpr.release());
3643 }
3644 *parentMatch14 = match;
3645 }
3646 *parentMatch13 = match;
3647 }
3648 *parentMatch11 = match;
3649 }
3650 *parentMatch10 = match;
3651 }
3652 if (match.hit)
3653 {
3654 soulng::parser::Match match(false);
3655 soulng::parser::Match* parentMatch15 = &match;
3656 {
3657 soulng::parser::Match match(true);
3658 soulng::parser::Match* parentMatch16 = &match;
3659 {
3660 soulng::lexer::Span span = lexer.GetSpan();
3661 soulng::parser::Match match(false);
3662 if (*lexer == COLON)
3663 {
3664 ++lexer;
3665 match.hit = true;
3666 }
3667 if (match.hit)
3668 {
3669 *parentMatch16 = match;
3670 }
3671 else
3672 {
3673 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(COLON)));
3674 }
3675 }
3676 *parentMatch15 = match;
3677 }
3678 *parentMatch10 = match;
3679 }
3680 *parentMatch9 = match;
3681 }
3682 *parentMatch8 = match;
3683 }
3684 if (match.hit)
3685 {
3686 soulng::parser::Match match(true);
3687 soulng::parser::Match* parentMatch17 = &match;
3688 while (true)
3689 {
3690 int64_t save = lexer.GetPos();
3691 {
3692 soulng::parser::Match match(false);
3693 soulng::parser::Match* parentMatch18 = &match;
3694 {
3695 soulng::parser::Match match(false);
3696 soulng::parser::Match* parentMatch19 = &match;
3697 {
3698 soulng::parser::Match match(false);
3699 soulng::parser::Match* parentMatch20 = &match;
3700 {
3701 soulng::parser::Match match(false);
3702 soulng::parser::Match* parentMatch21 = &match;
3703 {
3704 int64_t pos = lexer.GetPos();
3705 soulng::lexer::Span span = lexer.GetSpan();
3706 soulng::parser::Match match(false);
3707 if (*lexer == CASE)
3708 {
3709 ++lexer;
3710 match.hit = true;
3711 }
3712 if (match.hit)
3713 {
3714 caseSpan = span;
3715 }
3716 *parentMatch21 = match;
3717 }
3718 *parentMatch20 = match;
3719 }
3720 if (match.hit)
3721 {
3722 soulng::parser::Match match(false);
3723 soulng::parser::Match* parentMatch22 = &match;
3724 {
3725 soulng::parser::Match match(false);
3726 soulng::parser::Match* parentMatch23 = &match;
3727 {
3728 int64_t pos = lexer.GetPos();
3729 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
3730 caseExpr.reset(static_cast<Node*>(match.value));
3731 if (match.hit)
3732 {
3733 caseS->AddCaseSpan(caseSpan);
3734 caseS->AddCaseExpr(caseExpr.release());
3735 }
3736 *parentMatch23 = match;
3737 }
3738 *parentMatch22 = match;
3739 }
3740 *parentMatch20 = match;
3741 }
3742 *parentMatch19 = match;
3743 }
3744 if (match.hit)
3745 {
3746 soulng::parser::Match match(false);
3747 soulng::parser::Match* parentMatch24 = &match;
3748 {
3749 soulng::parser::Match match(true);
3750 soulng::parser::Match* parentMatch25 = &match;
3751 {
3752 soulng::lexer::Span span = lexer.GetSpan();
3753 soulng::parser::Match match(false);
3754 if (*lexer == COLON)
3755 {
3756 ++lexer;
3757 match.hit = true;
3758 }
3759 if (match.hit)
3760 {
3761 *parentMatch25 = match;
3762 }
3763 else
3764 {
3765 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(COLON)));
3766 }
3767 }
3768 *parentMatch24 = match;
3769 }
3770 *parentMatch19 = match;
3771 }
3772 *parentMatch18 = match;
3773 }
3774 if (match.hit)
3775 {
3776 *parentMatch17 = match;
3777 }
3778 else
3779 {
3780 lexer.SetPos(save);
3781 break;
3782 }
3783 }
3784 }
3785 }
3786 *parentMatch7 = match;
3787 }
3788 if (match.hit)
3789 {
3790 s.end = span.end;
3791 caseS->SetSpan(s);
3792 }
3793 *parentMatch6 = match;
3794 }
3795 *parentMatch5 = match;
3796 }
3797 if (match.hit)
3798 {
3799 soulng::parser::Match match(false);
3800 soulng::parser::Match* parentMatch26 = &match;
3801 {
3802 soulng::parser::Match match(true);
3803 soulng::parser::Match* parentMatch27 = &match;
3804 {
3805 while (true)
3806 {
3807 int64_t save = lexer.GetPos();
3808 {
3809 soulng::parser::Match match(false);
3810 soulng::parser::Match* parentMatch28 = &match;
3811 {
3812 soulng::parser::Match match(false);
3813 soulng::parser::Match* parentMatch29 = &match;
3814 {
3815 int64_t pos = lexer.GetPos();
3816 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
3817 stmt.reset(static_cast<StatementNode*>(match.value));
3818 if (match.hit)
3819 {
3820 caseS->AddStatement(stmt.release());
3821 }
3822 *parentMatch29 = match;
3823 }
3824 *parentMatch28 = match;
3825 }
3826 if (match.hit)
3827 {
3828 *parentMatch27 = match;
3829 }
3830 else
3831 {
3832 lexer.SetPos(save);
3833 break;
3834 }
3835 }
3836 }
3837 }
3838 *parentMatch26 = match;
3839 }
3840 *parentMatch5 = match;
3841 }
3842 *parentMatch4 = match;
3843 }
3844 if (match.hit)
3845 {
3846 {
3847 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3848
3849 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3850 return soulng::parser::Match(true, caseS.release());
3851 }
3852 }
3853 *parentMatch3 = match;
3854 }
3855 *parentMatch2 = match;
3856 }
3857 *parentMatch0 = match;
3858 }
3859 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3860
3861
3862
3863
3864
3865 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3866 if (!match.hit)
3867 {
3868 match.value = nullptr;
3869 }
3870 return match;
3871 }
3872
3873 soulng::parser::Match StatementParser::DefaultStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
3874 {
3875 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3876
3877
3878
3879
3880
3881
3882
3883 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3884 std::unique_ptr<DefaultStatementNode> defaultS = std::unique_ptr<DefaultStatementNode>();
3885 Span s = Span();
3886 std::unique_ptr<StatementNode> stmt;
3887 soulng::parser::Match match(false);
3888 soulng::parser::Match* parentMatch0 = &match;
3889 {
3890 int64_t pos = lexer.GetPos();
3891 soulng::parser::Match match(false);
3892 soulng::parser::Match* parentMatch1 = &match;
3893 {
3894 soulng::parser::Match match(false);
3895 soulng::parser::Match* parentMatch2 = &match;
3896 {
3897 soulng::parser::Match match(false);
3898 soulng::parser::Match* parentMatch3 = &match;
3899 {
3900 soulng::parser::Match match(false);
3901 soulng::parser::Match* parentMatch4 = &match;
3902 {
3903 int64_t pos = lexer.GetPos();
3904 soulng::lexer::Span span = lexer.GetSpan();
3905 soulng::parser::Match match(false);
3906 if (*lexer == DEFAULT)
3907 {
3908 ++lexer;
3909 match.hit = true;
3910 }
3911 if (match.hit)
3912 {
3913 s = span;
3914 }
3915 *parentMatch4 = match;
3916 }
3917 *parentMatch3 = match;
3918 }
3919 if (match.hit)
3920 {
3921 soulng::parser::Match match(false);
3922 soulng::parser::Match* parentMatch5 = &match;
3923 {
3924 soulng::parser::Match match(false);
3925 soulng::parser::Match* parentMatch6 = &match;
3926 {
3927 int64_t pos = lexer.GetPos();
3928 soulng::lexer::Span span = lexer.GetSpan();
3929 soulng::parser::Match match(true);
3930 soulng::parser::Match* parentMatch7 = &match;
3931 {
3932 soulng::lexer::Span span = lexer.GetSpan();
3933 soulng::parser::Match match(false);
3934 if (*lexer == COLON)
3935 {
3936 ++lexer;
3937 match.hit = true;
3938 }
3939 if (match.hit)
3940 {
3941 *parentMatch7 = match;
3942 }
3943 else
3944 {
3945 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(COLON)));
3946 }
3947 }
3948 if (match.hit)
3949 {
3950 s.end = span.end;
3951 defaultS.reset(new DefaultStatementNode(s, *moduleId));
3952 }
3953 *parentMatch6 = match;
3954 }
3955 *parentMatch5 = match;
3956 }
3957 *parentMatch3 = match;
3958 }
3959 *parentMatch2 = match;
3960 }
3961 if (match.hit)
3962 {
3963 soulng::parser::Match match(false);
3964 soulng::parser::Match* parentMatch8 = &match;
3965 {
3966 soulng::parser::Match match(true);
3967 soulng::parser::Match* parentMatch9 = &match;
3968 {
3969 while (true)
3970 {
3971 int64_t save = lexer.GetPos();
3972 {
3973 soulng::parser::Match match(false);
3974 soulng::parser::Match* parentMatch10 = &match;
3975 {
3976 soulng::parser::Match match(false);
3977 soulng::parser::Match* parentMatch11 = &match;
3978 {
3979 int64_t pos = lexer.GetPos();
3980 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
3981 stmt.reset(static_cast<StatementNode*>(match.value));
3982 if (match.hit)
3983 {
3984 defaultS->AddStatement(stmt.release());
3985 }
3986 *parentMatch11 = match;
3987 }
3988 *parentMatch10 = match;
3989 }
3990 if (match.hit)
3991 {
3992 *parentMatch9 = match;
3993 }
3994 else
3995 {
3996 lexer.SetPos(save);
3997 break;
3998 }
3999 }
4000 }
4001 }
4002 *parentMatch8 = match;
4003 }
4004 *parentMatch2 = match;
4005 }
4006 *parentMatch1 = match;
4007 }
4008 if (match.hit)
4009 {
4010 {
4011 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4012
4013 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4014 return soulng::parser::Match(true, defaultS.release());
4015 }
4016 }
4017 *parentMatch0 = match;
4018 }
4019 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4020
4021
4022
4023
4024
4025 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4026 if (!match.hit)
4027 {
4028 match.value = nullptr;
4029 }
4030 return match;
4031 }
4032
4033 soulng::parser::Match StatementParser::GotoCaseStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4034 {
4035 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4036
4037
4038
4039
4040
4041
4042
4043 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4044 Span s = Span();
4045 std::unique_ptr<Node> caseExpr;
4046 soulng::parser::Match match(false);
4047 soulng::parser::Match* parentMatch0 = &match;
4048 {
4049 soulng::parser::Match match(false);
4050 soulng::parser::Match* parentMatch1 = &match;
4051 {
4052 soulng::parser::Match match(false);
4053 soulng::parser::Match* parentMatch2 = &match;
4054 {
4055 soulng::parser::Match match(false);
4056 soulng::parser::Match* parentMatch3 = &match;
4057 {
4058 int64_t pos = lexer.GetPos();
4059 soulng::lexer::Span span = lexer.GetSpan();
4060 soulng::parser::Match match(false);
4061 if (*lexer == GOTO)
4062 {
4063 ++lexer;
4064 match.hit = true;
4065 }
4066 if (match.hit)
4067 {
4068 s = span;
4069 }
4070 *parentMatch3 = match;
4071 }
4072 *parentMatch2 = match;
4073 }
4074 if (match.hit)
4075 {
4076 soulng::parser::Match match(false);
4077 soulng::parser::Match* parentMatch4 = &match;
4078 {
4079 soulng::parser::Match match(false);
4080 if (*lexer == CASE)
4081 {
4082 ++lexer;
4083 match.hit = true;
4084 }
4085 *parentMatch4 = match;
4086 }
4087 *parentMatch2 = match;
4088 }
4089 *parentMatch1 = match;
4090 }
4091 if (match.hit)
4092 {
4093 soulng::parser::Match match(false);
4094 soulng::parser::Match* parentMatch5 = &match;
4095 {
4096 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
4097 caseExpr.reset(static_cast<Node*>(match.value));
4098 *parentMatch5 = match;
4099 }
4100 *parentMatch1 = match;
4101 }
4102 *parentMatch0 = match;
4103 }
4104 if (match.hit)
4105 {
4106 soulng::parser::Match match(false);
4107 soulng::parser::Match* parentMatch6 = &match;
4108 {
4109 soulng::parser::Match match(false);
4110 soulng::parser::Match* parentMatch7 = &match;
4111 {
4112 int64_t pos = lexer.GetPos();
4113 soulng::lexer::Span span = lexer.GetSpan();
4114 soulng::parser::Match match(true);
4115 soulng::parser::Match* parentMatch8 = &match;
4116 {
4117 soulng::lexer::Span span = lexer.GetSpan();
4118 soulng::parser::Match match(false);
4119 if (*lexer == SEMICOLON)
4120 {
4121 ++lexer;
4122 match.hit = true;
4123 }
4124 if (match.hit)
4125 {
4126 *parentMatch8 = match;
4127 }
4128 else
4129 {
4130 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
4131 }
4132 }
4133 if (match.hit)
4134 {
4135 s.end = span.end;
4136 {
4137 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4138
4139 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4140 return soulng::parser::Match(true, new GotoCaseStatementNode(s, *moduleId, caseExpr.release()));
4141 }
4142 }
4143 *parentMatch7 = match;
4144 }
4145 *parentMatch6 = match;
4146 }
4147 *parentMatch0 = match;
4148 }
4149 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4150
4151
4152
4153
4154
4155 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4156 if (!match.hit)
4157 {
4158 match.value = nullptr;
4159 }
4160 return match;
4161 }
4162
4163 soulng::parser::Match StatementParser::GotoDefaultStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4164 {
4165 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4166
4167
4168
4169
4170
4171
4172
4173 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4174 Span s = Span();
4175 soulng::parser::Match match(false);
4176 soulng::parser::Match* parentMatch0 = &match;
4177 {
4178 soulng::parser::Match match(false);
4179 soulng::parser::Match* parentMatch1 = &match;
4180 {
4181 soulng::parser::Match match(false);
4182 soulng::parser::Match* parentMatch2 = &match;
4183 {
4184 int64_t pos = lexer.GetPos();
4185 soulng::lexer::Span span = lexer.GetSpan();
4186 soulng::parser::Match match(false);
4187 if (*lexer == GOTO)
4188 {
4189 ++lexer;
4190 match.hit = true;
4191 }
4192 if (match.hit)
4193 {
4194 s = span;
4195 }
4196 *parentMatch2 = match;
4197 }
4198 *parentMatch1 = match;
4199 }
4200 if (match.hit)
4201 {
4202 soulng::parser::Match match(false);
4203 soulng::parser::Match* parentMatch3 = &match;
4204 {
4205 soulng::parser::Match match(false);
4206 if (*lexer == DEFAULT)
4207 {
4208 ++lexer;
4209 match.hit = true;
4210 }
4211 *parentMatch3 = match;
4212 }
4213 *parentMatch1 = match;
4214 }
4215 *parentMatch0 = match;
4216 }
4217 if (match.hit)
4218 {
4219 soulng::parser::Match match(false);
4220 soulng::parser::Match* parentMatch4 = &match;
4221 {
4222 soulng::parser::Match match(false);
4223 soulng::parser::Match* parentMatch5 = &match;
4224 {
4225 int64_t pos = lexer.GetPos();
4226 soulng::lexer::Span span = lexer.GetSpan();
4227 soulng::parser::Match match(true);
4228 soulng::parser::Match* parentMatch6 = &match;
4229 {
4230 soulng::lexer::Span span = lexer.GetSpan();
4231 soulng::parser::Match match(false);
4232 if (*lexer == SEMICOLON)
4233 {
4234 ++lexer;
4235 match.hit = true;
4236 }
4237 if (match.hit)
4238 {
4239 *parentMatch6 = match;
4240 }
4241 else
4242 {
4243 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
4244 }
4245 }
4246 if (match.hit)
4247 {
4248 s.end = span.end;
4249 {
4250 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4251
4252 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4253 return soulng::parser::Match(true, new GotoDefaultStatementNode(s, *moduleId));
4254 }
4255 }
4256 *parentMatch5 = match;
4257 }
4258 *parentMatch4 = match;
4259 }
4260 *parentMatch0 = match;
4261 }
4262 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4263
4264
4265
4266
4267
4268 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4269 if (!match.hit)
4270 {
4271 match.value = nullptr;
4272 }
4273 return match;
4274 }
4275
4276 soulng::parser::Match StatementParser::AssignmentStatementExpr(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4277 {
4278 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4279
4280
4281
4282
4283
4284
4285
4286 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4287 std::unique_ptr<Node> target = std::unique_ptr<Node>();
4288 Span s = Span();
4289 std::unique_ptr<Node> tgt;
4290 std::unique_ptr<Node> source;
4291 soulng::parser::Match match(false);
4292 soulng::parser::Match* parentMatch0 = &match;
4293 {
4294 soulng::parser::Match match(false);
4295 soulng::parser::Match* parentMatch1 = &match;
4296 {
4297 soulng::parser::Match match(false);
4298 soulng::parser::Match* parentMatch2 = &match;
4299 {
4300 soulng::parser::Match match(false);
4301 soulng::parser::Match* parentMatch3 = &match;
4302 {
4303 int64_t pos = lexer.GetPos();
4304 soulng::parser::Match match(true);
4305 if (match.hit)
4306 {
4307 ctx->PushParsingLvalue(true);
4308 }
4309 *parentMatch3 = match;
4310 }
4311 *parentMatch2 = match;
4312 }
4313 if (match.hit)
4314 {
4315 soulng::parser::Match match(false);
4316 soulng::parser::Match* parentMatch4 = &match;
4317 {
4318 soulng::parser::Match match(false);
4319 soulng::parser::Match* parentMatch5 = &match;
4320 {
4321 int64_t pos = lexer.GetPos();
4322 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
4323 tgt.reset(static_cast<Node*>(match.value));
4324 if (match.hit)
4325 {
4326 target.reset(tgt.release());
4327 s = target->GetSpan();
4328 ctx->PopParsingLvalue();
4329 }
4330 else
4331 {
4332 ctx->PopParsingLvalue();
4333 }
4334 *parentMatch5 = match;
4335 }
4336 *parentMatch4 = match;
4337 }
4338 *parentMatch2 = match;
4339 }
4340 *parentMatch1 = match;
4341 }
4342 if (match.hit)
4343 {
4344 soulng::parser::Match match(false);
4345 soulng::parser::Match* parentMatch6 = &match;
4346 {
4347 soulng::parser::Match match(false);
4348 if (*lexer == ASSIGN)
4349 {
4350 ++lexer;
4351 match.hit = true;
4352 }
4353 *parentMatch6 = match;
4354 }
4355 *parentMatch1 = match;
4356 }
4357 *parentMatch0 = match;
4358 }
4359 if (match.hit)
4360 {
4361 soulng::parser::Match match(false);
4362 soulng::parser::Match* parentMatch7 = &match;
4363 {
4364 soulng::parser::Match match(false);
4365 soulng::parser::Match* parentMatch8 = &match;
4366 {
4367 int64_t pos = lexer.GetPos();
4368 soulng::lexer::Span span = lexer.GetSpan();
4369 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
4370 source.reset(static_cast<Node*>(match.value));
4371 if (match.hit)
4372 {
4373 s.end = span.end;
4374 {
4375 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4376
4377 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4378 return soulng::parser::Match(true, new AssignmentStatementNode(s, *moduleId, target.release(), source.release()));
4379 }
4380 }
4381 *parentMatch8 = match;
4382 }
4383 *parentMatch7 = match;
4384 }
4385 *parentMatch0 = match;
4386 }
4387 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4388
4389
4390
4391
4392
4393 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4394 if (!match.hit)
4395 {
4396 match.value = nullptr;
4397 }
4398 return match;
4399 }
4400
4401 soulng::parser::Match StatementParser::AssignmentStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4402 {
4403 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4404
4405
4406
4407
4408
4409
4410
4411 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4412 std::unique_ptr<StatementNode> statement = std::unique_ptr<StatementNode>();
4413 std::unique_ptr<StatementNode> stmt;
4414 soulng::parser::Match match(false);
4415 soulng::parser::Match* parentMatch0 = &match;
4416 {
4417 soulng::parser::Match match = StatementParser::AssignmentStatementExpr(lexer, moduleId, ctx);
4418 stmt.reset(static_cast<StatementNode*>(match.value));
4419 *parentMatch0 = match;
4420 }
4421 if (match.hit)
4422 {
4423 soulng::parser::Match match(false);
4424 soulng::parser::Match* parentMatch1 = &match;
4425 {
4426 soulng::parser::Match match(false);
4427 soulng::parser::Match* parentMatch2 = &match;
4428 {
4429 int64_t pos = lexer.GetPos();
4430 soulng::lexer::Span span = lexer.GetSpan();
4431 soulng::parser::Match match(false);
4432 if (*lexer == SEMICOLON)
4433 {
4434 ++lexer;
4435 match.hit = true;
4436 }
4437 if (match.hit)
4438 {
4439 statement.reset(stmt.release());
4440 statement->SetSpanEnd(span.end);
4441 {
4442 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4443
4444 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4445 return soulng::parser::Match(true, statement.release());
4446 }
4447 }
4448 *parentMatch2 = match;
4449 }
4450 *parentMatch1 = match;
4451 }
4452 *parentMatch0 = match;
4453 }
4454 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4455
4456
4457
4458
4459
4460 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4461 if (!match.hit)
4462 {
4463 match.value = nullptr;
4464 }
4465 return match;
4466 }
4467
4468 soulng::parser::Match StatementParser::ConstructionStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4469 {
4470 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4471
4472
4473
4474
4475
4476
4477
4478 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4479 std::unique_ptr<ConstructionStatementNode> constructionStatement = std::unique_ptr<ConstructionStatementNode>();
4480 std::unique_ptr<sngcm::ast::Node> type;
4481 std::unique_ptr<IdentifierNode> id;
4482 std::unique_ptr<Node> value;
4483 soulng::parser::Match match(false);
4484 soulng::parser::Match* parentMatch0 = &match;
4485 {
4486 soulng::parser::Match match(false);
4487 soulng::parser::Match* parentMatch1 = &match;
4488 {
4489 soulng::parser::Match match(false);
4490 soulng::parser::Match* parentMatch2 = &match;
4491 {
4492 int64_t pos = lexer.GetPos();
4493 soulng::lexer::Span span = lexer.GetSpan();
4494 soulng::parser::Match match(false);
4495 soulng::parser::Match* parentMatch3 = &match;
4496 {
4497 soulng::parser::Match match(false);
4498 soulng::parser::Match* parentMatch4 = &match;
4499 {
4500 soulng::parser::Match match = TypeExprParser::TypeExpr(lexer, moduleId, ctx);
4501 type.reset(static_cast<sngcm::ast::Node*>(match.value));
4502 *parentMatch4 = match;
4503 }
4504 if (match.hit)
4505 {
4506 soulng::parser::Match match(false);
4507 soulng::parser::Match* parentMatch5 = &match;
4508 {
4509 soulng::parser::Match match(true);
4510 soulng::parser::Match* parentMatch6 = &match;
4511 {
4512 soulng::lexer::Span span = lexer.GetSpan();
4513 soulng::parser::Match match = IdentifierParser::Identifier(lexer, moduleId);
4514 id.reset(static_cast<IdentifierNode*>(match.value));
4515 if (match.hit)
4516 {
4517 *parentMatch6 = match;
4518 }
4519 else
4520 {
4521 lexer.ThrowExpectationFailure(span, U"identifier");
4522 }
4523 }
4524 *parentMatch5 = match;
4525 }
4526 *parentMatch4 = match;
4527 }
4528 *parentMatch3 = match;
4529 }
4530 if (match.hit)
4531 {
4532 constructionStatement.reset(new ConstructionStatementNode(span, *moduleId, type.release(), id.release()));
4533 }
4534 *parentMatch2 = match;
4535 }
4536 *parentMatch1 = match;
4537 }
4538 if (match.hit)
4539 {
4540 soulng::parser::Match match(false);
4541 soulng::parser::Match* parentMatch7 = &match;
4542 {
4543 soulng::parser::Match match(false);
4544 soulng::parser::Match* parentMatch8 = &match;
4545 {
4546 soulng::parser::Match match(false);
4547 soulng::parser::Match* parentMatch9 = &match;
4548 {
4549 int64_t save = lexer.GetPos();
4550 soulng::parser::Match match(false);
4551 soulng::parser::Match* parentMatch10 = &match;
4552 {
4553 int64_t save = lexer.GetPos();
4554 soulng::parser::Match match(false);
4555 soulng::parser::Match* parentMatch11 = &match;
4556 {
4557 soulng::parser::Match match(false);
4558 if (*lexer == ASSIGN)
4559 {
4560 ++lexer;
4561 match.hit = true;
4562 }
4563 *parentMatch11 = match;
4564 }
4565 if (match.hit)
4566 {
4567 soulng::parser::Match match(false);
4568 soulng::parser::Match* parentMatch12 = &match;
4569 {
4570 soulng::parser::Match match(false);
4571 soulng::parser::Match* parentMatch13 = &match;
4572 {
4573 int64_t pos = lexer.GetPos();
4574 soulng::parser::Match match(true);
4575 soulng::parser::Match* parentMatch14 = &match;
4576 {
4577 soulng::lexer::Span span = lexer.GetSpan();
4578 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
4579 value.reset(static_cast<Node*>(match.value));
4580 if (match.hit)
4581 {
4582 *parentMatch14 = match;
4583 }
4584 else
4585 {
4586 lexer.ThrowExpectationFailure(span, U"expression");
4587 }
4588 }
4589 if (match.hit)
4590 {
4591 constructionStatement->AddArgument(value.release());
4592 constructionStatement->SetAssignment();
4593 }
4594 *parentMatch13 = match;
4595 }
4596 *parentMatch12 = match;
4597 }
4598 *parentMatch11 = match;
4599 }
4600 *parentMatch10 = match;
4601 if (!match.hit)
4602 {
4603 soulng::parser::Match match(false);
4604 soulng::parser::Match* parentMatch15 = &match;
4605 lexer.SetPos(save);
4606 {
4607 soulng::parser::Match match(false);
4608 soulng::parser::Match* parentMatch16 = &match;
4609 {
4610 soulng::parser::Match match(false);
4611 soulng::parser::Match* parentMatch17 = &match;
4612 {
4613 soulng::parser::Match match(false);
4614 if (*lexer == LPAREN)
4615 {
4616 ++lexer;
4617 match.hit = true;
4618 }
4619 *parentMatch17 = match;
4620 }
4621 if (match.hit)
4622 {
4623 soulng::parser::Match match(false);
4624 soulng::parser::Match* parentMatch18 = &match;
4625 {
4626 soulng::parser::Match match = ExpressionParser::ArgumentList(lexer, moduleId, ctx, constructionStatement.get());
4627 *parentMatch18 = match;
4628 }
4629 *parentMatch17 = match;
4630 }
4631 *parentMatch16 = match;
4632 }
4633 if (match.hit)
4634 {
4635 soulng::parser::Match match(false);
4636 soulng::parser::Match* parentMatch19 = &match;
4637 {
4638 soulng::parser::Match match(true);
4639 soulng::parser::Match* parentMatch20 = &match;
4640 {
4641 soulng::lexer::Span span = lexer.GetSpan();
4642 soulng::parser::Match match(false);
4643 if (*lexer == RPAREN)
4644 {
4645 ++lexer;
4646 match.hit = true;
4647 }
4648 if (match.hit)
4649 {
4650 *parentMatch20 = match;
4651 }
4652 else
4653 {
4654 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
4655 }
4656 }
4657 *parentMatch19 = match;
4658 }
4659 *parentMatch16 = match;
4660 }
4661 *parentMatch15 = match;
4662 }
4663 *parentMatch10 = match;
4664 }
4665 }
4666 *parentMatch9 = match;
4667 if (!match.hit)
4668 {
4669 soulng::parser::Match match(false);
4670 soulng::parser::Match* parentMatch21 = &match;
4671 lexer.SetPos(save);
4672 {
4673 soulng::parser::Match match(false);
4674 soulng::parser::Match* parentMatch22 = &match;
4675 {
4676 int64_t pos = lexer.GetPos();
4677 soulng::parser::Match match(true);
4678 if (match.hit)
4679 {
4680 constructionStatement->SetEmpty();
4681 }
4682 *parentMatch22 = match;
4683 }
4684 *parentMatch21 = match;
4685 }
4686 *parentMatch9 = match;
4687 }
4688 }
4689 *parentMatch8 = match;
4690 }
4691 *parentMatch7 = match;
4692 }
4693 *parentMatch1 = match;
4694 }
4695 *parentMatch0 = match;
4696 }
4697 if (match.hit)
4698 {
4699 soulng::parser::Match match(false);
4700 soulng::parser::Match* parentMatch23 = &match;
4701 {
4702 soulng::parser::Match match(false);
4703 soulng::parser::Match* parentMatch24 = &match;
4704 {
4705 int64_t pos = lexer.GetPos();
4706 soulng::lexer::Span span = lexer.GetSpan();
4707 soulng::parser::Match match(true);
4708 soulng::parser::Match* parentMatch25 = &match;
4709 {
4710 soulng::lexer::Span span = lexer.GetSpan();
4711 soulng::parser::Match match(false);
4712 if (*lexer == SEMICOLON)
4713 {
4714 ++lexer;
4715 match.hit = true;
4716 }
4717 if (match.hit)
4718 {
4719 *parentMatch25 = match;
4720 }
4721 else
4722 {
4723 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
4724 }
4725 }
4726 if (match.hit)
4727 {
4728 constructionStatement->SetSpanEnd(span.end);
4729 {
4730 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4731
4732 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4733 return soulng::parser::Match(true, constructionStatement.release());
4734 }
4735 }
4736 *parentMatch24 = match;
4737 }
4738 *parentMatch23 = match;
4739 }
4740 *parentMatch0 = match;
4741 }
4742 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4743
4744
4745
4746
4747
4748 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4749 if (!match.hit)
4750 {
4751 match.value = nullptr;
4752 }
4753 return match;
4754 }
4755
4756 soulng::parser::Match StatementParser::DeleteStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4757 {
4758 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4759
4760
4761
4762
4763
4764
4765
4766 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4767 Span s = Span();
4768 std::unique_ptr<Node> ptr;
4769 soulng::parser::Match match(false);
4770 soulng::parser::Match* parentMatch0 = &match;
4771 {
4772 soulng::parser::Match match(false);
4773 soulng::parser::Match* parentMatch1 = &match;
4774 {
4775 soulng::parser::Match match(false);
4776 soulng::parser::Match* parentMatch2 = &match;
4777 {
4778 int64_t pos = lexer.GetPos();
4779 soulng::lexer::Span span = lexer.GetSpan();
4780 soulng::parser::Match match(false);
4781 if (*lexer == DELETE)
4782 {
4783 ++lexer;
4784 match.hit = true;
4785 }
4786 if (match.hit)
4787 {
4788 s = span;
4789 }
4790 *parentMatch2 = match;
4791 }
4792 *parentMatch1 = match;
4793 }
4794 if (match.hit)
4795 {
4796 soulng::parser::Match match(false);
4797 soulng::parser::Match* parentMatch3 = &match;
4798 {
4799 soulng::parser::Match match(true);
4800 soulng::parser::Match* parentMatch4 = &match;
4801 {
4802 soulng::lexer::Span span = lexer.GetSpan();
4803 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
4804 ptr.reset(static_cast<Node*>(match.value));
4805 if (match.hit)
4806 {
4807 *parentMatch4 = match;
4808 }
4809 else
4810 {
4811 lexer.ThrowExpectationFailure(span, U"expression");
4812 }
4813 }
4814 *parentMatch3 = match;
4815 }
4816 *parentMatch1 = match;
4817 }
4818 *parentMatch0 = match;
4819 }
4820 if (match.hit)
4821 {
4822 soulng::parser::Match match(false);
4823 soulng::parser::Match* parentMatch5 = &match;
4824 {
4825 soulng::parser::Match match(false);
4826 soulng::parser::Match* parentMatch6 = &match;
4827 {
4828 int64_t pos = lexer.GetPos();
4829 soulng::lexer::Span span = lexer.GetSpan();
4830 soulng::parser::Match match(true);
4831 soulng::parser::Match* parentMatch7 = &match;
4832 {
4833 soulng::lexer::Span span = lexer.GetSpan();
4834 soulng::parser::Match match(false);
4835 if (*lexer == SEMICOLON)
4836 {
4837 ++lexer;
4838 match.hit = true;
4839 }
4840 if (match.hit)
4841 {
4842 *parentMatch7 = match;
4843 }
4844 else
4845 {
4846 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
4847 }
4848 }
4849 if (match.hit)
4850 {
4851 s.end = span.end;
4852 {
4853 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4854
4855 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4856 return soulng::parser::Match(true, new DeleteStatementNode(s, *moduleId, ptr.release()));
4857 }
4858 }
4859 *parentMatch6 = match;
4860 }
4861 *parentMatch5 = match;
4862 }
4863 *parentMatch0 = match;
4864 }
4865 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4866
4867
4868
4869
4870
4871 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4872 if (!match.hit)
4873 {
4874 match.value = nullptr;
4875 }
4876 return match;
4877 }
4878
4879 soulng::parser::Match StatementParser::DestroyStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4880 {
4881 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4882
4883
4884
4885
4886
4887
4888
4889 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4890 Span s = Span();
4891 std::unique_ptr<Node> ptr;
4892 soulng::parser::Match match(false);
4893 soulng::parser::Match* parentMatch0 = &match;
4894 {
4895 soulng::parser::Match match(false);
4896 soulng::parser::Match* parentMatch1 = &match;
4897 {
4898 soulng::parser::Match match(false);
4899 soulng::parser::Match* parentMatch2 = &match;
4900 {
4901 int64_t pos = lexer.GetPos();
4902 soulng::lexer::Span span = lexer.GetSpan();
4903 soulng::parser::Match match(false);
4904 if (*lexer == DESTROY)
4905 {
4906 ++lexer;
4907 match.hit = true;
4908 }
4909 if (match.hit)
4910 {
4911 s = span;
4912 }
4913 *parentMatch2 = match;
4914 }
4915 *parentMatch1 = match;
4916 }
4917 if (match.hit)
4918 {
4919 soulng::parser::Match match(false);
4920 soulng::parser::Match* parentMatch3 = &match;
4921 {
4922 soulng::parser::Match match(true);
4923 soulng::parser::Match* parentMatch4 = &match;
4924 {
4925 soulng::lexer::Span span = lexer.GetSpan();
4926 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
4927 ptr.reset(static_cast<Node*>(match.value));
4928 if (match.hit)
4929 {
4930 *parentMatch4 = match;
4931 }
4932 else
4933 {
4934 lexer.ThrowExpectationFailure(span, U"expression");
4935 }
4936 }
4937 *parentMatch3 = match;
4938 }
4939 *parentMatch1 = match;
4940 }
4941 *parentMatch0 = match;
4942 }
4943 if (match.hit)
4944 {
4945 soulng::parser::Match match(false);
4946 soulng::parser::Match* parentMatch5 = &match;
4947 {
4948 soulng::parser::Match match(false);
4949 soulng::parser::Match* parentMatch6 = &match;
4950 {
4951 int64_t pos = lexer.GetPos();
4952 soulng::lexer::Span span = lexer.GetSpan();
4953 soulng::parser::Match match(true);
4954 soulng::parser::Match* parentMatch7 = &match;
4955 {
4956 soulng::lexer::Span span = lexer.GetSpan();
4957 soulng::parser::Match match(false);
4958 if (*lexer == SEMICOLON)
4959 {
4960 ++lexer;
4961 match.hit = true;
4962 }
4963 if (match.hit)
4964 {
4965 *parentMatch7 = match;
4966 }
4967 else
4968 {
4969 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
4970 }
4971 }
4972 if (match.hit)
4973 {
4974 s.end = span.end;
4975 {
4976 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4977
4978 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4979 return soulng::parser::Match(true, new DestroyStatementNode(s, *moduleId, ptr.release()));
4980 }
4981 }
4982 *parentMatch6 = match;
4983 }
4984 *parentMatch5 = match;
4985 }
4986 *parentMatch0 = match;
4987 }
4988 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4989
4990
4991
4992
4993
4994 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4995 if (!match.hit)
4996 {
4997 match.value = nullptr;
4998 }
4999 return match;
5000 }
5001
5002 soulng::parser::Match StatementParser::ExpressionStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
5003 {
5004 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5005
5006
5007
5008
5009
5010
5011
5012 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5013 std::unique_ptr<Node> exprNode = std::unique_ptr<Node>();
5014 Span s = Span();
5015 std::unique_ptr<Node> expr;
5016 soulng::parser::Match match(false);
5017 soulng::parser::Match* parentMatch0 = &match;
5018 {
5019 soulng::parser::Match match(false);
5020 soulng::parser::Match* parentMatch1 = &match;
5021 {
5022 int64_t pos = lexer.GetPos();
5023 soulng::parser::Match match(true);
5024 if (match.hit)
5025 {
5026 ctx->PushParsingExpressionStatement(true);
5027 }
5028 *parentMatch1 = match;
5029 }
5030 *parentMatch0 = match;
5031 }
5032 if (match.hit)
5033 {
5034 soulng::parser::Match match(false);
5035 soulng::parser::Match* parentMatch2 = &match;
5036 {
5037 soulng::parser::Match match(false);
5038 soulng::parser::Match* parentMatch3 = &match;
5039 {
5040 int64_t pos = lexer.GetPos();
5041 soulng::parser::Match match(false);
5042 soulng::parser::Match* parentMatch4 = &match;
5043 {
5044 soulng::parser::Match match(false);
5045 soulng::parser::Match* parentMatch5 = &match;
5046 {
5047 soulng::parser::Match match(false);
5048 soulng::parser::Match* parentMatch6 = &match;
5049 {
5050 int64_t pos = lexer.GetPos();
5051 soulng::lexer::Span span = lexer.GetSpan();
5052 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
5053 expr.reset(static_cast<Node*>(match.value));
5054 if (match.hit)
5055 {
5056 exprNode.reset(expr.release());
5057 s = span;
5058 }
5059 *parentMatch6 = match;
5060 }
5061 *parentMatch5 = match;
5062 }
5063 if (match.hit)
5064 {
5065 soulng::parser::Match match(false);
5066 soulng::parser::Match* parentMatch7 = &match;
5067 {
5068 soulng::parser::Match match(false);
5069 soulng::parser::Match* parentMatch8 = &match;
5070 {
5071 int64_t pos = lexer.GetPos();
5072 soulng::lexer::Span span = lexer.GetSpan();
5073 soulng::parser::Match match(false);
5074 if (*lexer == SEMICOLON)
5075 {
5076 ++lexer;
5077 match.hit = true;
5078 }
5079 if (match.hit)
5080 {
5081 s.end = span.end;
5082 }
5083 *parentMatch8 = match;
5084 }
5085 *parentMatch7 = match;
5086 }
5087 *parentMatch5 = match;
5088 }
5089 *parentMatch4 = match;
5090 }
5091 if (match.hit)
5092 {
5093 ctx->PopParsingExpressionStatement();
5094 exprNode->SetSpan(s);
5095 {
5096 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5097
5098 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5099 return soulng::parser::Match(true, new ExpressionStatementNode(s, *moduleId, exprNode.release()));
5100 }
5101 }
5102 else
5103 {
5104 ctx->PopParsingExpressionStatement();
5105 }
5106 *parentMatch3 = match;
5107 }
5108 *parentMatch2 = match;
5109 }
5110 *parentMatch0 = match;
5111 }
5112 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5113
5114
5115
5116
5117
5118 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5119 if (!match.hit)
5120 {
5121 match.value = nullptr;
5122 }
5123 return match;
5124 }
5125
5126 soulng::parser::Match StatementParser::EmptyStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
5127 {
5128 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5129
5130
5131
5132
5133
5134
5135
5136 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5137 soulng::parser::Match match(false);
5138 soulng::parser::Match* parentMatch0 = &match;
5139 {
5140 int64_t pos = lexer.GetPos();
5141 soulng::lexer::Span span = lexer.GetSpan();
5142 soulng::parser::Match match(false);
5143 if (*lexer == SEMICOLON)
5144 {
5145 ++lexer;
5146 match.hit = true;
5147 }
5148 if (match.hit)
5149 {
5150 {
5151 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5152
5153 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5154 return soulng::parser::Match(true, new EmptyStatementNode(span, *moduleId));
5155 }
5156 }
5157 *parentMatch0 = match;
5158 }
5159 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5160
5161
5162
5163
5164
5165 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5166 if (!match.hit)
5167 {
5168 match.value = nullptr;
5169 }
5170 return match;
5171 }
5172
5173 soulng::parser::Match StatementParser::ThrowStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
5174 {
5175 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5176
5177
5178
5179
5180
5181
5182
5183 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5184 Span s = Span();
5185 std::unique_ptr<Node> exception;
5186 soulng::parser::Match match(false);
5187 soulng::parser::Match* parentMatch0 = &match;
5188 {
5189 soulng::parser::Match match(false);
5190 soulng::parser::Match* parentMatch1 = &match;
5191 {
5192 soulng::parser::Match match(false);
5193 soulng::parser::Match* parentMatch2 = &match;
5194 {
5195 int64_t pos = lexer.GetPos();
5196 soulng::lexer::Span span = lexer.GetSpan();
5197 soulng::parser::Match match(false);
5198 if (*lexer == THROW)
5199 {
5200 ++lexer;
5201 match.hit = true;
5202 }
5203 if (match.hit)
5204 {
5205 s = span;
5206 }
5207 *parentMatch2 = match;
5208 }
5209 *parentMatch1 = match;
5210 }
5211 if (match.hit)
5212 {
5213 soulng::parser::Match match(false);
5214 soulng::parser::Match* parentMatch3 = &match;
5215 {
5216 soulng::parser::Match match(true);
5217 int64_t save = lexer.GetPos();
5218 soulng::parser::Match* parentMatch4 = &match;
5219 {
5220 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
5221 exception.reset(static_cast<Node*>(match.value));
5222 if (match.hit)
5223 {
5224 *parentMatch4 = match;
5225 }
5226 else
5227 {
5228 lexer.SetPos(save);
5229 }
5230 }
5231 *parentMatch3 = match;
5232 }
5233 *parentMatch1 = match;
5234 }
5235 *parentMatch0 = match;
5236 }
5237 if (match.hit)
5238 {
5239 soulng::parser::Match match(false);
5240 soulng::parser::Match* parentMatch5 = &match;
5241 {
5242 soulng::parser::Match match(false);
5243 soulng::parser::Match* parentMatch6 = &match;
5244 {
5245 int64_t pos = lexer.GetPos();
5246 soulng::lexer::Span span = lexer.GetSpan();
5247 soulng::parser::Match match(true);
5248 soulng::parser::Match* parentMatch7 = &match;
5249 {
5250 soulng::lexer::Span span = lexer.GetSpan();
5251 soulng::parser::Match match(false);
5252 if (*lexer == SEMICOLON)
5253 {
5254 ++lexer;
5255 match.hit = true;
5256 }
5257 if (match.hit)
5258 {
5259 *parentMatch7 = match;
5260 }
5261 else
5262 {
5263 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
5264 }
5265 }
5266 if (match.hit)
5267 {
5268 s.end = span.end;
5269 {
5270 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5271
5272 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5273 return soulng::parser::Match(true, new ThrowStatementNode(s, *moduleId, exception.release()));
5274 }
5275 }
5276 *parentMatch6 = match;
5277 }
5278 *parentMatch5 = match;
5279 }
5280 *parentMatch0 = match;
5281 }
5282 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5283
5284
5285
5286
5287
5288 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5289 if (!match.hit)
5290 {
5291 match.value = nullptr;
5292 }
5293 return match;
5294 }
5295
5296 soulng::parser::Match StatementParser::TryStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
5297 {
5298 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5299
5300
5301
5302
5303
5304
5305
5306 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5307 std::unique_ptr<TryStatementNode> tryStatement = std::unique_ptr<TryStatementNode>();
5308 std::unique_ptr<CompoundStatementNode> tryBlock;
5309 std::unique_ptr<CatchNode> ctch;
5310 soulng::parser::Match match(false);
5311 soulng::parser::Match* parentMatch0 = &match;
5312 {
5313 int64_t pos = lexer.GetPos();
5314 soulng::parser::Match match(false);
5315 soulng::parser::Match* parentMatch1 = &match;
5316 {
5317 soulng::parser::Match match(false);
5318 soulng::parser::Match* parentMatch2 = &match;
5319 {
5320 soulng::parser::Match match(false);
5321 soulng::parser::Match* parentMatch3 = &match;
5322 {
5323 int64_t pos = lexer.GetPos();
5324 soulng::lexer::Span span = lexer.GetSpan();
5325 soulng::parser::Match match(false);
5326 soulng::parser::Match* parentMatch4 = &match;
5327 {
5328 soulng::parser::Match match(false);
5329 soulng::parser::Match* parentMatch5 = &match;
5330 {
5331 soulng::parser::Match match(false);
5332 if (*lexer == TRY)
5333 {
5334 ++lexer;
5335 match.hit = true;
5336 }
5337 *parentMatch5 = match;
5338 }
5339 if (match.hit)
5340 {
5341 soulng::parser::Match match(false);
5342 soulng::parser::Match* parentMatch6 = &match;
5343 {
5344 soulng::parser::Match match = StatementParser::CompoundStatement(lexer, moduleId, ctx);
5345 tryBlock.reset(static_cast<CompoundStatementNode*>(match.value));
5346 *parentMatch6 = match;
5347 }
5348 *parentMatch5 = match;
5349 }
5350 *parentMatch4 = match;
5351 }
5352 if (match.hit)
5353 {
5354 tryStatement.reset(new TryStatementNode(span, *moduleId, tryBlock.release()));
5355 }
5356 *parentMatch3 = match;
5357 }
5358 *parentMatch2 = match;
5359 }
5360 if (match.hit)
5361 {
5362 soulng::parser::Match match(false);
5363 soulng::parser::Match* parentMatch7 = &match;
5364 {
5365 soulng::parser::Match match(false);
5366 soulng::parser::Match* parentMatch8 = &match;
5367 {
5368 soulng::parser::Match match(false);
5369 soulng::parser::Match* parentMatch9 = &match;
5370 {
5371 soulng::parser::Match match(false);
5372 soulng::parser::Match* parentMatch10 = &match;
5373 {
5374 int64_t pos = lexer.GetPos();
5375 soulng::parser::Match match = StatementParser::Catch(lexer, moduleId, ctx);
5376 ctch.reset(static_cast<CatchNode*>(match.value));
5377 if (match.hit)
5378 {
5379 tryStatement->AddCatch(ctch.release());
5380 }
5381 *parentMatch10 = match;
5382 }
5383 *parentMatch9 = match;
5384 }
5385 *parentMatch8 = match;
5386 }
5387 if (match.hit)
5388 {
5389 soulng::parser::Match match(true);
5390 soulng::parser::Match* parentMatch11 = &match;
5391 while (true)
5392 {
5393 int64_t save = lexer.GetPos();
5394 {
5395 soulng::parser::Match match(false);
5396 soulng::parser::Match* parentMatch12 = &match;
5397 {
5398 soulng::parser::Match match(false);
5399 soulng::parser::Match* parentMatch13 = &match;
5400 {
5401 int64_t pos = lexer.GetPos();
5402 soulng::parser::Match match = StatementParser::Catch(lexer, moduleId, ctx);
5403 ctch.reset(static_cast<CatchNode*>(match.value));
5404 if (match.hit)
5405 {
5406 tryStatement->AddCatch(ctch.release());
5407 }
5408 *parentMatch13 = match;
5409 }
5410 *parentMatch12 = match;
5411 }
5412 if (match.hit)
5413 {
5414 *parentMatch11 = match;
5415 }
5416 else
5417 {
5418 lexer.SetPos(save);
5419 break;
5420 }
5421 }
5422 }
5423 }
5424 *parentMatch7 = match;
5425 }
5426 *parentMatch2 = match;
5427 }
5428 *parentMatch1 = match;
5429 }
5430 if (match.hit)
5431 {
5432 {
5433 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5434
5435 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5436 return soulng::parser::Match(true, tryStatement.release());
5437 }
5438 }
5439 *parentMatch0 = match;
5440 }
5441 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5442
5443
5444
5445
5446
5447 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5448 if (!match.hit)
5449 {
5450 match.value = nullptr;
5451 }
5452 return match;
5453 }
5454
5455 soulng::parser::Match StatementParser::Catch(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
5456 {
5457 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5458
5459
5460
5461
5462
5463
5464
5465 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5466 Span s = Span();
5467 Span leftParenSpan = Span();
5468 Span rightParenSpan = Span();
5469 std::unique_ptr<sngcm::ast::Node> catchType;
5470 std::unique_ptr<IdentifierNode> catchId;
5471 std::unique_ptr<CompoundStatementNode> catchBlock;
5472 soulng::parser::Match match(false);
5473 soulng::parser::Match* parentMatch0 = &match;
5474 {
5475 soulng::parser::Match match(false);
5476 soulng::parser::Match* parentMatch1 = &match;
5477 {
5478 soulng::parser::Match match(false);
5479 soulng::parser::Match* parentMatch2 = &match;
5480 {
5481 soulng::parser::Match match(false);
5482 soulng::parser::Match* parentMatch3 = &match;
5483 {
5484 soulng::parser::Match match(false);
5485 soulng::parser::Match* parentMatch4 = &match;
5486 {
5487 soulng::parser::Match match(false);
5488 soulng::parser::Match* parentMatch5 = &match;
5489 {
5490 int64_t pos = lexer.GetPos();
5491 soulng::lexer::Span span = lexer.GetSpan();
5492 soulng::parser::Match match(false);
5493 if (*lexer == CATCH)
5494 {
5495 ++lexer;
5496 match.hit = true;
5497 }
5498 if (match.hit)
5499 {
5500 s = span;
5501 }
5502 *parentMatch5 = match;
5503 }
5504 *parentMatch4 = match;
5505 }
5506 if (match.hit)
5507 {
5508 soulng::parser::Match match(false);
5509 soulng::parser::Match* parentMatch6 = &match;
5510 {
5511 soulng::parser::Match match(false);
5512 soulng::parser::Match* parentMatch7 = &match;
5513 {
5514 int64_t pos = lexer.GetPos();
5515 soulng::lexer::Span span = lexer.GetSpan();
5516 soulng::parser::Match match(true);
5517 soulng::parser::Match* parentMatch8 = &match;
5518 {
5519 soulng::lexer::Span span = lexer.GetSpan();
5520 soulng::parser::Match match(false);
5521 if (*lexer == LPAREN)
5522 {
5523 ++lexer;
5524 match.hit = true;
5525 }
5526 if (match.hit)
5527 {
5528 *parentMatch8 = match;
5529 }
5530 else
5531 {
5532 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LPAREN)));
5533 }
5534 }
5535 if (match.hit)
5536 {
5537 leftParenSpan = span;
5538 }
5539 *parentMatch7 = match;
5540 }
5541 *parentMatch6 = match;
5542 }
5543 *parentMatch4 = match;
5544 }
5545 *parentMatch3 = match;
5546 }
5547 if (match.hit)
5548 {
5549 soulng::parser::Match match(false);
5550 soulng::parser::Match* parentMatch9 = &match;
5551 {
5552 soulng::parser::Match match(true);
5553 soulng::parser::Match* parentMatch10 = &match;
5554 {
5555 soulng::lexer::Span span = lexer.GetSpan();
5556 soulng::parser::Match match = TypeExprParser::TypeExpr(lexer, moduleId, ctx);
5557 catchType.reset(static_cast<sngcm::ast::Node*>(match.value));
5558 if (match.hit)
5559 {
5560 *parentMatch10 = match;
5561 }
5562 else
5563 {
5564 lexer.ThrowExpectationFailure(span, U"type expression");
5565 }
5566 }
5567 *parentMatch9 = match;
5568 }
5569 *parentMatch3 = match;
5570 }
5571 *parentMatch2 = match;
5572 }
5573 if (match.hit)
5574 {
5575 soulng::parser::Match match(false);
5576 soulng::parser::Match* parentMatch11 = &match;
5577 {
5578 soulng::parser::Match match(true);
5579 int64_t save = lexer.GetPos();
5580 soulng::parser::Match* parentMatch12 = &match;
5581 {
5582 soulng::parser::Match match = IdentifierParser::Identifier(lexer, moduleId);
5583 catchId.reset(static_cast<IdentifierNode*>(match.value));
5584 if (match.hit)
5585 {
5586 *parentMatch12 = match;
5587 }
5588 else
5589 {
5590 lexer.SetPos(save);
5591 }
5592 }
5593 *parentMatch11 = match;
5594 }
5595 *parentMatch2 = match;
5596 }
5597 *parentMatch1 = match;
5598 }
5599 if (match.hit)
5600 {
5601 soulng::parser::Match match(false);
5602 soulng::parser::Match* parentMatch13 = &match;
5603 {
5604 soulng::parser::Match match(false);
5605 soulng::parser::Match* parentMatch14 = &match;
5606 {
5607 int64_t pos = lexer.GetPos();
5608 soulng::lexer::Span span = lexer.GetSpan();
5609 soulng::parser::Match match(true);
5610 soulng::parser::Match* parentMatch15 = &match;
5611 {
5612 soulng::lexer::Span span = lexer.GetSpan();
5613 soulng::parser::Match match(false);
5614 if (*lexer == RPAREN)
5615 {
5616 ++lexer;
5617 match.hit = true;
5618 }
5619 if (match.hit)
5620 {
5621 *parentMatch15 = match;
5622 }
5623 else
5624 {
5625 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
5626 }
5627 }
5628 if (match.hit)
5629 {
5630 rightParenSpan = span;
5631 }
5632 *parentMatch14 = match;
5633 }
5634 *parentMatch13 = match;
5635 }
5636 *parentMatch1 = match;
5637 }
5638 *parentMatch0 = match;
5639 }
5640 if (match.hit)
5641 {
5642 soulng::parser::Match match(false);
5643 soulng::parser::Match* parentMatch16 = &match;
5644 {
5645 soulng::parser::Match match(false);
5646 soulng::parser::Match* parentMatch17 = &match;
5647 {
5648 int64_t pos = lexer.GetPos();
5649 soulng::lexer::Span span = lexer.GetSpan();
5650 soulng::parser::Match match = StatementParser::CompoundStatement(lexer, moduleId, ctx);
5651 catchBlock.reset(static_cast<CompoundStatementNode*>(match.value));
5652 if (match.hit)
5653 {
5654 s.end = span.end;
5655 CatchNode* value = new CatchNode(s, *moduleId, catchType.release(), catchId.release(), catchBlock.release());
5656 value->SetLeftParenSpan(leftParenSpan);
5657 value->SetRightParenSpan(rightParenSpan);
5658 {
5659 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5660
5661 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5662 return soulng::parser::Match(true, value);
5663 }
5664 }
5665 *parentMatch17 = match;
5666 }
5667 *parentMatch16 = match;
5668 }
5669 *parentMatch0 = match;
5670 }
5671 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5672
5673
5674
5675
5676
5677 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5678 if (!match.hit)
5679 {
5680 match.value = nullptr;
5681 }
5682 return match;
5683 }
5684
5685 soulng::parser::Match StatementParser::AssertStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
5686 {
5687 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5688
5689
5690
5691
5692
5693
5694
5695 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5696 Span s = Span();
5697 std::unique_ptr<Node> expr;
5698 soulng::parser::Match match(false);
5699 soulng::parser::Match* parentMatch0 = &match;
5700 {
5701 soulng::parser::Match match(false);
5702 soulng::parser::Match* parentMatch1 = &match;
5703 {
5704 soulng::parser::Match match(false);
5705 soulng::parser::Match* parentMatch2 = &match;
5706 {
5707 soulng::parser::Match match(false);
5708 soulng::parser::Match* parentMatch3 = &match;
5709 {
5710 int64_t pos = lexer.GetPos();
5711 soulng::lexer::Span span = lexer.GetSpan();
5712 soulng::parser::Match match(false);
5713 if (*lexer == HASH)
5714 {
5715 ++lexer;
5716 match.hit = true;
5717 }
5718 if (match.hit)
5719 {
5720 s = span;
5721 }
5722 *parentMatch3 = match;
5723 }
5724 *parentMatch2 = match;
5725 }
5726 if (match.hit)
5727 {
5728 soulng::parser::Match match(false);
5729 soulng::parser::Match* parentMatch4 = &match;
5730 {
5731 soulng::parser::Match match(false);
5732 if (*lexer == ASSERT)
5733 {
5734 ++lexer;
5735 match.hit = true;
5736 }
5737 *parentMatch4 = match;
5738 }
5739 *parentMatch2 = match;
5740 }
5741 *parentMatch1 = match;
5742 }
5743 if (match.hit)
5744 {
5745 soulng::parser::Match match(false);
5746 soulng::parser::Match* parentMatch5 = &match;
5747 {
5748 soulng::parser::Match match(true);
5749 soulng::parser::Match* parentMatch6 = &match;
5750 {
5751 soulng::lexer::Span span = lexer.GetSpan();
5752 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
5753 expr.reset(static_cast<Node*>(match.value));
5754 if (match.hit)
5755 {
5756 *parentMatch6 = match;
5757 }
5758 else
5759 {
5760 lexer.ThrowExpectationFailure(span, U"expression");
5761 }
5762 }
5763 *parentMatch5 = match;
5764 }
5765 *parentMatch1 = match;
5766 }
5767 *parentMatch0 = match;
5768 }
5769 if (match.hit)
5770 {
5771 soulng::parser::Match match(false);
5772 soulng::parser::Match* parentMatch7 = &match;
5773 {
5774 soulng::parser::Match match(false);
5775 soulng::parser::Match* parentMatch8 = &match;
5776 {
5777 int64_t pos = lexer.GetPos();
5778 soulng::lexer::Span span = lexer.GetSpan();
5779 soulng::parser::Match match(true);
5780 soulng::parser::Match* parentMatch9 = &match;
5781 {
5782 soulng::lexer::Span span = lexer.GetSpan();
5783 soulng::parser::Match match(false);
5784 if (*lexer == SEMICOLON)
5785 {
5786 ++lexer;
5787 match.hit = true;
5788 }
5789 if (match.hit)
5790 {
5791 *parentMatch9 = match;
5792 }
5793 else
5794 {
5795 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
5796 }
5797 }
5798 if (match.hit)
5799 {
5800 s.end = span.end;
5801 {
5802 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5803
5804 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5805 return soulng::parser::Match(true, new AssertStatementNode(s, *moduleId, expr.release()));
5806 }
5807 }
5808 *parentMatch8 = match;
5809 }
5810 *parentMatch7 = match;
5811 }
5812 *parentMatch0 = match;
5813 }
5814 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5815
5816
5817
5818
5819
5820 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5821 if (!match.hit)
5822 {
5823 match.value = nullptr;
5824 }
5825 return match;
5826 }
5827
5828 soulng::parser::Match StatementParser::ConditionalCompilationStatement(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
5829 {
5830 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5831
5832
5833
5834
5835
5836
5837
5838 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5839 std::unique_ptr<ConditionalCompilationStatementNode> condCompStmt = std::unique_ptr<ConditionalCompilationStatementNode>();
5840 Span s = Span();
5841 Span keywordSpan = Span();
5842 Span leftParenSpan = Span();
5843 Span rightParenSpan = Span();
5844 std::unique_ptr<ConditionalCompilationExpressionNode> ifExpr;
5845 std::unique_ptr<StatementNode> ifS;
5846 std::unique_ptr<ConditionalCompilationExpressionNode> elifExpr;
5847 std::unique_ptr<StatementNode> elifS;
5848 std::unique_ptr<StatementNode> elseS;
5849 soulng::parser::Match match(false);
5850 soulng::parser::Match* parentMatch0 = &match;
5851 {
5852 soulng::parser::Match match(false);
5853 soulng::parser::Match* parentMatch1 = &match;
5854 {
5855 soulng::parser::Match match(false);
5856 soulng::parser::Match* parentMatch2 = &match;
5857 {
5858 soulng::parser::Match match(false);
5859 soulng::parser::Match* parentMatch3 = &match;
5860 {
5861 soulng::parser::Match match(false);
5862 soulng::parser::Match* parentMatch4 = &match;
5863 {
5864 soulng::parser::Match match(false);
5865 soulng::parser::Match* parentMatch5 = &match;
5866 {
5867 soulng::parser::Match match(false);
5868 soulng::parser::Match* parentMatch6 = &match;
5869 {
5870 soulng::parser::Match match(false);
5871 soulng::parser::Match* parentMatch7 = &match;
5872 {
5873 soulng::parser::Match match(false);
5874 soulng::parser::Match* parentMatch8 = &match;
5875 {
5876 soulng::parser::Match match(false);
5877 soulng::parser::Match* parentMatch9 = &match;
5878 {
5879 int64_t pos = lexer.GetPos();
5880 soulng::lexer::Span span = lexer.GetSpan();
5881 soulng::parser::Match match(false);
5882 if (*lexer == HASH)
5883 {
5884 ++lexer;
5885 match.hit = true;
5886 }
5887 if (match.hit)
5888 {
5889 s = span;
5890 keywordSpan = span;
5891 }
5892 *parentMatch9 = match;
5893 }
5894 *parentMatch8 = match;
5895 }
5896 if (match.hit)
5897 {
5898 soulng::parser::Match match(false);
5899 soulng::parser::Match* parentMatch10 = &match;
5900 {
5901 soulng::parser::Match match(false);
5902 soulng::parser::Match* parentMatch11 = &match;
5903 {
5904 int64_t pos = lexer.GetPos();
5905 soulng::lexer::Span span = lexer.GetSpan();
5906 soulng::parser::Match match(false);
5907 if (*lexer == IF)
5908 {
5909 ++lexer;
5910 match.hit = true;
5911 }
5912 if (match.hit)
5913 {
5914 keywordSpan.end = span.end;
5915 }
5916 *parentMatch11 = match;
5917 }
5918 *parentMatch10 = match;
5919 }
5920 *parentMatch8 = match;
5921 }
5922 *parentMatch7 = match;
5923 }
5924 if (match.hit)
5925 {
5926 soulng::parser::Match match(false);
5927 soulng::parser::Match* parentMatch12 = &match;
5928 {
5929 soulng::parser::Match match(false);
5930 soulng::parser::Match* parentMatch13 = &match;
5931 {
5932 int64_t pos = lexer.GetPos();
5933 soulng::lexer::Span span = lexer.GetSpan();
5934 soulng::parser::Match match(true);
5935 soulng::parser::Match* parentMatch14 = &match;
5936 {
5937 soulng::lexer::Span span = lexer.GetSpan();
5938 soulng::parser::Match match(false);
5939 if (*lexer == LPAREN)
5940 {
5941 ++lexer;
5942 match.hit = true;
5943 }
5944 if (match.hit)
5945 {
5946 *parentMatch14 = match;
5947 }
5948 else
5949 {
5950 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LPAREN)));
5951 }
5952 }
5953 if (match.hit)
5954 {
5955 leftParenSpan = span;
5956 }
5957 *parentMatch13 = match;
5958 }
5959 *parentMatch12 = match;
5960 }
5961 *parentMatch7 = match;
5962 }
5963 *parentMatch6 = match;
5964 }
5965 if (match.hit)
5966 {
5967 soulng::parser::Match match(false);
5968 soulng::parser::Match* parentMatch15 = &match;
5969 {
5970 soulng::parser::Match match(false);
5971 soulng::parser::Match* parentMatch16 = &match;
5972 {
5973 int64_t pos = lexer.GetPos();
5974 soulng::lexer::Span span = lexer.GetSpan();
5975 soulng::parser::Match match = StatementParser::ConditionalCompilationExpression(lexer, moduleId);
5976 ifExpr.reset(static_cast<ConditionalCompilationExpressionNode*>(match.value));
5977 if (match.hit)
5978 {
5979 s.end = span.end;
5980 condCompStmt.reset(new ConditionalCompilationStatementNode(s, *moduleId, ifExpr.release()));
5981 condCompStmt->IfPart()->SetKeywordSpan(keywordSpan);
5982 }
5983 *parentMatch16 = match;
5984 }
5985 *parentMatch15 = match;
5986 }
5987 *parentMatch6 = match;
5988 }
5989 *parentMatch5 = match;
5990 }
5991 if (match.hit)
5992 {
5993 soulng::parser::Match match(false);
5994 soulng::parser::Match* parentMatch17 = &match;
5995 {
5996 soulng::parser::Match match(false);
5997 soulng::parser::Match* parentMatch18 = &match;
5998 {
5999 int64_t pos = lexer.GetPos();
6000 soulng::lexer::Span span = lexer.GetSpan();
6001 soulng::parser::Match match(true);
6002 soulng::parser::Match* parentMatch19 = &match;
6003 {
6004 soulng::lexer::Span span = lexer.GetSpan();
6005 soulng::parser::Match match(false);
6006 if (*lexer == RPAREN)
6007 {
6008 ++lexer;
6009 match.hit = true;
6010 }
6011 if (match.hit)
6012 {
6013 *parentMatch19 = match;
6014 }
6015 else
6016 {
6017 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
6018 }
6019 }
6020 if (match.hit)
6021 {
6022 rightParenSpan = span;
6023 condCompStmt->IfPart()->SetLeftParenSpan(leftParenSpan);
6024 condCompStmt->IfPart()->SetRightParenSpan(rightParenSpan);
6025 }
6026 *parentMatch18 = match;
6027 }
6028 *parentMatch17 = match;
6029 }
6030 *parentMatch5 = match;
6031 }
6032 *parentMatch4 = match;
6033 }
6034 if (match.hit)
6035 {
6036 soulng::parser::Match match(false);
6037 soulng::parser::Match* parentMatch20 = &match;
6038 {
6039 soulng::parser::Match match(true);
6040 soulng::parser::Match* parentMatch21 = &match;
6041 {
6042 while (true)
6043 {
6044 int64_t save = lexer.GetPos();
6045 {
6046 soulng::parser::Match match(false);
6047 soulng::parser::Match* parentMatch22 = &match;
6048 {
6049 soulng::parser::Match match(false);
6050 soulng::parser::Match* parentMatch23 = &match;
6051 {
6052 int64_t pos = lexer.GetPos();
6053 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
6054 ifS.reset(static_cast<StatementNode*>(match.value));
6055 if (match.hit)
6056 {
6057 condCompStmt->AddIfStatement(ifS.release());
6058 }
6059 *parentMatch23 = match;
6060 }
6061 *parentMatch22 = match;
6062 }
6063 if (match.hit)
6064 {
6065 *parentMatch21 = match;
6066 }
6067 else
6068 {
6069 lexer.SetPos(save);
6070 break;
6071 }
6072 }
6073 }
6074 }
6075 *parentMatch20 = match;
6076 }
6077 *parentMatch4 = match;
6078 }
6079 *parentMatch3 = match;
6080 }
6081 if (match.hit)
6082 {
6083 soulng::parser::Match match(false);
6084 soulng::parser::Match* parentMatch24 = &match;
6085 {
6086 soulng::parser::Match match(true);
6087 soulng::parser::Match* parentMatch25 = &match;
6088 {
6089 while (true)
6090 {
6091 int64_t save = lexer.GetPos();
6092 {
6093 soulng::parser::Match match(false);
6094 soulng::parser::Match* parentMatch26 = &match;
6095 {
6096 soulng::parser::Match match(false);
6097 soulng::parser::Match* parentMatch27 = &match;
6098 {
6099 soulng::parser::Match match(false);
6100 soulng::parser::Match* parentMatch28 = &match;
6101 {
6102 soulng::parser::Match match(false);
6103 soulng::parser::Match* parentMatch29 = &match;
6104 {
6105 soulng::parser::Match match(false);
6106 soulng::parser::Match* parentMatch30 = &match;
6107 {
6108 soulng::parser::Match match(false);
6109 soulng::parser::Match* parentMatch31 = &match;
6110 {
6111 soulng::parser::Match match(false);
6112 soulng::parser::Match* parentMatch32 = &match;
6113 {
6114 int64_t pos = lexer.GetPos();
6115 soulng::lexer::Span span = lexer.GetSpan();
6116 soulng::parser::Match match(false);
6117 if (*lexer == HASH)
6118 {
6119 ++lexer;
6120 match.hit = true;
6121 }
6122 if (match.hit)
6123 {
6124 keywordSpan = span;
6125 }
6126 *parentMatch32 = match;
6127 }
6128 *parentMatch31 = match;
6129 }
6130 if (match.hit)
6131 {
6132 soulng::parser::Match match(false);
6133 soulng::parser::Match* parentMatch33 = &match;
6134 {
6135 soulng::parser::Match match(false);
6136 soulng::parser::Match* parentMatch34 = &match;
6137 {
6138 int64_t pos = lexer.GetPos();
6139 soulng::lexer::Span span = lexer.GetSpan();
6140 soulng::parser::Match match(false);
6141 if (*lexer == ELIF)
6142 {
6143 ++lexer;
6144 match.hit = true;
6145 }
6146 if (match.hit)
6147 {
6148 keywordSpan.end = span.end;
6149 }
6150 *parentMatch34 = match;
6151 }
6152 *parentMatch33 = match;
6153 }
6154 *parentMatch31 = match;
6155 }
6156 *parentMatch30 = match;
6157 }
6158 if (match.hit)
6159 {
6160 soulng::parser::Match match(false);
6161 soulng::parser::Match* parentMatch35 = &match;
6162 {
6163 soulng::parser::Match match(false);
6164 soulng::parser::Match* parentMatch36 = &match;
6165 {
6166 int64_t pos = lexer.GetPos();
6167 soulng::lexer::Span span = lexer.GetSpan();
6168 soulng::parser::Match match(true);
6169 soulng::parser::Match* parentMatch37 = &match;
6170 {
6171 soulng::lexer::Span span = lexer.GetSpan();
6172 soulng::parser::Match match(false);
6173 if (*lexer == LPAREN)
6174 {
6175 ++lexer;
6176 match.hit = true;
6177 }
6178 if (match.hit)
6179 {
6180 *parentMatch37 = match;
6181 }
6182 else
6183 {
6184 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LPAREN)));
6185 }
6186 }
6187 if (match.hit)
6188 {
6189 leftParenSpan = span;
6190 }
6191 *parentMatch36 = match;
6192 }
6193 *parentMatch35 = match;
6194 }
6195 *parentMatch30 = match;
6196 }
6197 *parentMatch29 = match;
6198 }
6199 if (match.hit)
6200 {
6201 soulng::parser::Match match(false);
6202 soulng::parser::Match* parentMatch38 = &match;
6203 {
6204 soulng::parser::Match match(false);
6205 soulng::parser::Match* parentMatch39 = &match;
6206 {
6207 int64_t pos = lexer.GetPos();
6208 soulng::lexer::Span span = lexer.GetSpan();
6209 soulng::parser::Match match = StatementParser::ConditionalCompilationExpression(lexer, moduleId);
6210 elifExpr.reset(static_cast<ConditionalCompilationExpressionNode*>(match.value));
6211 if (match.hit)
6212 {
6213 condCompStmt->AddElifExpr(span, *moduleId, elifExpr.release());
6214 }
6215 *parentMatch39 = match;
6216 }
6217 *parentMatch38 = match;
6218 }
6219 *parentMatch29 = match;
6220 }
6221 *parentMatch28 = match;
6222 }
6223 if (match.hit)
6224 {
6225 soulng::parser::Match match(false);
6226 soulng::parser::Match* parentMatch40 = &match;
6227 {
6228 soulng::parser::Match match(false);
6229 soulng::parser::Match* parentMatch41 = &match;
6230 {
6231 int64_t pos = lexer.GetPos();
6232 soulng::lexer::Span span = lexer.GetSpan();
6233 soulng::parser::Match match(true);
6234 soulng::parser::Match* parentMatch42 = &match;
6235 {
6236 soulng::lexer::Span span = lexer.GetSpan();
6237 soulng::parser::Match match(false);
6238 if (*lexer == RPAREN)
6239 {
6240 ++lexer;
6241 match.hit = true;
6242 }
6243 if (match.hit)
6244 {
6245 *parentMatch42 = match;
6246 }
6247 else
6248 {
6249 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
6250 }
6251 }
6252 if (match.hit)
6253 {
6254 rightParenSpan = span;
6255 condCompStmt->SetElifLeftParenSpan(leftParenSpan);
6256 condCompStmt->SetElifRightParenSpan(rightParenSpan);
6257 condCompStmt->SetElifKeywordSpan(keywordSpan);
6258 }
6259 *parentMatch41 = match;
6260 }
6261 *parentMatch40 = match;
6262 }
6263 *parentMatch28 = match;
6264 }
6265 *parentMatch27 = match;
6266 }
6267 if (match.hit)
6268 {
6269 soulng::parser::Match match(false);
6270 soulng::parser::Match* parentMatch43 = &match;
6271 {
6272 soulng::parser::Match match(true);
6273 soulng::parser::Match* parentMatch44 = &match;
6274 {
6275 while (true)
6276 {
6277 int64_t save = lexer.GetPos();
6278 {
6279 soulng::parser::Match match(false);
6280 soulng::parser::Match* parentMatch45 = &match;
6281 {
6282 soulng::parser::Match match(false);
6283 soulng::parser::Match* parentMatch46 = &match;
6284 {
6285 int64_t pos = lexer.GetPos();
6286 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
6287 elifS.reset(static_cast<StatementNode*>(match.value));
6288 if (match.hit)
6289 {
6290 condCompStmt->AddElifStatement(elifS.release());
6291 }
6292 *parentMatch46 = match;
6293 }
6294 *parentMatch45 = match;
6295 }
6296 if (match.hit)
6297 {
6298 *parentMatch44 = match;
6299 }
6300 else
6301 {
6302 lexer.SetPos(save);
6303 break;
6304 }
6305 }
6306 }
6307 }
6308 *parentMatch43 = match;
6309 }
6310 *parentMatch27 = match;
6311 }
6312 *parentMatch26 = match;
6313 }
6314 if (match.hit)
6315 {
6316 *parentMatch25 = match;
6317 }
6318 else
6319 {
6320 lexer.SetPos(save);
6321 break;
6322 }
6323 }
6324 }
6325 }
6326 *parentMatch24 = match;
6327 }
6328 *parentMatch3 = match;
6329 }
6330 *parentMatch2 = match;
6331 }
6332 if (match.hit)
6333 {
6334 soulng::parser::Match match(false);
6335 soulng::parser::Match* parentMatch47 = &match;
6336 {
6337 soulng::parser::Match match(true);
6338 int64_t save = lexer.GetPos();
6339 soulng::parser::Match* parentMatch48 = &match;
6340 {
6341 soulng::parser::Match match(false);
6342 soulng::parser::Match* parentMatch49 = &match;
6343 {
6344 soulng::parser::Match match(false);
6345 soulng::parser::Match* parentMatch50 = &match;
6346 {
6347 soulng::parser::Match match(false);
6348 soulng::parser::Match* parentMatch51 = &match;
6349 {
6350 soulng::parser::Match match(false);
6351 soulng::parser::Match* parentMatch52 = &match;
6352 {
6353 soulng::parser::Match match(false);
6354 soulng::parser::Match* parentMatch53 = &match;
6355 {
6356 int64_t pos = lexer.GetPos();
6357 soulng::lexer::Span span = lexer.GetSpan();
6358 soulng::parser::Match match(false);
6359 if (*lexer == HASH)
6360 {
6361 ++lexer;
6362 match.hit = true;
6363 }
6364 if (match.hit)
6365 {
6366 keywordSpan = span;
6367 }
6368 *parentMatch53 = match;
6369 }
6370 *parentMatch52 = match;
6371 }
6372 if (match.hit)
6373 {
6374 soulng::parser::Match match(false);
6375 soulng::parser::Match* parentMatch54 = &match;
6376 {
6377 soulng::parser::Match match(false);
6378 if (*lexer == ELSE)
6379 {
6380 ++lexer;
6381 match.hit = true;
6382 }
6383 *parentMatch54 = match;
6384 }
6385 *parentMatch52 = match;
6386 }
6387 *parentMatch51 = match;
6388 }
6389 if (match.hit)
6390 {
6391 soulng::parser::Match match(false);
6392 soulng::parser::Match* parentMatch55 = &match;
6393 {
6394 soulng::parser::Match match(true);
6395 soulng::parser::Match* parentMatch56 = &match;
6396 {
6397 while (true)
6398 {
6399 int64_t save = lexer.GetPos();
6400 {
6401 soulng::parser::Match match(false);
6402 soulng::parser::Match* parentMatch57 = &match;
6403 {
6404 soulng::parser::Match match(false);
6405 soulng::parser::Match* parentMatch58 = &match;
6406 {
6407 int64_t pos = lexer.GetPos();
6408 soulng::lexer::Span span = lexer.GetSpan();
6409 soulng::parser::Match match = StatementParser::Statement(lexer, moduleId, ctx);
6410 elseS.reset(static_cast<StatementNode*>(match.value));
6411 if (match.hit)
6412 {
6413 condCompStmt->AddElseStatement(span, *moduleId, elseS.release());
6414 }
6415 *parentMatch58 = match;
6416 }
6417 *parentMatch57 = match;
6418 }
6419 if (match.hit)
6420 {
6421 *parentMatch56 = match;
6422 }
6423 else
6424 {
6425 lexer.SetPos(save);
6426 break;
6427 }
6428 }
6429 }
6430 }
6431 *parentMatch55 = match;
6432 }
6433 *parentMatch51 = match;
6434 }
6435 *parentMatch50 = match;
6436 }
6437 if (match.hit)
6438 {
6439 soulng::parser::Match match(false);
6440 soulng::parser::Match* parentMatch59 = &match;
6441 {
6442 soulng::parser::Match match(false);
6443 soulng::parser::Match* parentMatch60 = &match;
6444 {
6445 int64_t pos = lexer.GetPos();
6446 soulng::parser::Match match(true);
6447 if (match.hit)
6448 {
6449 condCompStmt->ElsePart()->SetKeywordSpan(keywordSpan);
6450 }
6451 *parentMatch60 = match;
6452 }
6453 *parentMatch59 = match;
6454 }
6455 *parentMatch50 = match;
6456 }
6457 *parentMatch49 = match;
6458 }
6459 if (match.hit)
6460 {
6461 *parentMatch48 = match;
6462 }
6463 else
6464 {
6465 lexer.SetPos(save);
6466 }
6467 }
6468 *parentMatch47 = match;
6469 }
6470 *parentMatch2 = match;
6471 }
6472 *parentMatch1 = match;
6473 }
6474 if (match.hit)
6475 {
6476 soulng::parser::Match match(false);
6477 soulng::parser::Match* parentMatch61 = &match;
6478 {
6479 soulng::parser::Match match(false);
6480 soulng::parser::Match* parentMatch62 = &match;
6481 {
6482 int64_t pos = lexer.GetPos();
6483 soulng::lexer::Span span = lexer.GetSpan();
6484 soulng::parser::Match match(false);
6485 if (*lexer == HASH)
6486 {
6487 ++lexer;
6488 match.hit = true;
6489 }
6490 if (match.hit)
6491 {
6492 keywordSpan = span;
6493 }
6494 *parentMatch62 = match;
6495 }
6496 *parentMatch61 = match;
6497 }
6498 *parentMatch1 = match;
6499 }
6500 *parentMatch0 = match;
6501 }
6502 if (match.hit)
6503 {
6504 soulng::parser::Match match(false);
6505 soulng::parser::Match* parentMatch63 = &match;
6506 {
6507 soulng::parser::Match match(false);
6508 soulng::parser::Match* parentMatch64 = &match;
6509 {
6510 int64_t pos = lexer.GetPos();
6511 soulng::lexer::Span span = lexer.GetSpan();
6512 soulng::parser::Match match(true);
6513 soulng::parser::Match* parentMatch65 = &match;
6514 {
6515 soulng::lexer::Span span = lexer.GetSpan();
6516 soulng::parser::Match match(false);
6517 if (*lexer == ENDIF)
6518 {
6519 ++lexer;
6520 match.hit = true;
6521 }
6522 if (match.hit)
6523 {
6524 *parentMatch65 = match;
6525 }
6526 else
6527 {
6528 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(ENDIF)));
6529 }
6530 }
6531 if (match.hit)
6532 {
6533 keywordSpan.end = span.end;
6534 condCompStmt->SetEndIfSpan(keywordSpan);
6535 {
6536 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6537
6538 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6539 return soulng::parser::Match(true, condCompStmt.release());
6540 }
6541 }
6542 *parentMatch64 = match;
6543 }
6544 *parentMatch63 = match;
6545 }
6546 *parentMatch0 = match;
6547 }
6548 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6549
6550
6551
6552
6553
6554 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6555 if (!match.hit)
6556 {
6557 match.value = nullptr;
6558 }
6559 return match;
6560 }
6561
6562 soulng::parser::Match StatementParser::ConditionalCompilationExpression(CmajorLexer& lexer, boost::uuids::uuid* moduleId)
6563 {
6564 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6565
6566
6567
6568
6569
6570
6571
6572 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6573 std::unique_ptr<ConditionalCompilationExpressionNode> disjunction;
6574 soulng::parser::Match match(false);
6575 soulng::parser::Match* parentMatch0 = &match;
6576 {
6577 int64_t pos = lexer.GetPos();
6578 soulng::parser::Match match = StatementParser::ConditionalCompilationDisjunction(lexer, moduleId);
6579 disjunction.reset(static_cast<ConditionalCompilationExpressionNode*>(match.value));
6580 if (match.hit)
6581 {
6582 {
6583 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6584
6585 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6586 return soulng::parser::Match(true, disjunction.release());
6587 }
6588 }
6589 *parentMatch0 = match;
6590 }
6591 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6592
6593
6594
6595
6596
6597 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6598 if (!match.hit)
6599 {
6600 match.value = nullptr;
6601 }
6602 return match;
6603 }
6604
6605 soulng::parser::Match StatementParser::ConditionalCompilationDisjunction(CmajorLexer& lexer, boost::uuids::uuid* moduleId)
6606 {
6607 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6608
6609
6610
6611
6612
6613
6614
6615 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6616 Span s = Span();
6617 std::unique_ptr<ConditionalCompilationExpressionNode> condCompExpr = std::unique_ptr<ConditionalCompilationExpressionNode>();
6618 std::unique_ptr<ConditionalCompilationExpressionNode> left;
6619 std::unique_ptr<ConditionalCompilationExpressionNode> right;
6620 soulng::parser::Match match(false);
6621 soulng::parser::Match* parentMatch0 = &match;
6622 {
6623 int64_t pos = lexer.GetPos();
6624 soulng::parser::Match match(false);
6625 soulng::parser::Match* parentMatch1 = &match;
6626 {
6627 soulng::parser::Match match(false);
6628 soulng::parser::Match* parentMatch2 = &match;
6629 {
6630 soulng::parser::Match match(false);
6631 soulng::parser::Match* parentMatch3 = &match;
6632 {
6633 int64_t pos = lexer.GetPos();
6634 soulng::lexer::Span span = lexer.GetSpan();
6635 soulng::parser::Match match = StatementParser::ConditionalCompilationConjunction(lexer, moduleId);
6636 left.reset(static_cast<ConditionalCompilationExpressionNode*>(match.value));
6637 if (match.hit)
6638 {
6639 s = span;
6640 condCompExpr.reset(left.release());
6641 }
6642 *parentMatch3 = match;
6643 }
6644 *parentMatch2 = match;
6645 }
6646 if (match.hit)
6647 {
6648 soulng::parser::Match match(false);
6649 soulng::parser::Match* parentMatch4 = &match;
6650 {
6651 soulng::parser::Match match(true);
6652 soulng::parser::Match* parentMatch5 = &match;
6653 {
6654 while (true)
6655 {
6656 int64_t save = lexer.GetPos();
6657 {
6658 soulng::parser::Match match(false);
6659 soulng::parser::Match* parentMatch6 = &match;
6660 {
6661 soulng::parser::Match match(false);
6662 soulng::parser::Match* parentMatch7 = &match;
6663 {
6664 soulng::parser::Match match(false);
6665 if (*lexer == DISJUNCTION)
6666 {
6667 ++lexer;
6668 match.hit = true;
6669 }
6670 *parentMatch7 = match;
6671 }
6672 if (match.hit)
6673 {
6674 soulng::parser::Match match(false);
6675 soulng::parser::Match* parentMatch8 = &match;
6676 {
6677 soulng::parser::Match match(false);
6678 soulng::parser::Match* parentMatch9 = &match;
6679 {
6680 int64_t pos = lexer.GetPos();
6681 soulng::lexer::Span span = lexer.GetSpan();
6682 soulng::parser::Match match = StatementParser::ConditionalCompilationConjunction(lexer, moduleId);
6683 right.reset(static_cast<ConditionalCompilationExpressionNode*>(match.value));
6684 if (match.hit)
6685 {
6686 s.end = span.end;
6687 condCompExpr.reset(new ConditionalCompilationDisjunctionNode(s, *moduleId, condCompExpr.release(), right.release()));
6688 }
6689 *parentMatch9 = match;
6690 }
6691 *parentMatch8 = match;
6692 }
6693 *parentMatch7 = match;
6694 }
6695 *parentMatch6 = match;
6696 }
6697 if (match.hit)
6698 {
6699 *parentMatch5 = match;
6700 }
6701 else
6702 {
6703 lexer.SetPos(save);
6704 break;
6705 }
6706 }
6707 }
6708 }
6709 *parentMatch4 = match;
6710 }
6711 *parentMatch2 = match;
6712 }
6713 *parentMatch1 = match;
6714 }
6715 if (match.hit)
6716 {
6717 {
6718 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6719
6720 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6721 return soulng::parser::Match(true, condCompExpr.release());
6722 }
6723 }
6724 *parentMatch0 = match;
6725 }
6726 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6727
6728
6729
6730
6731
6732 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6733 if (!match.hit)
6734 {
6735 match.value = nullptr;
6736 }
6737 return match;
6738 }
6739
6740 soulng::parser::Match StatementParser::ConditionalCompilationConjunction(CmajorLexer& lexer, boost::uuids::uuid* moduleId)
6741 {
6742 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6743
6744
6745
6746
6747
6748
6749
6750 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6751 Span s = Span();
6752 std::unique_ptr<ConditionalCompilationExpressionNode> condCompExpr = std::unique_ptr<ConditionalCompilationExpressionNode>();
6753 std::unique_ptr<ConditionalCompilationExpressionNode> left;
6754 std::unique_ptr<ConditionalCompilationExpressionNode> right;
6755 soulng::parser::Match match(false);
6756 soulng::parser::Match* parentMatch0 = &match;
6757 {
6758 int64_t pos = lexer.GetPos();
6759 soulng::parser::Match match(false);
6760 soulng::parser::Match* parentMatch1 = &match;
6761 {
6762 soulng::parser::Match match(false);
6763 soulng::parser::Match* parentMatch2 = &match;
6764 {
6765 soulng::parser::Match match(false);
6766 soulng::parser::Match* parentMatch3 = &match;
6767 {
6768 int64_t pos = lexer.GetPos();
6769 soulng::lexer::Span span = lexer.GetSpan();
6770 soulng::parser::Match match = StatementParser::ConditionalCompilationPrefix(lexer, moduleId);
6771 left.reset(static_cast<ConditionalCompilationExpressionNode*>(match.value));
6772 if (match.hit)
6773 {
6774 s = span;
6775 condCompExpr.reset(left.release());
6776 }
6777 *parentMatch3 = match;
6778 }
6779 *parentMatch2 = match;
6780 }
6781 if (match.hit)
6782 {
6783 soulng::parser::Match match(false);
6784 soulng::parser::Match* parentMatch4 = &match;
6785 {
6786 soulng::parser::Match match(true);
6787 soulng::parser::Match* parentMatch5 = &match;
6788 {
6789 while (true)
6790 {
6791 int64_t save = lexer.GetPos();
6792 {
6793 soulng::parser::Match match(false);
6794 soulng::parser::Match* parentMatch6 = &match;
6795 {
6796 soulng::parser::Match match(false);
6797 soulng::parser::Match* parentMatch7 = &match;
6798 {
6799 soulng::parser::Match match(false);
6800 if (*lexer == AMPAMP)
6801 {
6802 ++lexer;
6803 match.hit = true;
6804 }
6805 *parentMatch7 = match;
6806 }
6807 if (match.hit)
6808 {
6809 soulng::parser::Match match(false);
6810 soulng::parser::Match* parentMatch8 = &match;
6811 {
6812 soulng::parser::Match match(false);
6813 soulng::parser::Match* parentMatch9 = &match;
6814 {
6815 int64_t pos = lexer.GetPos();
6816 soulng::lexer::Span span = lexer.GetSpan();
6817 soulng::parser::Match match = StatementParser::ConditionalCompilationPrefix(lexer, moduleId);
6818 right.reset(static_cast<ConditionalCompilationExpressionNode*>(match.value));
6819 if (match.hit)
6820 {
6821 s.end = span.end;
6822 condCompExpr.reset(new ConditionalCompilationConjunctionNode(s, *moduleId, condCompExpr.release(), right.release()));
6823 }
6824 *parentMatch9 = match;
6825 }
6826 *parentMatch8 = match;
6827 }
6828 *parentMatch7 = match;
6829 }
6830 *parentMatch6 = match;
6831 }
6832 if (match.hit)
6833 {
6834 *parentMatch5 = match;
6835 }
6836 else
6837 {
6838 lexer.SetPos(save);
6839 break;
6840 }
6841 }
6842 }
6843 }
6844 *parentMatch4 = match;
6845 }
6846 *parentMatch2 = match;
6847 }
6848 *parentMatch1 = match;
6849 }
6850 if (match.hit)
6851 {
6852 {
6853 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6854
6855 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6856 return soulng::parser::Match(true, condCompExpr.release());
6857 }
6858 }
6859 *parentMatch0 = match;
6860 }
6861 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6862
6863
6864
6865
6866
6867 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6868 if (!match.hit)
6869 {
6870 match.value = nullptr;
6871 }
6872 return match;
6873 }
6874
6875 soulng::parser::Match StatementParser::ConditionalCompilationPrefix(CmajorLexer& lexer, boost::uuids::uuid* moduleId)
6876 {
6877 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6878
6879
6880
6881
6882
6883
6884
6885 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6886 Span s = Span();
6887 std::unique_ptr<ConditionalCompilationExpressionNode> condCompExpr = std::unique_ptr<ConditionalCompilationExpressionNode>();
6888 std::unique_ptr<ConditionalCompilationExpressionNode> prefix;
6889 std::unique_ptr<ConditionalCompilationExpressionNode> primary;
6890 soulng::parser::Match match(false);
6891 soulng::parser::Match* parentMatch0 = &match;
6892 {
6893 int64_t pos = lexer.GetPos();
6894 soulng::parser::Match match(false);
6895 soulng::parser::Match* parentMatch1 = &match;
6896 {
6897 soulng::parser::Match match(false);
6898 soulng::parser::Match* parentMatch2 = &match;
6899 {
6900 int64_t save = lexer.GetPos();
6901 soulng::parser::Match match(false);
6902 soulng::parser::Match* parentMatch3 = &match;
6903 {
6904 soulng::parser::Match match(false);
6905 soulng::parser::Match* parentMatch4 = &match;
6906 {
6907 int64_t pos = lexer.GetPos();
6908 soulng::lexer::Span span = lexer.GetSpan();
6909 soulng::parser::Match match(false);
6910 if (*lexer == EXCLAMATION)
6911 {
6912 ++lexer;
6913 match.hit = true;
6914 }
6915 if (match.hit)
6916 {
6917 s = span;
6918 }
6919 *parentMatch4 = match;
6920 }
6921 *parentMatch3 = match;
6922 }
6923 if (match.hit)
6924 {
6925 soulng::parser::Match match(false);
6926 soulng::parser::Match* parentMatch5 = &match;
6927 {
6928 soulng::parser::Match match(false);
6929 soulng::parser::Match* parentMatch6 = &match;
6930 {
6931 int64_t pos = lexer.GetPos();
6932 soulng::lexer::Span span = lexer.GetSpan();
6933 soulng::parser::Match match = StatementParser::ConditionalCompilationPrefix(lexer, moduleId);
6934 prefix.reset(static_cast<ConditionalCompilationExpressionNode*>(match.value));
6935 if (match.hit)
6936 {
6937 s.end = span.end;
6938 condCompExpr.reset(new ConditionalCompilationNotNode(s, *moduleId, prefix.release()));
6939 }
6940 *parentMatch6 = match;
6941 }
6942 *parentMatch5 = match;
6943 }
6944 *parentMatch3 = match;
6945 }
6946 *parentMatch2 = match;
6947 if (!match.hit)
6948 {
6949 soulng::parser::Match match(false);
6950 soulng::parser::Match* parentMatch7 = &match;
6951 lexer.SetPos(save);
6952 {
6953 soulng::parser::Match match(false);
6954 soulng::parser::Match* parentMatch8 = &match;
6955 {
6956 int64_t pos = lexer.GetPos();
6957 soulng::parser::Match match(true);
6958 soulng::parser::Match* parentMatch9 = &match;
6959 {
6960 soulng::lexer::Span span = lexer.GetSpan();
6961 soulng::parser::Match match = StatementParser::ConditionalCompilationPrimary(lexer, moduleId);
6962 primary.reset(static_cast<ConditionalCompilationExpressionNode*>(match.value));
6963 if (match.hit)
6964 {
6965 *parentMatch9 = match;
6966 }
6967 else
6968 {
6969 lexer.ThrowExpectationFailure(span, U"conditional compilation primary expression");
6970 }
6971 }
6972 if (match.hit)
6973 {
6974 condCompExpr.reset(primary.release());
6975 }
6976 *parentMatch8 = match;
6977 }
6978 *parentMatch7 = match;
6979 }
6980 *parentMatch2 = match;
6981 }
6982 }
6983 *parentMatch1 = match;
6984 }
6985 if (match.hit)
6986 {
6987 {
6988 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6989
6990 #endif // SOULNG_PARSER_DEBUG_SUPPORT
6991 return soulng::parser::Match(true, condCompExpr.release());
6992 }
6993 }
6994 *parentMatch0 = match;
6995 }
6996 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
6997
6998
6999
7000
7001
7002 #endif // SOULNG_PARSER_DEBUG_SUPPORT
7003 if (!match.hit)
7004 {
7005 match.value = nullptr;
7006 }
7007 return match;
7008 }
7009
7010 soulng::parser::Match StatementParser::ConditionalCompilationPrimary(CmajorLexer& lexer, boost::uuids::uuid* moduleId)
7011 {
7012 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
7013
7014
7015
7016
7017
7018
7019
7020 #endif // SOULNG_PARSER_DEBUG_SUPPORT
7021 std::u32string symbol = std::u32string();
7022 std::unique_ptr<ConditionalCompilationExpressionNode> expr;
7023 soulng::parser::Match match(false);
7024 soulng::parser::Match* parentMatch0 = &match;
7025 {
7026 int64_t save = lexer.GetPos();
7027 soulng::parser::Match match(false);
7028 soulng::parser::Match* parentMatch1 = &match;
7029 {
7030 int64_t pos = lexer.GetPos();
7031 soulng::lexer::Span span = lexer.GetSpan();
7032 soulng::parser::Match match(false);
7033 if (*lexer == ID)
7034 {
7035 ++lexer;
7036 match.hit = true;
7037 }
7038 if (match.hit)
7039 {
7040 symbol = lexer.GetMatch(span);
7041 {
7042 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
7043
7044 #endif // SOULNG_PARSER_DEBUG_SUPPORT
7045 return soulng::parser::Match(true, new ConditionalCompilationPrimaryNode(span, *moduleId, symbol));
7046 }
7047 }
7048 *parentMatch1 = match;
7049 }
7050 *parentMatch0 = match;
7051 if (!match.hit)
7052 {
7053 soulng::parser::Match match(false);
7054 soulng::parser::Match* parentMatch2 = &match;
7055 lexer.SetPos(save);
7056 {
7057 soulng::parser::Match match(false);
7058 soulng::parser::Match* parentMatch3 = &match;
7059 {
7060 soulng::parser::Match match(false);
7061 soulng::parser::Match* parentMatch4 = &match;
7062 {
7063 soulng::parser::Match match(false);
7064 if (*lexer == LPAREN)
7065 {
7066 ++lexer;
7067 match.hit = true;
7068 }
7069 *parentMatch4 = match;
7070 }
7071 if (match.hit)
7072 {
7073 soulng::parser::Match match(false);
7074 soulng::parser::Match* parentMatch5 = &match;
7075 {
7076 soulng::parser::Match match = StatementParser::ConditionalCompilationExpression(lexer, moduleId);
7077 expr.reset(static_cast<ConditionalCompilationExpressionNode*>(match.value));
7078 *parentMatch5 = match;
7079 }
7080 *parentMatch4 = match;
7081 }
7082 *parentMatch3 = match;
7083 }
7084 if (match.hit)
7085 {
7086 soulng::parser::Match match(false);
7087 soulng::parser::Match* parentMatch6 = &match;
7088 {
7089 soulng::parser::Match match(false);
7090 soulng::parser::Match* parentMatch7 = &match;
7091 {
7092 int64_t pos = lexer.GetPos();
7093 soulng::lexer::Span span = lexer.GetSpan();
7094 soulng::parser::Match match(true);
7095 soulng::parser::Match* parentMatch8 = &match;
7096 {
7097 soulng::lexer::Span span = lexer.GetSpan();
7098 soulng::parser::Match match(false);
7099 if (*lexer == RPAREN)
7100 {
7101 ++lexer;
7102 match.hit = true;
7103 }
7104 if (match.hit)
7105 {
7106 *parentMatch8 = match;
7107 }
7108 else
7109 {
7110 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
7111 }
7112 }
7113 if (match.hit)
7114 {
7115 {
7116 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
7117
7118 #endif // SOULNG_PARSER_DEBUG_SUPPORT
7119 return soulng::parser::Match(true, new ParenthesizedConditionalCompilationExpressionNode(span, *moduleId, expr.release()));
7120 }
7121 }
7122 *parentMatch7 = match;
7123 }
7124 *parentMatch6 = match;
7125 }
7126 *parentMatch3 = match;
7127 }
7128 *parentMatch2 = match;
7129 }
7130 *parentMatch0 = match;
7131 }
7132 }
7133 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
7134
7135
7136
7137
7138
7139 #endif // SOULNG_PARSER_DEBUG_SUPPORT
7140 if (!match.hit)
7141 {
7142 match.value = nullptr;
7143 }
7144 return match;
7145 }