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