1 #include "Expression.hpp"
2 #include <soulng/util/Unicode.hpp>
3 #include <sngcm/cmparser/BasicType.hpp>
4 #include <sngcm/cmparser/Literal.hpp>
5 #include <sngcm/cmparser/Template.hpp>
6 #include <sngcm/cmparser/Operator.hpp>
7 #include <sngcm/cmparser/TypeExpr.hpp>
8 #include <sngcm/cmparser/Identifier.hpp>
9 #include <sngcm/cmlexer/CmajorLexer.hpp>
10 #include <sngcm/cmlexer/CmajorTokens.hpp>
11
12
13
14 using namespace soulng::unicode;
15 using namespace sngcm::ast;
16 using namespace CmajorTokens;
17
18 soulng::parser::Match ExpressionParser::Expression(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
19 {
20 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
21
22
23
24
25
26
27
28 #endif // SOULNG_PARSER_DEBUG_SUPPORT
29 std::unique_ptr<Node> equivalence;
30 soulng::parser::Match match(false);
31 soulng::parser::Match* parentMatch0 = &match;
32 {
33 int64_t pos = lexer.GetPos();
34 soulng::parser::Match match = ExpressionParser::Equivalence(lexer, moduleId, ctx);
35 equivalence.reset(static_cast<Node*>(match.value));
36 if (match.hit)
37 {
38 {
39 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
40
41 #endif // SOULNG_PARSER_DEBUG_SUPPORT
42 return soulng::parser::Match(true, equivalence.release());
43 }
44 }
45 *parentMatch0 = match;
46 }
47 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
48
49
50
51
52
53 #endif // SOULNG_PARSER_DEBUG_SUPPORT
54 if (!match.hit)
55 {
56 match.value = nullptr;
57 }
58 return match;
59 }
60
61 soulng::parser::Match ExpressionParser::Equivalence(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
62 {
63 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
64
65
66
67
68
69
70
71 #endif // SOULNG_PARSER_DEBUG_SUPPORT
72 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
73 Span s = Span();
74 std::unique_ptr<Node> left;
75 std::unique_ptr<Node> right;
76 soulng::parser::Match match(false);
77 soulng::parser::Match* parentMatch0 = &match;
78 {
79 int64_t pos = lexer.GetPos();
80 soulng::parser::Match match(false);
81 soulng::parser::Match* parentMatch1 = &match;
82 {
83 soulng::parser::Match match(false);
84 soulng::parser::Match* parentMatch2 = &match;
85 {
86 soulng::parser::Match match(false);
87 soulng::parser::Match* parentMatch3 = &match;
88 {
89 int64_t pos = lexer.GetPos();
90 soulng::lexer::Span span = lexer.GetSpan();
91 soulng::parser::Match match = ExpressionParser::Implication(lexer, moduleId, ctx);
92 left.reset(static_cast<Node*>(match.value));
93 if (match.hit)
94 {
95 s = span;
96 expr.reset(left.release());
97 }
98 *parentMatch3 = match;
99 }
100 *parentMatch2 = match;
101 }
102 if (match.hit)
103 {
104 soulng::parser::Match match(false);
105 soulng::parser::Match* parentMatch4 = &match;
106 {
107 soulng::parser::Match match(true);
108 soulng::parser::Match* parentMatch5 = &match;
109 {
110 while (true)
111 {
112 int64_t save = lexer.GetPos();
113 {
114 soulng::parser::Match match(false);
115 soulng::parser::Match* parentMatch6 = &match;
116 {
117 soulng::parser::Match match(false);
118 soulng::parser::Match* parentMatch7 = &match;
119 {
120 soulng::parser::Match match(false);
121 soulng::parser::Match* parentMatch8 = &match;
122 {
123 int64_t pos = lexer.GetPos();
124 bool pass = true;
125 soulng::parser::Match match(false);
126 if (*lexer == EQUIVALENCE)
127 {
128 ++lexer;
129 match.hit = true;
130 }
131 if (match.hit)
132 {
133 if (!ctx->parsingConcept || ctx->parsingTemplateId) pass = false;
134 }
135 if (match.hit && !pass)
136 {
137 match = soulng::parser::Match(false);
138 }
139 *parentMatch8 = match;
140 }
141 *parentMatch7 = match;
142 }
143 if (match.hit)
144 {
145 soulng::parser::Match match(false);
146 soulng::parser::Match* parentMatch9 = &match;
147 {
148 soulng::parser::Match match(false);
149 soulng::parser::Match* parentMatch10 = &match;
150 {
151 int64_t pos = lexer.GetPos();
152 soulng::lexer::Span span = lexer.GetSpan();
153 soulng::parser::Match match(true);
154 soulng::parser::Match* parentMatch11 = &match;
155 {
156 soulng::lexer::Span span = lexer.GetSpan();
157 soulng::parser::Match match = ExpressionParser::Implication(lexer, moduleId, ctx);
158 right.reset(static_cast<Node*>(match.value));
159 if (match.hit)
160 {
161 *parentMatch11 = match;
162 }
163 else
164 {
165 lexer.ThrowExpectationFailure(span, U"implication expression");
166 }
167 }
168 if (match.hit)
169 {
170 s.end = span.end;
171 expr.reset(new EquivalenceNode(s, *moduleId, expr.release(), right.release()));
172 }
173 *parentMatch10 = match;
174 }
175 *parentMatch9 = match;
176 }
177 *parentMatch7 = match;
178 }
179 *parentMatch6 = match;
180 }
181 if (match.hit)
182 {
183 *parentMatch5 = match;
184 }
185 else
186 {
187 lexer.SetPos(save);
188 break;
189 }
190 }
191 }
192 }
193 *parentMatch4 = match;
194 }
195 *parentMatch2 = match;
196 }
197 *parentMatch1 = match;
198 }
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, expr.release());
206 }
207 }
208 *parentMatch0 = match;
209 }
210 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
211
212
213
214
215
216 #endif // SOULNG_PARSER_DEBUG_SUPPORT
217 if (!match.hit)
218 {
219 match.value = nullptr;
220 }
221 return match;
222 }
223
224 soulng::parser::Match ExpressionParser::Implication(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
225 {
226 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
227
228
229
230
231
232
233
234 #endif // SOULNG_PARSER_DEBUG_SUPPORT
235 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
236 Span s = Span();
237 std::unique_ptr<Node> left;
238 std::unique_ptr<Node> right;
239 soulng::parser::Match match(false);
240 soulng::parser::Match* parentMatch0 = &match;
241 {
242 int64_t pos = lexer.GetPos();
243 soulng::parser::Match match(false);
244 soulng::parser::Match* parentMatch1 = &match;
245 {
246 soulng::parser::Match match(false);
247 soulng::parser::Match* parentMatch2 = &match;
248 {
249 soulng::parser::Match match(false);
250 soulng::parser::Match* parentMatch3 = &match;
251 {
252 int64_t pos = lexer.GetPos();
253 soulng::lexer::Span span = lexer.GetSpan();
254 soulng::parser::Match match = ExpressionParser::Disjunction(lexer, moduleId, ctx);
255 left.reset(static_cast<Node*>(match.value));
256 if (match.hit)
257 {
258 s = span;
259 expr.reset(left.release());
260 }
261 *parentMatch3 = match;
262 }
263 *parentMatch2 = match;
264 }
265 if (match.hit)
266 {
267 soulng::parser::Match match(false);
268 soulng::parser::Match* parentMatch4 = &match;
269 {
270 soulng::parser::Match match(true);
271 int64_t save = lexer.GetPos();
272 soulng::parser::Match* parentMatch5 = &match;
273 {
274 soulng::parser::Match match(false);
275 soulng::parser::Match* parentMatch6 = &match;
276 {
277 soulng::parser::Match match(false);
278 soulng::parser::Match* parentMatch7 = &match;
279 {
280 soulng::parser::Match match(false);
281 soulng::parser::Match* parentMatch8 = &match;
282 {
283 int64_t pos = lexer.GetPos();
284 bool pass = true;
285 soulng::parser::Match match(false);
286 if (*lexer == IMPLICATION)
287 {
288 ++lexer;
289 match.hit = true;
290 }
291 if (match.hit)
292 {
293 if (!ctx->parsingConcept || ctx->parsingTemplateId) pass = false;
294 }
295 if (match.hit && !pass)
296 {
297 match = soulng::parser::Match(false);
298 }
299 *parentMatch8 = match;
300 }
301 *parentMatch7 = match;
302 }
303 if (match.hit)
304 {
305 soulng::parser::Match match(false);
306 soulng::parser::Match* parentMatch9 = &match;
307 {
308 soulng::parser::Match match(false);
309 soulng::parser::Match* parentMatch10 = &match;
310 {
311 int64_t pos = lexer.GetPos();
312 soulng::lexer::Span span = lexer.GetSpan();
313 soulng::parser::Match match(true);
314 soulng::parser::Match* parentMatch11 = &match;
315 {
316 soulng::lexer::Span span = lexer.GetSpan();
317 soulng::parser::Match match = ExpressionParser::Implication(lexer, moduleId, ctx);
318 right.reset(static_cast<Node*>(match.value));
319 if (match.hit)
320 {
321 *parentMatch11 = match;
322 }
323 else
324 {
325 lexer.ThrowExpectationFailure(span, U"implication expression");
326 }
327 }
328 if (match.hit)
329 {
330 s.end = span.end;
331 expr.reset(new ImplicationNode(s, *moduleId, expr.release(), right.release()));
332 }
333 *parentMatch10 = match;
334 }
335 *parentMatch9 = match;
336 }
337 *parentMatch7 = match;
338 }
339 *parentMatch6 = match;
340 }
341 if (match.hit)
342 {
343 *parentMatch5 = match;
344 }
345 else
346 {
347 lexer.SetPos(save);
348 }
349 }
350 *parentMatch4 = match;
351 }
352 *parentMatch2 = match;
353 }
354 *parentMatch1 = match;
355 }
356 if (match.hit)
357 {
358 {
359 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
360
361 #endif // SOULNG_PARSER_DEBUG_SUPPORT
362 return soulng::parser::Match(true, expr.release());
363 }
364 }
365 *parentMatch0 = match;
366 }
367 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
368
369
370
371
372
373 #endif // SOULNG_PARSER_DEBUG_SUPPORT
374 if (!match.hit)
375 {
376 match.value = nullptr;
377 }
378 return match;
379 }
380
381 soulng::parser::Match ExpressionParser::Disjunction(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
382 {
383 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
384
385
386
387
388
389
390
391 #endif // SOULNG_PARSER_DEBUG_SUPPORT
392 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
393 Span s = Span();
394 std::unique_ptr<Node> left;
395 std::unique_ptr<Node> right;
396 soulng::parser::Match match(false);
397 soulng::parser::Match* parentMatch0 = &match;
398 {
399 int64_t pos = lexer.GetPos();
400 soulng::parser::Match match(false);
401 soulng::parser::Match* parentMatch1 = &match;
402 {
403 soulng::parser::Match match(false);
404 soulng::parser::Match* parentMatch2 = &match;
405 {
406 soulng::parser::Match match(false);
407 soulng::parser::Match* parentMatch3 = &match;
408 {
409 int64_t pos = lexer.GetPos();
410 soulng::lexer::Span span = lexer.GetSpan();
411 soulng::parser::Match match = ExpressionParser::Conjunction(lexer, moduleId, ctx);
412 left.reset(static_cast<Node*>(match.value));
413 if (match.hit)
414 {
415 s = span;
416 expr.reset(left.release());
417 }
418 *parentMatch3 = match;
419 }
420 *parentMatch2 = match;
421 }
422 if (match.hit)
423 {
424 soulng::parser::Match match(false);
425 soulng::parser::Match* parentMatch4 = &match;
426 {
427 soulng::parser::Match match(true);
428 soulng::parser::Match* parentMatch5 = &match;
429 {
430 while (true)
431 {
432 int64_t save = lexer.GetPos();
433 {
434 soulng::parser::Match match(false);
435 soulng::parser::Match* parentMatch6 = &match;
436 {
437 soulng::parser::Match match(false);
438 soulng::parser::Match* parentMatch7 = &match;
439 {
440 soulng::parser::Match match(false);
441 soulng::parser::Match* parentMatch8 = &match;
442 {
443 int64_t pos = lexer.GetPos();
444 bool pass = true;
445 soulng::parser::Match match(false);
446 if (*lexer == DISJUNCTION)
447 {
448 ++lexer;
449 match.hit = true;
450 }
451 if (match.hit)
452 {
453 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
454 }
455 if (match.hit && !pass)
456 {
457 match = soulng::parser::Match(false);
458 }
459 *parentMatch8 = match;
460 }
461 *parentMatch7 = match;
462 }
463 if (match.hit)
464 {
465 soulng::parser::Match match(false);
466 soulng::parser::Match* parentMatch9 = &match;
467 {
468 soulng::parser::Match match(false);
469 soulng::parser::Match* parentMatch10 = &match;
470 {
471 int64_t pos = lexer.GetPos();
472 soulng::lexer::Span span = lexer.GetSpan();
473 soulng::parser::Match match(true);
474 soulng::parser::Match* parentMatch11 = &match;
475 {
476 soulng::lexer::Span span = lexer.GetSpan();
477 soulng::parser::Match match = ExpressionParser::Conjunction(lexer, moduleId, ctx);
478 right.reset(static_cast<Node*>(match.value));
479 if (match.hit)
480 {
481 *parentMatch11 = match;
482 }
483 else
484 {
485 lexer.ThrowExpectationFailure(span, U"conjunctive expression");
486 }
487 }
488 if (match.hit)
489 {
490 s.end = span.end;
491 expr.reset(new DisjunctionNode(s, *moduleId, expr.release(), right.release()));
492 }
493 *parentMatch10 = match;
494 }
495 *parentMatch9 = match;
496 }
497 *parentMatch7 = match;
498 }
499 *parentMatch6 = match;
500 }
501 if (match.hit)
502 {
503 *parentMatch5 = match;
504 }
505 else
506 {
507 lexer.SetPos(save);
508 break;
509 }
510 }
511 }
512 }
513 *parentMatch4 = match;
514 }
515 *parentMatch2 = match;
516 }
517 *parentMatch1 = match;
518 }
519 if (match.hit)
520 {
521 {
522 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
523
524 #endif // SOULNG_PARSER_DEBUG_SUPPORT
525 return soulng::parser::Match(true, expr.release());
526 }
527 }
528 *parentMatch0 = match;
529 }
530 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
531
532
533
534
535
536 #endif // SOULNG_PARSER_DEBUG_SUPPORT
537 if (!match.hit)
538 {
539 match.value = nullptr;
540 }
541 return match;
542 }
543
544 soulng::parser::Match ExpressionParser::Conjunction(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
545 {
546 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
547
548
549
550
551
552
553
554 #endif // SOULNG_PARSER_DEBUG_SUPPORT
555 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
556 Span s = Span();
557 std::unique_ptr<Node> left;
558 std::unique_ptr<Node> right;
559 soulng::parser::Match match(false);
560 soulng::parser::Match* parentMatch0 = &match;
561 {
562 int64_t pos = lexer.GetPos();
563 soulng::parser::Match match(false);
564 soulng::parser::Match* parentMatch1 = &match;
565 {
566 soulng::parser::Match match(false);
567 soulng::parser::Match* parentMatch2 = &match;
568 {
569 soulng::parser::Match match(false);
570 soulng::parser::Match* parentMatch3 = &match;
571 {
572 int64_t pos = lexer.GetPos();
573 soulng::lexer::Span span = lexer.GetSpan();
574 soulng::parser::Match match = ExpressionParser::BitOr(lexer, moduleId, ctx);
575 left.reset(static_cast<Node*>(match.value));
576 if (match.hit)
577 {
578 s = span;
579 expr.reset(left.release());
580 }
581 *parentMatch3 = match;
582 }
583 *parentMatch2 = match;
584 }
585 if (match.hit)
586 {
587 soulng::parser::Match match(false);
588 soulng::parser::Match* parentMatch4 = &match;
589 {
590 soulng::parser::Match match(true);
591 soulng::parser::Match* parentMatch5 = &match;
592 {
593 while (true)
594 {
595 int64_t save = lexer.GetPos();
596 {
597 soulng::parser::Match match(false);
598 soulng::parser::Match* parentMatch6 = &match;
599 {
600 soulng::parser::Match match(false);
601 soulng::parser::Match* parentMatch7 = &match;
602 {
603 soulng::parser::Match match(false);
604 soulng::parser::Match* parentMatch8 = &match;
605 {
606 int64_t pos = lexer.GetPos();
607 bool pass = true;
608 soulng::parser::Match match(false);
609 if (*lexer == AMPAMP)
610 {
611 ++lexer;
612 match.hit = true;
613 }
614 if (match.hit)
615 {
616 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
617 }
618 if (match.hit && !pass)
619 {
620 match = soulng::parser::Match(false);
621 }
622 *parentMatch8 = match;
623 }
624 *parentMatch7 = match;
625 }
626 if (match.hit)
627 {
628 soulng::parser::Match match(false);
629 soulng::parser::Match* parentMatch9 = &match;
630 {
631 soulng::parser::Match match(false);
632 soulng::parser::Match* parentMatch10 = &match;
633 {
634 int64_t pos = lexer.GetPos();
635 soulng::lexer::Span span = lexer.GetSpan();
636 soulng::parser::Match match(true);
637 soulng::parser::Match* parentMatch11 = &match;
638 {
639 soulng::lexer::Span span = lexer.GetSpan();
640 soulng::parser::Match match = ExpressionParser::BitOr(lexer, moduleId, ctx);
641 right.reset(static_cast<Node*>(match.value));
642 if (match.hit)
643 {
644 *parentMatch11 = match;
645 }
646 else
647 {
648 lexer.ThrowExpectationFailure(span, U"bitwise or expression ");
649 }
650 }
651 if (match.hit)
652 {
653 s.end = span.end;
654 expr.reset(new ConjunctionNode(s, *moduleId, expr.release(), right.release()));
655 }
656 *parentMatch10 = match;
657 }
658 *parentMatch9 = match;
659 }
660 *parentMatch7 = match;
661 }
662 *parentMatch6 = match;
663 }
664 if (match.hit)
665 {
666 *parentMatch5 = match;
667 }
668 else
669 {
670 lexer.SetPos(save);
671 break;
672 }
673 }
674 }
675 }
676 *parentMatch4 = match;
677 }
678 *parentMatch2 = match;
679 }
680 *parentMatch1 = match;
681 }
682 if (match.hit)
683 {
684 {
685 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
686
687 #endif // SOULNG_PARSER_DEBUG_SUPPORT
688 return soulng::parser::Match(true, expr.release());
689 }
690 }
691 *parentMatch0 = match;
692 }
693 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
694
695
696
697
698
699 #endif // SOULNG_PARSER_DEBUG_SUPPORT
700 if (!match.hit)
701 {
702 match.value = nullptr;
703 }
704 return match;
705 }
706
707 soulng::parser::Match ExpressionParser::BitOr(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
708 {
709 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
710
711
712
713
714
715
716
717 #endif // SOULNG_PARSER_DEBUG_SUPPORT
718 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
719 Span s = Span();
720 std::unique_ptr<Node> left;
721 std::unique_ptr<Node> right;
722 soulng::parser::Match match(false);
723 soulng::parser::Match* parentMatch0 = &match;
724 {
725 int64_t pos = lexer.GetPos();
726 soulng::parser::Match match(false);
727 soulng::parser::Match* parentMatch1 = &match;
728 {
729 soulng::parser::Match match(false);
730 soulng::parser::Match* parentMatch2 = &match;
731 {
732 soulng::parser::Match match(false);
733 soulng::parser::Match* parentMatch3 = &match;
734 {
735 int64_t pos = lexer.GetPos();
736 soulng::lexer::Span span = lexer.GetSpan();
737 soulng::parser::Match match = ExpressionParser::BitXor(lexer, moduleId, ctx);
738 left.reset(static_cast<Node*>(match.value));
739 if (match.hit)
740 {
741 s = span;
742 expr.reset(left.release());
743 }
744 *parentMatch3 = match;
745 }
746 *parentMatch2 = match;
747 }
748 if (match.hit)
749 {
750 soulng::parser::Match match(false);
751 soulng::parser::Match* parentMatch4 = &match;
752 {
753 soulng::parser::Match match(true);
754 soulng::parser::Match* parentMatch5 = &match;
755 {
756 while (true)
757 {
758 int64_t save = lexer.GetPos();
759 {
760 soulng::parser::Match match(false);
761 soulng::parser::Match* parentMatch6 = &match;
762 {
763 soulng::parser::Match match(false);
764 soulng::parser::Match* parentMatch7 = &match;
765 {
766 soulng::parser::Match match(false);
767 soulng::parser::Match* parentMatch8 = &match;
768 {
769 int64_t pos = lexer.GetPos();
770 bool pass = true;
771 soulng::parser::Match match(false);
772 if (*lexer == BITOR)
773 {
774 ++lexer;
775 match.hit = true;
776 }
777 if (match.hit)
778 {
779 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
780 }
781 if (match.hit && !pass)
782 {
783 match = soulng::parser::Match(false);
784 }
785 *parentMatch8 = match;
786 }
787 *parentMatch7 = match;
788 }
789 if (match.hit)
790 {
791 soulng::parser::Match match(false);
792 soulng::parser::Match* parentMatch9 = &match;
793 {
794 soulng::parser::Match match(false);
795 soulng::parser::Match* parentMatch10 = &match;
796 {
797 int64_t pos = lexer.GetPos();
798 soulng::lexer::Span span = lexer.GetSpan();
799 soulng::parser::Match match(true);
800 soulng::parser::Match* parentMatch11 = &match;
801 {
802 soulng::lexer::Span span = lexer.GetSpan();
803 soulng::parser::Match match = ExpressionParser::BitXor(lexer, moduleId, ctx);
804 right.reset(static_cast<Node*>(match.value));
805 if (match.hit)
806 {
807 *parentMatch11 = match;
808 }
809 else
810 {
811 lexer.ThrowExpectationFailure(span, U"bitwise exclusive or expression");
812 }
813 }
814 if (match.hit)
815 {
816 s.end = span.end;
817 expr.reset(new BitOrNode(s, *moduleId, expr.release(), right.release()));
818 }
819 *parentMatch10 = match;
820 }
821 *parentMatch9 = match;
822 }
823 *parentMatch7 = match;
824 }
825 *parentMatch6 = match;
826 }
827 if (match.hit)
828 {
829 *parentMatch5 = match;
830 }
831 else
832 {
833 lexer.SetPos(save);
834 break;
835 }
836 }
837 }
838 }
839 *parentMatch4 = match;
840 }
841 *parentMatch2 = match;
842 }
843 *parentMatch1 = match;
844 }
845 if (match.hit)
846 {
847 {
848 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
849
850 #endif // SOULNG_PARSER_DEBUG_SUPPORT
851 return soulng::parser::Match(true, expr.release());
852 }
853 }
854 *parentMatch0 = match;
855 }
856 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
857
858
859
860
861
862 #endif // SOULNG_PARSER_DEBUG_SUPPORT
863 if (!match.hit)
864 {
865 match.value = nullptr;
866 }
867 return match;
868 }
869
870 soulng::parser::Match ExpressionParser::BitXor(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
871 {
872 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
873
874
875
876
877
878
879
880 #endif // SOULNG_PARSER_DEBUG_SUPPORT
881 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
882 Span s = Span();
883 std::unique_ptr<Node> left;
884 std::unique_ptr<Node> right;
885 soulng::parser::Match match(false);
886 soulng::parser::Match* parentMatch0 = &match;
887 {
888 int64_t pos = lexer.GetPos();
889 soulng::parser::Match match(false);
890 soulng::parser::Match* parentMatch1 = &match;
891 {
892 soulng::parser::Match match(false);
893 soulng::parser::Match* parentMatch2 = &match;
894 {
895 soulng::parser::Match match(false);
896 soulng::parser::Match* parentMatch3 = &match;
897 {
898 int64_t pos = lexer.GetPos();
899 soulng::lexer::Span span = lexer.GetSpan();
900 soulng::parser::Match match = ExpressionParser::BitAnd(lexer, moduleId, ctx);
901 left.reset(static_cast<Node*>(match.value));
902 if (match.hit)
903 {
904 s = span;
905 expr.reset(left.release());
906 }
907 *parentMatch3 = match;
908 }
909 *parentMatch2 = match;
910 }
911 if (match.hit)
912 {
913 soulng::parser::Match match(false);
914 soulng::parser::Match* parentMatch4 = &match;
915 {
916 soulng::parser::Match match(true);
917 soulng::parser::Match* parentMatch5 = &match;
918 {
919 while (true)
920 {
921 int64_t save = lexer.GetPos();
922 {
923 soulng::parser::Match match(false);
924 soulng::parser::Match* parentMatch6 = &match;
925 {
926 soulng::parser::Match match(false);
927 soulng::parser::Match* parentMatch7 = &match;
928 {
929 soulng::parser::Match match(false);
930 soulng::parser::Match* parentMatch8 = &match;
931 {
932 int64_t pos = lexer.GetPos();
933 bool pass = true;
934 soulng::parser::Match match(false);
935 if (*lexer == BITXOR)
936 {
937 ++lexer;
938 match.hit = true;
939 }
940 if (match.hit)
941 {
942 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
943 }
944 if (match.hit && !pass)
945 {
946 match = soulng::parser::Match(false);
947 }
948 *parentMatch8 = match;
949 }
950 *parentMatch7 = match;
951 }
952 if (match.hit)
953 {
954 soulng::parser::Match match(false);
955 soulng::parser::Match* parentMatch9 = &match;
956 {
957 soulng::parser::Match match(false);
958 soulng::parser::Match* parentMatch10 = &match;
959 {
960 int64_t pos = lexer.GetPos();
961 soulng::lexer::Span span = lexer.GetSpan();
962 soulng::parser::Match match(true);
963 soulng::parser::Match* parentMatch11 = &match;
964 {
965 soulng::lexer::Span span = lexer.GetSpan();
966 soulng::parser::Match match = ExpressionParser::BitAnd(lexer, moduleId, ctx);
967 right.reset(static_cast<Node*>(match.value));
968 if (match.hit)
969 {
970 *parentMatch11 = match;
971 }
972 else
973 {
974 lexer.ThrowExpectationFailure(span, U"bitwise and expression");
975 }
976 }
977 if (match.hit)
978 {
979 s.end = span.end;
980 expr.reset(new BitXorNode(s, *moduleId, expr.release(), right.release()));
981 }
982 *parentMatch10 = match;
983 }
984 *parentMatch9 = match;
985 }
986 *parentMatch7 = match;
987 }
988 *parentMatch6 = match;
989 }
990 if (match.hit)
991 {
992 *parentMatch5 = match;
993 }
994 else
995 {
996 lexer.SetPos(save);
997 break;
998 }
999 }
1000 }
1001 }
1002 *parentMatch4 = match;
1003 }
1004 *parentMatch2 = match;
1005 }
1006 *parentMatch1 = match;
1007 }
1008 if (match.hit)
1009 {
1010 {
1011 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1012
1013 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1014 return soulng::parser::Match(true, expr.release());
1015 }
1016 }
1017 *parentMatch0 = match;
1018 }
1019 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1020
1021
1022
1023
1024
1025 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1026 if (!match.hit)
1027 {
1028 match.value = nullptr;
1029 }
1030 return match;
1031 }
1032
1033 soulng::parser::Match ExpressionParser::BitAnd(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
1034 {
1035 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1036
1037
1038
1039
1040
1041
1042
1043 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1044 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
1045 Span s = Span();
1046 std::unique_ptr<Node> left;
1047 std::unique_ptr<Node> right;
1048 soulng::parser::Match match(false);
1049 soulng::parser::Match* parentMatch0 = &match;
1050 {
1051 int64_t pos = lexer.GetPos();
1052 soulng::parser::Match match(false);
1053 soulng::parser::Match* parentMatch1 = &match;
1054 {
1055 soulng::parser::Match match(false);
1056 soulng::parser::Match* parentMatch2 = &match;
1057 {
1058 soulng::parser::Match match(false);
1059 soulng::parser::Match* parentMatch3 = &match;
1060 {
1061 int64_t pos = lexer.GetPos();
1062 soulng::lexer::Span span = lexer.GetSpan();
1063 soulng::parser::Match match = ExpressionParser::Equality(lexer, moduleId, ctx);
1064 left.reset(static_cast<Node*>(match.value));
1065 if (match.hit)
1066 {
1067 s = span;
1068 expr.reset(left.release());
1069 }
1070 *parentMatch3 = match;
1071 }
1072 *parentMatch2 = match;
1073 }
1074 if (match.hit)
1075 {
1076 soulng::parser::Match match(false);
1077 soulng::parser::Match* parentMatch4 = &match;
1078 {
1079 soulng::parser::Match match(true);
1080 soulng::parser::Match* parentMatch5 = &match;
1081 {
1082 while (true)
1083 {
1084 int64_t save = lexer.GetPos();
1085 {
1086 soulng::parser::Match match(false);
1087 soulng::parser::Match* parentMatch6 = &match;
1088 {
1089 soulng::parser::Match match(false);
1090 soulng::parser::Match* parentMatch7 = &match;
1091 {
1092 soulng::parser::Match match(false);
1093 soulng::parser::Match* parentMatch8 = &match;
1094 {
1095 int64_t pos = lexer.GetPos();
1096 bool pass = true;
1097 soulng::parser::Match match(false);
1098 if (*lexer == AMP)
1099 {
1100 ++lexer;
1101 match.hit = true;
1102 }
1103 if (match.hit)
1104 {
1105 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
1106 }
1107 if (match.hit && !pass)
1108 {
1109 match = soulng::parser::Match(false);
1110 }
1111 *parentMatch8 = match;
1112 }
1113 *parentMatch7 = match;
1114 }
1115 if (match.hit)
1116 {
1117 soulng::parser::Match match(false);
1118 soulng::parser::Match* parentMatch9 = &match;
1119 {
1120 soulng::parser::Match match(false);
1121 soulng::parser::Match* parentMatch10 = &match;
1122 {
1123 int64_t pos = lexer.GetPos();
1124 soulng::lexer::Span span = lexer.GetSpan();
1125 soulng::parser::Match match(true);
1126 soulng::parser::Match* parentMatch11 = &match;
1127 {
1128 soulng::lexer::Span span = lexer.GetSpan();
1129 soulng::parser::Match match = ExpressionParser::Equality(lexer, moduleId, ctx);
1130 right.reset(static_cast<Node*>(match.value));
1131 if (match.hit)
1132 {
1133 *parentMatch11 = match;
1134 }
1135 else
1136 {
1137 lexer.ThrowExpectationFailure(span, U"equality expression");
1138 }
1139 }
1140 if (match.hit)
1141 {
1142 s.end = span.end;
1143 expr.reset(new BitAndNode(s, *moduleId, expr.release(), right.release()));
1144 }
1145 *parentMatch10 = match;
1146 }
1147 *parentMatch9 = match;
1148 }
1149 *parentMatch7 = match;
1150 }
1151 *parentMatch6 = match;
1152 }
1153 if (match.hit)
1154 {
1155 *parentMatch5 = match;
1156 }
1157 else
1158 {
1159 lexer.SetPos(save);
1160 break;
1161 }
1162 }
1163 }
1164 }
1165 *parentMatch4 = match;
1166 }
1167 *parentMatch2 = match;
1168 }
1169 *parentMatch1 = match;
1170 }
1171 if (match.hit)
1172 {
1173 {
1174 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1175
1176 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1177 return soulng::parser::Match(true, expr.release());
1178 }
1179 }
1180 *parentMatch0 = match;
1181 }
1182 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1183
1184
1185
1186
1187
1188 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1189 if (!match.hit)
1190 {
1191 match.value = nullptr;
1192 }
1193 return match;
1194 }
1195
1196 soulng::parser::Match ExpressionParser::Equality(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
1197 {
1198 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1199
1200
1201
1202
1203
1204
1205
1206 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1207 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
1208 Span s = Span();
1209 Operator op = Operator();
1210 std::unique_ptr<Node> left;
1211 std::unique_ptr<Node> right;
1212 soulng::parser::Match match(false);
1213 soulng::parser::Match* parentMatch0 = &match;
1214 {
1215 int64_t pos = lexer.GetPos();
1216 soulng::parser::Match match(false);
1217 soulng::parser::Match* parentMatch1 = &match;
1218 {
1219 soulng::parser::Match match(false);
1220 soulng::parser::Match* parentMatch2 = &match;
1221 {
1222 soulng::parser::Match match(false);
1223 soulng::parser::Match* parentMatch3 = &match;
1224 {
1225 int64_t pos = lexer.GetPos();
1226 soulng::lexer::Span span = lexer.GetSpan();
1227 soulng::parser::Match match = ExpressionParser::Relational(lexer, moduleId, ctx);
1228 left.reset(static_cast<Node*>(match.value));
1229 if (match.hit)
1230 {
1231 s = span;
1232 expr.reset(left.release());
1233 }
1234 *parentMatch3 = match;
1235 }
1236 *parentMatch2 = match;
1237 }
1238 if (match.hit)
1239 {
1240 soulng::parser::Match match(false);
1241 soulng::parser::Match* parentMatch4 = &match;
1242 {
1243 soulng::parser::Match match(true);
1244 soulng::parser::Match* parentMatch5 = &match;
1245 {
1246 while (true)
1247 {
1248 int64_t save = lexer.GetPos();
1249 {
1250 soulng::parser::Match match(false);
1251 soulng::parser::Match* parentMatch6 = &match;
1252 {
1253 soulng::parser::Match match(false);
1254 soulng::parser::Match* parentMatch7 = &match;
1255 {
1256 soulng::parser::Match match(false);
1257 soulng::parser::Match* parentMatch8 = &match;
1258 {
1259 soulng::parser::Match match(false);
1260 soulng::parser::Match* parentMatch9 = &match;
1261 {
1262 int64_t save = lexer.GetPos();
1263 soulng::parser::Match match(false);
1264 soulng::parser::Match* parentMatch10 = &match;
1265 {
1266 int64_t pos = lexer.GetPos();
1267 bool pass = true;
1268 soulng::parser::Match match(false);
1269 if (*lexer == EQ)
1270 {
1271 ++lexer;
1272 match.hit = true;
1273 }
1274 if (match.hit)
1275 {
1276 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
1277 else op = Operator::eq;
1278 }
1279 if (match.hit && !pass)
1280 {
1281 match = soulng::parser::Match(false);
1282 }
1283 *parentMatch10 = match;
1284 }
1285 *parentMatch9 = match;
1286 if (!match.hit)
1287 {
1288 soulng::parser::Match match(false);
1289 soulng::parser::Match* parentMatch11 = &match;
1290 lexer.SetPos(save);
1291 {
1292 soulng::parser::Match match(false);
1293 soulng::parser::Match* parentMatch12 = &match;
1294 {
1295 int64_t pos = lexer.GetPos();
1296 bool pass = true;
1297 soulng::parser::Match match(false);
1298 if (*lexer == NEQ)
1299 {
1300 ++lexer;
1301 match.hit = true;
1302 }
1303 if (match.hit)
1304 {
1305 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
1306 else op = Operator::neq;
1307 }
1308 if (match.hit && !pass)
1309 {
1310 match = soulng::parser::Match(false);
1311 }
1312 *parentMatch12 = match;
1313 }
1314 *parentMatch11 = match;
1315 }
1316 *parentMatch9 = match;
1317 }
1318 }
1319 *parentMatch8 = match;
1320 }
1321 *parentMatch7 = match;
1322 }
1323 if (match.hit)
1324 {
1325 soulng::parser::Match match(false);
1326 soulng::parser::Match* parentMatch13 = &match;
1327 {
1328 soulng::parser::Match match(false);
1329 soulng::parser::Match* parentMatch14 = &match;
1330 {
1331 int64_t pos = lexer.GetPos();
1332 soulng::lexer::Span span = lexer.GetSpan();
1333 soulng::parser::Match match(true);
1334 soulng::parser::Match* parentMatch15 = &match;
1335 {
1336 soulng::lexer::Span span = lexer.GetSpan();
1337 soulng::parser::Match match = ExpressionParser::Relational(lexer, moduleId, ctx);
1338 right.reset(static_cast<Node*>(match.value));
1339 if (match.hit)
1340 {
1341 *parentMatch15 = match;
1342 }
1343 else
1344 {
1345 lexer.ThrowExpectationFailure(span, U"relational expression");
1346 }
1347 }
1348 if (match.hit)
1349 {
1350 switch (op)
1351 {
1352 case Operator::eq: s.end = span.end;
1353 expr.reset(new EqualNode(s, *moduleId, expr.release(), right.release()));
1354 break;
1355 case Operator::neq: s.end = span.end;
1356 expr.reset(new NotEqualNode(s, *moduleId, expr.release(), right.release()));
1357 break;
1358 }
1359 }
1360 *parentMatch14 = match;
1361 }
1362 *parentMatch13 = match;
1363 }
1364 *parentMatch7 = match;
1365 }
1366 *parentMatch6 = match;
1367 }
1368 if (match.hit)
1369 {
1370 *parentMatch5 = match;
1371 }
1372 else
1373 {
1374 lexer.SetPos(save);
1375 break;
1376 }
1377 }
1378 }
1379 }
1380 *parentMatch4 = match;
1381 }
1382 *parentMatch2 = match;
1383 }
1384 *parentMatch1 = match;
1385 }
1386 if (match.hit)
1387 {
1388 {
1389 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1390
1391 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1392 return soulng::parser::Match(true, expr.release());
1393 }
1394 }
1395 *parentMatch0 = match;
1396 }
1397 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1398
1399
1400
1401
1402
1403 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1404 if (!match.hit)
1405 {
1406 match.value = nullptr;
1407 }
1408 return match;
1409 }
1410
1411 soulng::parser::Match ExpressionParser::Relational(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
1412 {
1413 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1414
1415
1416
1417
1418
1419
1420
1421 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1422 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
1423 Span s = Span();
1424 Operator op = Operator();
1425 std::unique_ptr<Node> left;
1426 std::unique_ptr<sngcm::ast::Node> isType;
1427 std::unique_ptr<sngcm::ast::Node> asType;
1428 std::unique_ptr<Node> right;
1429 soulng::parser::Match match(false);
1430 soulng::parser::Match* parentMatch0 = &match;
1431 {
1432 int64_t pos = lexer.GetPos();
1433 soulng::parser::Match match(false);
1434 soulng::parser::Match* parentMatch1 = &match;
1435 {
1436 soulng::parser::Match match(false);
1437 soulng::parser::Match* parentMatch2 = &match;
1438 {
1439 soulng::parser::Match match(false);
1440 soulng::parser::Match* parentMatch3 = &match;
1441 {
1442 int64_t pos = lexer.GetPos();
1443 soulng::lexer::Span span = lexer.GetSpan();
1444 soulng::parser::Match match = ExpressionParser::Shift(lexer, moduleId, ctx);
1445 left.reset(static_cast<Node*>(match.value));
1446 if (match.hit)
1447 {
1448 s = span;
1449 expr.reset(left.release());
1450 }
1451 *parentMatch3 = match;
1452 }
1453 *parentMatch2 = match;
1454 }
1455 if (match.hit)
1456 {
1457 soulng::parser::Match match(false);
1458 soulng::parser::Match* parentMatch4 = &match;
1459 {
1460 soulng::parser::Match match(true);
1461 soulng::parser::Match* parentMatch5 = &match;
1462 {
1463 while (true)
1464 {
1465 int64_t save = lexer.GetPos();
1466 {
1467 soulng::parser::Match match(false);
1468 soulng::parser::Match* parentMatch6 = &match;
1469 {
1470 soulng::parser::Match match(false);
1471 soulng::parser::Match* parentMatch7 = &match;
1472 {
1473 soulng::parser::Match match(false);
1474 soulng::parser::Match* parentMatch8 = &match;
1475 {
1476 soulng::parser::Match match(false);
1477 soulng::parser::Match* parentMatch9 = &match;
1478 {
1479 int64_t save = lexer.GetPos();
1480 soulng::parser::Match match(false);
1481 soulng::parser::Match* parentMatch10 = &match;
1482 {
1483 int64_t save = lexer.GetPos();
1484 soulng::parser::Match match(false);
1485 soulng::parser::Match* parentMatch11 = &match;
1486 {
1487 int64_t save = lexer.GetPos();
1488 soulng::parser::Match match(false);
1489 soulng::parser::Match* parentMatch12 = &match;
1490 {
1491 int64_t save = lexer.GetPos();
1492 soulng::parser::Match match(false);
1493 soulng::parser::Match* parentMatch13 = &match;
1494 {
1495 int64_t save = lexer.GetPos();
1496 soulng::parser::Match match(false);
1497 soulng::parser::Match* parentMatch14 = &match;
1498 {
1499 int64_t pos = lexer.GetPos();
1500 bool pass = true;
1501 soulng::parser::Match match(false);
1502 if (*lexer == LEQ)
1503 {
1504 ++lexer;
1505 match.hit = true;
1506 }
1507 if (match.hit)
1508 {
1509 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
1510 else
1511 {
1512 op = Operator::lessOrEq;
1513 ctx->PushParsingIsOrAs(false);
1514 }
1515 }
1516 if (match.hit && !pass)
1517 {
1518 match = soulng::parser::Match(false);
1519 }
1520 *parentMatch14 = match;
1521 }
1522 *parentMatch13 = match;
1523 if (!match.hit)
1524 {
1525 soulng::parser::Match match(false);
1526 soulng::parser::Match* parentMatch15 = &match;
1527 lexer.SetPos(save);
1528 {
1529 soulng::parser::Match match(false);
1530 soulng::parser::Match* parentMatch16 = &match;
1531 {
1532 int64_t pos = lexer.GetPos();
1533 bool pass = true;
1534 soulng::parser::Match match(false);
1535 if (*lexer == GEQ)
1536 {
1537 ++lexer;
1538 match.hit = true;
1539 }
1540 if (match.hit)
1541 {
1542 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
1543 else
1544 {
1545 op = Operator::greaterOrEq;
1546 ctx->PushParsingIsOrAs(false);
1547 }
1548 }
1549 if (match.hit && !pass)
1550 {
1551 match = soulng::parser::Match(false);
1552 }
1553 *parentMatch16 = match;
1554 }
1555 *parentMatch15 = match;
1556 }
1557 *parentMatch13 = match;
1558 }
1559 }
1560 *parentMatch12 = match;
1561 if (!match.hit)
1562 {
1563 soulng::parser::Match match(false);
1564 soulng::parser::Match* parentMatch17 = &match;
1565 lexer.SetPos(save);
1566 {
1567 soulng::parser::Match match(false);
1568 soulng::parser::Match* parentMatch18 = &match;
1569 {
1570 int64_t pos = lexer.GetPos();
1571 bool pass = true;
1572 soulng::parser::Match match(false);
1573 if (*lexer == LANGLE)
1574 {
1575 ++lexer;
1576 match.hit = true;
1577 }
1578 if (match.hit)
1579 {
1580 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
1581 else
1582 {
1583 op = Operator::less;
1584 ctx->PushParsingIsOrAs(false);
1585 }
1586 }
1587 if (match.hit && !pass)
1588 {
1589 match = soulng::parser::Match(false);
1590 }
1591 *parentMatch18 = match;
1592 }
1593 *parentMatch17 = match;
1594 }
1595 *parentMatch12 = match;
1596 }
1597 }
1598 *parentMatch11 = match;
1599 if (!match.hit)
1600 {
1601 soulng::parser::Match match(false);
1602 soulng::parser::Match* parentMatch19 = &match;
1603 lexer.SetPos(save);
1604 {
1605 soulng::parser::Match match(false);
1606 soulng::parser::Match* parentMatch20 = &match;
1607 {
1608 int64_t pos = lexer.GetPos();
1609 bool pass = true;
1610 soulng::parser::Match match(false);
1611 if (*lexer == RANGLE)
1612 {
1613 ++lexer;
1614 match.hit = true;
1615 }
1616 if (match.hit)
1617 {
1618 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
1619 else
1620 {
1621 op = Operator::greater;
1622 ctx->PushParsingIsOrAs(false);
1623 }
1624 }
1625 if (match.hit && !pass)
1626 {
1627 match = soulng::parser::Match(false);
1628 }
1629 *parentMatch20 = match;
1630 }
1631 *parentMatch19 = match;
1632 }
1633 *parentMatch11 = match;
1634 }
1635 }
1636 *parentMatch10 = match;
1637 if (!match.hit)
1638 {
1639 soulng::parser::Match match(false);
1640 soulng::parser::Match* parentMatch21 = &match;
1641 lexer.SetPos(save);
1642 {
1643 soulng::parser::Match match(false);
1644 soulng::parser::Match* parentMatch22 = &match;
1645 {
1646 soulng::parser::Match match(false);
1647 soulng::parser::Match* parentMatch23 = &match;
1648 {
1649 int64_t pos = lexer.GetPos();
1650 bool pass = true;
1651 soulng::parser::Match match(false);
1652 if (*lexer == IS)
1653 {
1654 ++lexer;
1655 match.hit = true;
1656 }
1657 if (match.hit)
1658 {
1659 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
1660 else
1661 {
1662 op = Operator::is;
1663 ctx->PushParsingIsOrAs(true);
1664 }
1665 }
1666 if (match.hit && !pass)
1667 {
1668 match = soulng::parser::Match(false);
1669 }
1670 *parentMatch23 = match;
1671 }
1672 *parentMatch22 = match;
1673 }
1674 if (match.hit)
1675 {
1676 soulng::parser::Match match(false);
1677 soulng::parser::Match* parentMatch24 = &match;
1678 {
1679 soulng::parser::Match match = TypeExprParser::TypeExpr(lexer, moduleId, ctx);
1680 isType.reset(static_cast<sngcm::ast::Node*>(match.value));
1681 *parentMatch24 = match;
1682 }
1683 *parentMatch22 = match;
1684 }
1685 *parentMatch21 = match;
1686 }
1687 *parentMatch10 = match;
1688 }
1689 }
1690 *parentMatch9 = match;
1691 if (!match.hit)
1692 {
1693 soulng::parser::Match match(false);
1694 soulng::parser::Match* parentMatch25 = &match;
1695 lexer.SetPos(save);
1696 {
1697 soulng::parser::Match match(false);
1698 soulng::parser::Match* parentMatch26 = &match;
1699 {
1700 soulng::parser::Match match(false);
1701 soulng::parser::Match* parentMatch27 = &match;
1702 {
1703 int64_t pos = lexer.GetPos();
1704 bool pass = true;
1705 soulng::parser::Match match(false);
1706 if (*lexer == AS)
1707 {
1708 ++lexer;
1709 match.hit = true;
1710 }
1711 if (match.hit)
1712 {
1713 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
1714 else
1715 {
1716 op = Operator::as;
1717 ctx->PushParsingIsOrAs(true);
1718 }
1719 }
1720 if (match.hit && !pass)
1721 {
1722 match = soulng::parser::Match(false);
1723 }
1724 *parentMatch27 = match;
1725 }
1726 *parentMatch26 = match;
1727 }
1728 if (match.hit)
1729 {
1730 soulng::parser::Match match(false);
1731 soulng::parser::Match* parentMatch28 = &match;
1732 {
1733 soulng::parser::Match match = TypeExprParser::TypeExpr(lexer, moduleId, ctx);
1734 asType.reset(static_cast<sngcm::ast::Node*>(match.value));
1735 *parentMatch28 = match;
1736 }
1737 *parentMatch26 = match;
1738 }
1739 *parentMatch25 = match;
1740 }
1741 *parentMatch9 = match;
1742 }
1743 }
1744 *parentMatch8 = match;
1745 }
1746 *parentMatch7 = match;
1747 }
1748 if (match.hit)
1749 {
1750 soulng::parser::Match match(false);
1751 soulng::parser::Match* parentMatch29 = &match;
1752 {
1753 soulng::parser::Match match(false);
1754 soulng::parser::Match* parentMatch30 = &match;
1755 {
1756 int64_t pos = lexer.GetPos();
1757 soulng::lexer::Span span = lexer.GetSpan();
1758 soulng::parser::Match match(false);
1759 soulng::parser::Match* parentMatch31 = &match;
1760 {
1761 soulng::parser::Match match(false);
1762 soulng::parser::Match* parentMatch32 = &match;
1763 {
1764 int64_t save = lexer.GetPos();
1765 soulng::parser::Match match = ExpressionParser::Shift(lexer, moduleId, ctx);
1766 right.reset(static_cast<Node*>(match.value));
1767 *parentMatch32 = match;
1768 if (!match.hit)
1769 {
1770 soulng::parser::Match match(false);
1771 soulng::parser::Match* parentMatch33 = &match;
1772 lexer.SetPos(save);
1773 {
1774 soulng::parser::Match match(false);
1775 soulng::parser::Match* parentMatch34 = &match;
1776 {
1777 int64_t pos = lexer.GetPos();
1778 bool pass = true;
1779 soulng::parser::Match match(true);
1780 if (match.hit)
1781 {
1782 if (!ctx->parsingIsOrAs) pass = false;
1783 }
1784 if (match.hit && !pass)
1785 {
1786 match = soulng::parser::Match(false);
1787 }
1788 *parentMatch34 = match;
1789 }
1790 *parentMatch33 = match;
1791 }
1792 *parentMatch32 = match;
1793 }
1794 }
1795 *parentMatch31 = match;
1796 }
1797 if (match.hit)
1798 {
1799 ctx->PopParsingIsOrAs();
1800 switch (op)
1801 {
1802 case Operator::lessOrEq: s.end = span.end;
1803 expr.reset(new LessOrEqualNode(s, *moduleId, expr.release(), right.release()));
1804 break;
1805 case Operator::greaterOrEq: s.end = span.end;
1806 expr.reset(new GreaterOrEqualNode(s, *moduleId, expr.release(), right.release()));
1807 break;
1808 case Operator::less: s.end = span.end;
1809 expr.reset(new LessNode(s, *moduleId, expr.release(), right.release()));
1810 break;
1811 case Operator::greater: s.end = span.end;
1812 expr.reset(new GreaterNode(s, *moduleId, expr.release(), right.release()));
1813 break;
1814 case Operator::is: s.end = span.end;
1815 expr.reset(new IsNode(s, *moduleId, expr.release(), isType.release()));
1816 break;
1817 case Operator::as: s.end = span.end;
1818 expr.reset(new AsNode(s, *moduleId, expr.release(), asType.release()));
1819 break;
1820 }
1821 }
1822 *parentMatch30 = match;
1823 }
1824 *parentMatch29 = match;
1825 }
1826 *parentMatch7 = match;
1827 }
1828 *parentMatch6 = match;
1829 }
1830 if (match.hit)
1831 {
1832 *parentMatch5 = match;
1833 }
1834 else
1835 {
1836 lexer.SetPos(save);
1837 break;
1838 }
1839 }
1840 }
1841 }
1842 *parentMatch4 = match;
1843 }
1844 *parentMatch2 = match;
1845 }
1846 *parentMatch1 = match;
1847 }
1848 if (match.hit)
1849 {
1850 {
1851 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1852
1853 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1854 return soulng::parser::Match(true, expr.release());
1855 }
1856 }
1857 *parentMatch0 = match;
1858 }
1859 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1860
1861
1862
1863
1864
1865 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1866 if (!match.hit)
1867 {
1868 match.value = nullptr;
1869 }
1870 return match;
1871 }
1872
1873 soulng::parser::Match ExpressionParser::Shift(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
1874 {
1875 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1876
1877
1878
1879
1880
1881
1882
1883 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1884 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
1885 Span s = Span();
1886 Operator op = Operator();
1887 std::unique_ptr<Node> left;
1888 std::unique_ptr<Node> right;
1889 soulng::parser::Match match(false);
1890 soulng::parser::Match* parentMatch0 = &match;
1891 {
1892 int64_t pos = lexer.GetPos();
1893 soulng::parser::Match match(false);
1894 soulng::parser::Match* parentMatch1 = &match;
1895 {
1896 soulng::parser::Match match(false);
1897 soulng::parser::Match* parentMatch2 = &match;
1898 {
1899 soulng::parser::Match match(false);
1900 soulng::parser::Match* parentMatch3 = &match;
1901 {
1902 int64_t pos = lexer.GetPos();
1903 soulng::lexer::Span span = lexer.GetSpan();
1904 soulng::parser::Match match = ExpressionParser::Additive(lexer, moduleId, ctx);
1905 left.reset(static_cast<Node*>(match.value));
1906 if (match.hit)
1907 {
1908 s = span;
1909 expr.reset(left.release());
1910 }
1911 *parentMatch3 = match;
1912 }
1913 *parentMatch2 = match;
1914 }
1915 if (match.hit)
1916 {
1917 soulng::parser::Match match(false);
1918 soulng::parser::Match* parentMatch4 = &match;
1919 {
1920 soulng::parser::Match match(true);
1921 soulng::parser::Match* parentMatch5 = &match;
1922 {
1923 while (true)
1924 {
1925 int64_t save = lexer.GetPos();
1926 {
1927 soulng::parser::Match match(false);
1928 soulng::parser::Match* parentMatch6 = &match;
1929 {
1930 soulng::parser::Match match(false);
1931 soulng::parser::Match* parentMatch7 = &match;
1932 {
1933 soulng::parser::Match match(false);
1934 soulng::parser::Match* parentMatch8 = &match;
1935 {
1936 soulng::parser::Match match(false);
1937 soulng::parser::Match* parentMatch9 = &match;
1938 {
1939 soulng::parser::Match match(false);
1940 soulng::parser::Match* parentMatch10 = &match;
1941 {
1942 int64_t save = lexer.GetPos();
1943 soulng::parser::Match match(false);
1944 soulng::parser::Match* parentMatch11 = &match;
1945 {
1946 int64_t pos = lexer.GetPos();
1947 bool pass = true;
1948 soulng::parser::Match match(false);
1949 if (*lexer == SHIFTLEFT)
1950 {
1951 ++lexer;
1952 match.hit = true;
1953 }
1954 if (match.hit)
1955 {
1956 if (ctx->parsingLvalue) pass = false;
1957 else op = Operator::shiftLeft;
1958 }
1959 if (match.hit && !pass)
1960 {
1961 match = soulng::parser::Match(false);
1962 }
1963 *parentMatch11 = match;
1964 }
1965 *parentMatch10 = match;
1966 if (!match.hit)
1967 {
1968 soulng::parser::Match match(false);
1969 soulng::parser::Match* parentMatch12 = &match;
1970 lexer.SetPos(save);
1971 {
1972 soulng::parser::Match match(false);
1973 soulng::parser::Match* parentMatch13 = &match;
1974 {
1975 int64_t pos = lexer.GetPos();
1976 bool pass = true;
1977 soulng::parser::Match match(false);
1978 if (*lexer == SHIFTRIGHT)
1979 {
1980 ++lexer;
1981 match.hit = true;
1982 }
1983 if (match.hit)
1984 {
1985 if (ctx->parsingLvalue) pass = false;
1986 else op = Operator::shiftRight;
1987 }
1988 if (match.hit && !pass)
1989 {
1990 match = soulng::parser::Match(false);
1991 }
1992 *parentMatch13 = match;
1993 }
1994 *parentMatch12 = match;
1995 }
1996 *parentMatch10 = match;
1997 }
1998 }
1999 *parentMatch9 = match;
2000 }
2001 *parentMatch8 = match;
2002 }
2003 if (match.hit)
2004 {
2005 soulng::parser::Match match(false);
2006 soulng::parser::Match* parentMatch14 = &match;
2007 {
2008 soulng::parser::Match match(false);
2009 soulng::parser::Match* parentMatch15 = &match;
2010 {
2011 int64_t pos = lexer.GetPos();
2012 soulng::parser::Match match(true);
2013 if (match.hit)
2014 {
2015 ctx->BeginParsingArguments();
2016 }
2017 *parentMatch15 = match;
2018 }
2019 *parentMatch14 = match;
2020 }
2021 *parentMatch8 = match;
2022 }
2023 *parentMatch7 = match;
2024 }
2025 if (match.hit)
2026 {
2027 soulng::parser::Match match(false);
2028 soulng::parser::Match* parentMatch16 = &match;
2029 {
2030 soulng::parser::Match match(false);
2031 soulng::parser::Match* parentMatch17 = &match;
2032 {
2033 int64_t pos = lexer.GetPos();
2034 soulng::lexer::Span span = lexer.GetSpan();
2035 soulng::parser::Match match(true);
2036 soulng::parser::Match* parentMatch18 = &match;
2037 {
2038 soulng::lexer::Span span = lexer.GetSpan();
2039 soulng::parser::Match match = ExpressionParser::Additive(lexer, moduleId, ctx);
2040 right.reset(static_cast<Node*>(match.value));
2041 if (match.hit)
2042 {
2043 *parentMatch18 = match;
2044 }
2045 else
2046 {
2047 lexer.ThrowExpectationFailure(span, U"additive expression");
2048 }
2049 }
2050 if (match.hit)
2051 {
2052 switch (op)
2053 {
2054 case Operator::shiftLeft: s.end = span.end;
2055 expr.reset(new ShiftLeftNode(s, *moduleId, expr.release(), right.release()));
2056 break;
2057 case Operator::shiftRight: s.end = span.end;
2058 expr.reset(new ShiftRightNode(s, *moduleId, expr.release(), right.release()));
2059 break;
2060 }
2061 ctx->EndParsingArguments();
2062 }
2063 else
2064 {
2065 ctx->EndParsingArguments();
2066 }
2067 *parentMatch17 = match;
2068 }
2069 *parentMatch16 = match;
2070 }
2071 *parentMatch7 = match;
2072 }
2073 *parentMatch6 = match;
2074 }
2075 if (match.hit)
2076 {
2077 *parentMatch5 = match;
2078 }
2079 else
2080 {
2081 lexer.SetPos(save);
2082 break;
2083 }
2084 }
2085 }
2086 }
2087 *parentMatch4 = match;
2088 }
2089 *parentMatch2 = match;
2090 }
2091 *parentMatch1 = match;
2092 }
2093 if (match.hit)
2094 {
2095 {
2096 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2097
2098 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2099 return soulng::parser::Match(true, expr.release());
2100 }
2101 }
2102 *parentMatch0 = match;
2103 }
2104 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2105
2106
2107
2108
2109
2110 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2111 if (!match.hit)
2112 {
2113 match.value = nullptr;
2114 }
2115 return match;
2116 }
2117
2118 soulng::parser::Match ExpressionParser::Additive(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
2119 {
2120 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2121
2122
2123
2124
2125
2126
2127
2128 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2129 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
2130 Span s = Span();
2131 Operator op = Operator();
2132 std::unique_ptr<Node> left;
2133 std::unique_ptr<Node> right;
2134 soulng::parser::Match match(false);
2135 soulng::parser::Match* parentMatch0 = &match;
2136 {
2137 int64_t pos = lexer.GetPos();
2138 soulng::parser::Match match(false);
2139 soulng::parser::Match* parentMatch1 = &match;
2140 {
2141 soulng::parser::Match match(false);
2142 soulng::parser::Match* parentMatch2 = &match;
2143 {
2144 soulng::parser::Match match(false);
2145 soulng::parser::Match* parentMatch3 = &match;
2146 {
2147 int64_t pos = lexer.GetPos();
2148 soulng::lexer::Span span = lexer.GetSpan();
2149 soulng::parser::Match match = ExpressionParser::Multiplicative(lexer, moduleId, ctx);
2150 left.reset(static_cast<Node*>(match.value));
2151 if (match.hit)
2152 {
2153 s = span;
2154 expr.reset(left.release());
2155 }
2156 *parentMatch3 = match;
2157 }
2158 *parentMatch2 = match;
2159 }
2160 if (match.hit)
2161 {
2162 soulng::parser::Match match(false);
2163 soulng::parser::Match* parentMatch4 = &match;
2164 {
2165 soulng::parser::Match match(true);
2166 soulng::parser::Match* parentMatch5 = &match;
2167 {
2168 while (true)
2169 {
2170 int64_t save = lexer.GetPos();
2171 {
2172 soulng::parser::Match match(false);
2173 soulng::parser::Match* parentMatch6 = &match;
2174 {
2175 soulng::parser::Match match(false);
2176 soulng::parser::Match* parentMatch7 = &match;
2177 {
2178 soulng::parser::Match match(false);
2179 soulng::parser::Match* parentMatch8 = &match;
2180 {
2181 soulng::parser::Match match(false);
2182 soulng::parser::Match* parentMatch9 = &match;
2183 {
2184 int64_t save = lexer.GetPos();
2185 soulng::parser::Match match(false);
2186 soulng::parser::Match* parentMatch10 = &match;
2187 {
2188 int64_t pos = lexer.GetPos();
2189 bool pass = true;
2190 soulng::parser::Match match(false);
2191 if (*lexer == PLUS)
2192 {
2193 ++lexer;
2194 match.hit = true;
2195 }
2196 if (match.hit)
2197 {
2198 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
2199 else op = Operator::plus;
2200 }
2201 if (match.hit && !pass)
2202 {
2203 match = soulng::parser::Match(false);
2204 }
2205 *parentMatch10 = match;
2206 }
2207 *parentMatch9 = match;
2208 if (!match.hit)
2209 {
2210 soulng::parser::Match match(false);
2211 soulng::parser::Match* parentMatch11 = &match;
2212 lexer.SetPos(save);
2213 {
2214 soulng::parser::Match match(false);
2215 soulng::parser::Match* parentMatch12 = &match;
2216 {
2217 int64_t pos = lexer.GetPos();
2218 bool pass = true;
2219 soulng::parser::Match match(false);
2220 if (*lexer == MINUS)
2221 {
2222 ++lexer;
2223 match.hit = true;
2224 }
2225 if (match.hit)
2226 {
2227 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
2228 else op = Operator::minus;
2229 }
2230 if (match.hit && !pass)
2231 {
2232 match = soulng::parser::Match(false);
2233 }
2234 *parentMatch12 = match;
2235 }
2236 *parentMatch11 = match;
2237 }
2238 *parentMatch9 = match;
2239 }
2240 }
2241 *parentMatch8 = match;
2242 }
2243 *parentMatch7 = match;
2244 }
2245 if (match.hit)
2246 {
2247 soulng::parser::Match match(false);
2248 soulng::parser::Match* parentMatch13 = &match;
2249 {
2250 soulng::parser::Match match(false);
2251 soulng::parser::Match* parentMatch14 = &match;
2252 {
2253 int64_t pos = lexer.GetPos();
2254 soulng::lexer::Span span = lexer.GetSpan();
2255 soulng::parser::Match match(true);
2256 soulng::parser::Match* parentMatch15 = &match;
2257 {
2258 soulng::lexer::Span span = lexer.GetSpan();
2259 soulng::parser::Match match = ExpressionParser::Multiplicative(lexer, moduleId, ctx);
2260 right.reset(static_cast<Node*>(match.value));
2261 if (match.hit)
2262 {
2263 *parentMatch15 = match;
2264 }
2265 else
2266 {
2267 lexer.ThrowExpectationFailure(span, U"multiplicative expression");
2268 }
2269 }
2270 if (match.hit)
2271 {
2272 switch (op)
2273 {
2274 case Operator::plus: s.end = span.end;
2275 expr.reset(new AddNode(s, *moduleId, expr.release(), right.release()));
2276 break;
2277 case Operator::minus: s.end = span.end;
2278 expr.reset(new SubNode(s, *moduleId, expr.release(), right.release()));
2279 break;
2280 }
2281 }
2282 *parentMatch14 = match;
2283 }
2284 *parentMatch13 = match;
2285 }
2286 *parentMatch7 = match;
2287 }
2288 *parentMatch6 = match;
2289 }
2290 if (match.hit)
2291 {
2292 *parentMatch5 = match;
2293 }
2294 else
2295 {
2296 lexer.SetPos(save);
2297 break;
2298 }
2299 }
2300 }
2301 }
2302 *parentMatch4 = match;
2303 }
2304 *parentMatch2 = match;
2305 }
2306 *parentMatch1 = match;
2307 }
2308 if (match.hit)
2309 {
2310 {
2311 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2312
2313 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2314 return soulng::parser::Match(true, expr.release());
2315 }
2316 }
2317 *parentMatch0 = match;
2318 }
2319 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2320
2321
2322
2323
2324
2325 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2326 if (!match.hit)
2327 {
2328 match.value = nullptr;
2329 }
2330 return match;
2331 }
2332
2333 soulng::parser::Match ExpressionParser::Multiplicative(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
2334 {
2335 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2336
2337
2338
2339
2340
2341
2342
2343 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2344 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
2345 Span s = Span();
2346 Operator op = Operator();
2347 std::unique_ptr<Node> left;
2348 std::unique_ptr<Node> right;
2349 soulng::parser::Match match(false);
2350 soulng::parser::Match* parentMatch0 = &match;
2351 {
2352 int64_t pos = lexer.GetPos();
2353 soulng::parser::Match match(false);
2354 soulng::parser::Match* parentMatch1 = &match;
2355 {
2356 soulng::parser::Match match(false);
2357 soulng::parser::Match* parentMatch2 = &match;
2358 {
2359 soulng::parser::Match match(false);
2360 soulng::parser::Match* parentMatch3 = &match;
2361 {
2362 int64_t pos = lexer.GetPos();
2363 soulng::lexer::Span span = lexer.GetSpan();
2364 soulng::parser::Match match = ExpressionParser::Prefix(lexer, moduleId, ctx);
2365 left.reset(static_cast<Node*>(match.value));
2366 if (match.hit)
2367 {
2368 s = span;
2369 expr.reset(left.release());
2370 }
2371 *parentMatch3 = match;
2372 }
2373 *parentMatch2 = match;
2374 }
2375 if (match.hit)
2376 {
2377 soulng::parser::Match match(false);
2378 soulng::parser::Match* parentMatch4 = &match;
2379 {
2380 soulng::parser::Match match(true);
2381 soulng::parser::Match* parentMatch5 = &match;
2382 {
2383 while (true)
2384 {
2385 int64_t save = lexer.GetPos();
2386 {
2387 soulng::parser::Match match(false);
2388 soulng::parser::Match* parentMatch6 = &match;
2389 {
2390 soulng::parser::Match match(false);
2391 soulng::parser::Match* parentMatch7 = &match;
2392 {
2393 soulng::parser::Match match(false);
2394 soulng::parser::Match* parentMatch8 = &match;
2395 {
2396 soulng::parser::Match match(false);
2397 soulng::parser::Match* parentMatch9 = &match;
2398 {
2399 int64_t save = lexer.GetPos();
2400 soulng::parser::Match match(false);
2401 soulng::parser::Match* parentMatch10 = &match;
2402 {
2403 int64_t save = lexer.GetPos();
2404 soulng::parser::Match match(false);
2405 soulng::parser::Match* parentMatch11 = &match;
2406 {
2407 int64_t pos = lexer.GetPos();
2408 bool pass = true;
2409 soulng::parser::Match match(false);
2410 if (*lexer == STAR)
2411 {
2412 ++lexer;
2413 match.hit = true;
2414 }
2415 if (match.hit)
2416 {
2417 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
2418 else op = Operator::mul;
2419 }
2420 if (match.hit && !pass)
2421 {
2422 match = soulng::parser::Match(false);
2423 }
2424 *parentMatch11 = match;
2425 }
2426 *parentMatch10 = match;
2427 if (!match.hit)
2428 {
2429 soulng::parser::Match match(false);
2430 soulng::parser::Match* parentMatch12 = &match;
2431 lexer.SetPos(save);
2432 {
2433 soulng::parser::Match match(false);
2434 soulng::parser::Match* parentMatch13 = &match;
2435 {
2436 int64_t pos = lexer.GetPos();
2437 bool pass = true;
2438 soulng::parser::Match match(false);
2439 if (*lexer == DIV)
2440 {
2441 ++lexer;
2442 match.hit = true;
2443 }
2444 if (match.hit)
2445 {
2446 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
2447 else op = Operator::div;
2448 }
2449 if (match.hit && !pass)
2450 {
2451 match = soulng::parser::Match(false);
2452 }
2453 *parentMatch13 = match;
2454 }
2455 *parentMatch12 = match;
2456 }
2457 *parentMatch10 = match;
2458 }
2459 }
2460 *parentMatch9 = match;
2461 if (!match.hit)
2462 {
2463 soulng::parser::Match match(false);
2464 soulng::parser::Match* parentMatch14 = &match;
2465 lexer.SetPos(save);
2466 {
2467 soulng::parser::Match match(false);
2468 soulng::parser::Match* parentMatch15 = &match;
2469 {
2470 int64_t pos = lexer.GetPos();
2471 bool pass = true;
2472 soulng::parser::Match match(false);
2473 if (*lexer == REM)
2474 {
2475 ++lexer;
2476 match.hit = true;
2477 }
2478 if (match.hit)
2479 {
2480 if (ctx->parsingLvalue || ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
2481 else op = Operator::rem;
2482 }
2483 if (match.hit && !pass)
2484 {
2485 match = soulng::parser::Match(false);
2486 }
2487 *parentMatch15 = match;
2488 }
2489 *parentMatch14 = match;
2490 }
2491 *parentMatch9 = match;
2492 }
2493 }
2494 *parentMatch8 = match;
2495 }
2496 *parentMatch7 = match;
2497 }
2498 if (match.hit)
2499 {
2500 soulng::parser::Match match(false);
2501 soulng::parser::Match* parentMatch16 = &match;
2502 {
2503 soulng::parser::Match match(false);
2504 soulng::parser::Match* parentMatch17 = &match;
2505 {
2506 int64_t pos = lexer.GetPos();
2507 soulng::lexer::Span span = lexer.GetSpan();
2508 soulng::parser::Match match(true);
2509 soulng::parser::Match* parentMatch18 = &match;
2510 {
2511 soulng::lexer::Span span = lexer.GetSpan();
2512 soulng::parser::Match match = ExpressionParser::Prefix(lexer, moduleId, ctx);
2513 right.reset(static_cast<Node*>(match.value));
2514 if (match.hit)
2515 {
2516 *parentMatch18 = match;
2517 }
2518 else
2519 {
2520 lexer.ThrowExpectationFailure(span, U"prefix expression");
2521 }
2522 }
2523 if (match.hit)
2524 {
2525 switch (op)
2526 {
2527 case Operator::mul: s.end = span.end;
2528 expr.reset(new MulNode(s, *moduleId, expr.release(), right.release()));
2529 break;
2530 case Operator::div: s.end = span.end;
2531 expr.reset(new DivNode(s, *moduleId, expr.release(), right.release()));
2532 break;
2533 case Operator::rem: s.end = span.end;
2534 expr.reset(new RemNode(s, *moduleId, expr.release(), right.release()));
2535 break;
2536 }
2537 }
2538 *parentMatch17 = match;
2539 }
2540 *parentMatch16 = match;
2541 }
2542 *parentMatch7 = match;
2543 }
2544 *parentMatch6 = match;
2545 }
2546 if (match.hit)
2547 {
2548 *parentMatch5 = match;
2549 }
2550 else
2551 {
2552 lexer.SetPos(save);
2553 break;
2554 }
2555 }
2556 }
2557 }
2558 *parentMatch4 = match;
2559 }
2560 *parentMatch2 = match;
2561 }
2562 *parentMatch1 = match;
2563 }
2564 if (match.hit)
2565 {
2566 {
2567 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2568
2569 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2570 return soulng::parser::Match(true, expr.release());
2571 }
2572 }
2573 *parentMatch0 = match;
2574 }
2575 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2576
2577
2578
2579
2580
2581 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2582 if (!match.hit)
2583 {
2584 match.value = nullptr;
2585 }
2586 return match;
2587 }
2588
2589 soulng::parser::Match ExpressionParser::Prefix(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
2590 {
2591 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2592
2593
2594
2595
2596
2597
2598
2599 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2600 std::unique_ptr<Node> prefix = std::unique_ptr<Node>();
2601 Span s = Span();
2602 Operator op = Operator();
2603 std::unique_ptr<Node> p;
2604 std::unique_ptr<Node> postfix;
2605 soulng::parser::Match match(false);
2606 soulng::parser::Match* parentMatch0 = &match;
2607 {
2608 soulng::parser::Match match(false);
2609 soulng::parser::Match* parentMatch1 = &match;
2610 {
2611 int64_t save = lexer.GetPos();
2612 soulng::parser::Match match(false);
2613 soulng::parser::Match* parentMatch2 = &match;
2614 {
2615 soulng::parser::Match match(false);
2616 soulng::parser::Match* parentMatch3 = &match;
2617 {
2618 soulng::parser::Match match(false);
2619 soulng::parser::Match* parentMatch4 = &match;
2620 {
2621 int64_t save = lexer.GetPos();
2622 soulng::parser::Match match(false);
2623 soulng::parser::Match* parentMatch5 = &match;
2624 {
2625 int64_t save = lexer.GetPos();
2626 soulng::parser::Match match(false);
2627 soulng::parser::Match* parentMatch6 = &match;
2628 {
2629 int64_t save = lexer.GetPos();
2630 soulng::parser::Match match(false);
2631 soulng::parser::Match* parentMatch7 = &match;
2632 {
2633 int64_t save = lexer.GetPos();
2634 soulng::parser::Match match(false);
2635 soulng::parser::Match* parentMatch8 = &match;
2636 {
2637 int64_t save = lexer.GetPos();
2638 soulng::parser::Match match(false);
2639 soulng::parser::Match* parentMatch9 = &match;
2640 {
2641 int64_t save = lexer.GetPos();
2642 soulng::parser::Match match(false);
2643 soulng::parser::Match* parentMatch10 = &match;
2644 {
2645 int64_t save = lexer.GetPos();
2646 soulng::parser::Match match(false);
2647 soulng::parser::Match* parentMatch11 = &match;
2648 {
2649 int64_t pos = lexer.GetPos();
2650 soulng::lexer::Span span = lexer.GetSpan();
2651 soulng::parser::Match match(false);
2652 if (*lexer == PLUSPLUS)
2653 {
2654 ++lexer;
2655 match.hit = true;
2656 }
2657 if (match.hit)
2658 {
2659 s = span;
2660 op = Operator::plusplus;
2661 }
2662 *parentMatch11 = match;
2663 }
2664 *parentMatch10 = match;
2665 if (!match.hit)
2666 {
2667 soulng::parser::Match match(false);
2668 soulng::parser::Match* parentMatch12 = &match;
2669 lexer.SetPos(save);
2670 {
2671 soulng::parser::Match match(false);
2672 soulng::parser::Match* parentMatch13 = &match;
2673 {
2674 int64_t pos = lexer.GetPos();
2675 soulng::lexer::Span span = lexer.GetSpan();
2676 soulng::parser::Match match(false);
2677 if (*lexer == MINUSMINUS)
2678 {
2679 ++lexer;
2680 match.hit = true;
2681 }
2682 if (match.hit)
2683 {
2684 s = span;
2685 op = Operator::minusminus;
2686 }
2687 *parentMatch13 = match;
2688 }
2689 *parentMatch12 = match;
2690 }
2691 *parentMatch10 = match;
2692 }
2693 }
2694 *parentMatch9 = match;
2695 if (!match.hit)
2696 {
2697 soulng::parser::Match match(false);
2698 soulng::parser::Match* parentMatch14 = &match;
2699 lexer.SetPos(save);
2700 {
2701 soulng::parser::Match match(false);
2702 soulng::parser::Match* parentMatch15 = &match;
2703 {
2704 int64_t pos = lexer.GetPos();
2705 soulng::lexer::Span span = lexer.GetSpan();
2706 bool pass = true;
2707 soulng::parser::Match match(false);
2708 if (*lexer == PLUS)
2709 {
2710 ++lexer;
2711 match.hit = true;
2712 }
2713 if (match.hit)
2714 {
2715 if (ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
2716 else
2717 {
2718 s = span;
2719 op = Operator::plus;
2720 }
2721 }
2722 if (match.hit && !pass)
2723 {
2724 match = soulng::parser::Match(false);
2725 }
2726 *parentMatch15 = match;
2727 }
2728 *parentMatch14 = match;
2729 }
2730 *parentMatch9 = match;
2731 }
2732 }
2733 *parentMatch8 = match;
2734 if (!match.hit)
2735 {
2736 soulng::parser::Match match(false);
2737 soulng::parser::Match* parentMatch16 = &match;
2738 lexer.SetPos(save);
2739 {
2740 soulng::parser::Match match(false);
2741 soulng::parser::Match* parentMatch17 = &match;
2742 {
2743 int64_t pos = lexer.GetPos();
2744 soulng::lexer::Span span = lexer.GetSpan();
2745 bool pass = true;
2746 soulng::parser::Match match(false);
2747 if (*lexer == MINUS)
2748 {
2749 ++lexer;
2750 match.hit = true;
2751 }
2752 if (match.hit)
2753 {
2754 if (ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
2755 else
2756 {
2757 s = span;
2758 op = Operator::minus;
2759 }
2760 }
2761 if (match.hit && !pass)
2762 {
2763 match = soulng::parser::Match(false);
2764 }
2765 *parentMatch17 = match;
2766 }
2767 *parentMatch16 = match;
2768 }
2769 *parentMatch8 = match;
2770 }
2771 }
2772 *parentMatch7 = match;
2773 if (!match.hit)
2774 {
2775 soulng::parser::Match match(false);
2776 soulng::parser::Match* parentMatch18 = &match;
2777 lexer.SetPos(save);
2778 {
2779 soulng::parser::Match match(false);
2780 soulng::parser::Match* parentMatch19 = &match;
2781 {
2782 int64_t pos = lexer.GetPos();
2783 soulng::lexer::Span span = lexer.GetSpan();
2784 bool pass = true;
2785 soulng::parser::Match match(false);
2786 if (*lexer == EXCLAMATION)
2787 {
2788 ++lexer;
2789 match.hit = true;
2790 }
2791 if (match.hit)
2792 {
2793 if (ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
2794 else
2795 {
2796 s = span;
2797 op = Operator::not_;
2798 }
2799 }
2800 if (match.hit && !pass)
2801 {
2802 match = soulng::parser::Match(false);
2803 }
2804 *parentMatch19 = match;
2805 }
2806 *parentMatch18 = match;
2807 }
2808 *parentMatch7 = match;
2809 }
2810 }
2811 *parentMatch6 = match;
2812 if (!match.hit)
2813 {
2814 soulng::parser::Match match(false);
2815 soulng::parser::Match* parentMatch20 = &match;
2816 lexer.SetPos(save);
2817 {
2818 soulng::parser::Match match(false);
2819 soulng::parser::Match* parentMatch21 = &match;
2820 {
2821 int64_t pos = lexer.GetPos();
2822 soulng::lexer::Span span = lexer.GetSpan();
2823 bool pass = true;
2824 soulng::parser::Match match(false);
2825 if (*lexer == CPL)
2826 {
2827 ++lexer;
2828 match.hit = true;
2829 }
2830 if (match.hit)
2831 {
2832 if (ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
2833 else
2834 {
2835 s = span;
2836 op = Operator::complement;
2837 }
2838 }
2839 if (match.hit && !pass)
2840 {
2841 match = soulng::parser::Match(false);
2842 }
2843 *parentMatch21 = match;
2844 }
2845 *parentMatch20 = match;
2846 }
2847 *parentMatch6 = match;
2848 }
2849 }
2850 *parentMatch5 = match;
2851 if (!match.hit)
2852 {
2853 soulng::parser::Match match(false);
2854 soulng::parser::Match* parentMatch22 = &match;
2855 lexer.SetPos(save);
2856 {
2857 soulng::parser::Match match(false);
2858 soulng::parser::Match* parentMatch23 = &match;
2859 {
2860 int64_t pos = lexer.GetPos();
2861 soulng::lexer::Span span = lexer.GetSpan();
2862 bool pass = true;
2863 soulng::parser::Match match(false);
2864 if (*lexer == STAR)
2865 {
2866 ++lexer;
2867 match.hit = true;
2868 }
2869 if (match.hit)
2870 {
2871 if (ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
2872 else
2873 {
2874 s = span;
2875 op = Operator::deref;
2876 }
2877 }
2878 if (match.hit && !pass)
2879 {
2880 match = soulng::parser::Match(false);
2881 }
2882 *parentMatch23 = match;
2883 }
2884 *parentMatch22 = match;
2885 }
2886 *parentMatch5 = match;
2887 }
2888 }
2889 *parentMatch4 = match;
2890 if (!match.hit)
2891 {
2892 soulng::parser::Match match(false);
2893 soulng::parser::Match* parentMatch24 = &match;
2894 lexer.SetPos(save);
2895 {
2896 soulng::parser::Match match(false);
2897 soulng::parser::Match* parentMatch25 = &match;
2898 {
2899 int64_t pos = lexer.GetPos();
2900 soulng::lexer::Span span = lexer.GetSpan();
2901 bool pass = true;
2902 soulng::parser::Match match(false);
2903 if (*lexer == AMP)
2904 {
2905 ++lexer;
2906 match.hit = true;
2907 }
2908 if (match.hit)
2909 {
2910 if (ctx->parsingExpressionStatement && !ctx->parsingArguments) pass = false;
2911 else
2912 {
2913 s = span;
2914 op = Operator::addrOf;
2915 }
2916 }
2917 if (match.hit && !pass)
2918 {
2919 match = soulng::parser::Match(false);
2920 }
2921 *parentMatch25 = match;
2922 }
2923 *parentMatch24 = match;
2924 }
2925 *parentMatch4 = match;
2926 }
2927 }
2928 *parentMatch3 = match;
2929 }
2930 *parentMatch2 = match;
2931 }
2932 if (match.hit)
2933 {
2934 soulng::parser::Match match(false);
2935 soulng::parser::Match* parentMatch26 = &match;
2936 {
2937 soulng::parser::Match match(false);
2938 soulng::parser::Match* parentMatch27 = &match;
2939 {
2940 int64_t pos = lexer.GetPos();
2941 soulng::lexer::Span span = lexer.GetSpan();
2942 soulng::parser::Match match = ExpressionParser::Prefix(lexer, moduleId, ctx);
2943 p.reset(static_cast<Node*>(match.value));
2944 if (match.hit)
2945 {
2946 prefix.reset(p.release());
2947 s.end = span.end;
2948 switch (op)
2949 {
2950 case Operator::plusplus: {
2951 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2952
2953 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2954 return soulng::parser::Match(true, new PrefixIncrementNode(s, *moduleId, prefix.release()));
2955 }
2956 case Operator::minusminus: {
2957 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2958
2959 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2960 return soulng::parser::Match(true, new PrefixDecrementNode(s, *moduleId, prefix.release()));
2961 }
2962 case Operator::plus: {
2963 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2964
2965 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2966 return soulng::parser::Match(true, new UnaryPlusNode(s, *moduleId, prefix.release()));
2967 }
2968 case Operator::minus: {
2969 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2970
2971 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2972 return soulng::parser::Match(true, new UnaryMinusNode(s, *moduleId, prefix.release()));
2973 }
2974 case Operator::not_: {
2975 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2976
2977 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2978 return soulng::parser::Match(true, new NotNode(s, *moduleId, prefix.release()));
2979 }
2980 case Operator::complement: {
2981 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2982
2983 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2984 return soulng::parser::Match(true, new ComplementNode(s, *moduleId, prefix.release()));
2985 }
2986 case Operator::deref: {
2987 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2988
2989 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2990 return soulng::parser::Match(true, new DerefNode(s, *moduleId, prefix.release()));
2991 }
2992 case Operator::addrOf: {
2993 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
2994
2995 #endif // SOULNG_PARSER_DEBUG_SUPPORT
2996 return soulng::parser::Match(true, new AddrOfNode(s, *moduleId, prefix.release()));
2997 }
2998 }
2999 }
3000 *parentMatch27 = match;
3001 }
3002 *parentMatch26 = match;
3003 }
3004 *parentMatch2 = match;
3005 }
3006 *parentMatch1 = match;
3007 if (!match.hit)
3008 {
3009 soulng::parser::Match match(false);
3010 soulng::parser::Match* parentMatch28 = &match;
3011 lexer.SetPos(save);
3012 {
3013 soulng::parser::Match match(false);
3014 soulng::parser::Match* parentMatch29 = &match;
3015 {
3016 int64_t pos = lexer.GetPos();
3017 soulng::parser::Match match = ExpressionParser::Postfix(lexer, moduleId, ctx);
3018 postfix.reset(static_cast<Node*>(match.value));
3019 if (match.hit)
3020 {
3021 {
3022 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3023
3024 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3025 return soulng::parser::Match(true, postfix.release());
3026 }
3027 }
3028 *parentMatch29 = match;
3029 }
3030 *parentMatch28 = match;
3031 }
3032 *parentMatch1 = match;
3033 }
3034 }
3035 *parentMatch0 = match;
3036 }
3037 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3038
3039
3040
3041
3042
3043 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3044 if (!match.hit)
3045 {
3046 match.value = nullptr;
3047 }
3048 return match;
3049 }
3050
3051 soulng::parser::Match ExpressionParser::Postfix(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
3052 {
3053 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3054
3055
3056
3057
3058
3059
3060
3061 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3062 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
3063 Span s = Span();
3064 std::unique_ptr<Node> primary;
3065 std::unique_ptr<IdentifierNode> dotMember;
3066 std::unique_ptr<IdentifierNode> arrowMember;
3067 std::unique_ptr<Node> index;
3068 soulng::parser::Match match(false);
3069 soulng::parser::Match* parentMatch0 = &match;
3070 {
3071 int64_t pos = lexer.GetPos();
3072 soulng::parser::Match match(false);
3073 soulng::parser::Match* parentMatch1 = &match;
3074 {
3075 soulng::parser::Match match(false);
3076 soulng::parser::Match* parentMatch2 = &match;
3077 {
3078 soulng::parser::Match match(false);
3079 soulng::parser::Match* parentMatch3 = &match;
3080 {
3081 int64_t pos = lexer.GetPos();
3082 soulng::lexer::Span span = lexer.GetSpan();
3083 soulng::parser::Match match = ExpressionParser::Primary(lexer, moduleId, ctx);
3084 primary.reset(static_cast<Node*>(match.value));
3085 if (match.hit)
3086 {
3087 s = span;
3088 expr.reset(primary.release());
3089 }
3090 *parentMatch3 = match;
3091 }
3092 *parentMatch2 = match;
3093 }
3094 if (match.hit)
3095 {
3096 soulng::parser::Match match(false);
3097 soulng::parser::Match* parentMatch4 = &match;
3098 {
3099 soulng::parser::Match match(true);
3100 soulng::parser::Match* parentMatch5 = &match;
3101 {
3102 while (true)
3103 {
3104 int64_t save = lexer.GetPos();
3105 {
3106 soulng::parser::Match match(false);
3107 soulng::parser::Match* parentMatch6 = &match;
3108 {
3109 soulng::parser::Match match(false);
3110 soulng::parser::Match* parentMatch7 = &match;
3111 {
3112 int64_t save = lexer.GetPos();
3113 soulng::parser::Match match(false);
3114 soulng::parser::Match* parentMatch8 = &match;
3115 {
3116 int64_t save = lexer.GetPos();
3117 soulng::parser::Match match(false);
3118 soulng::parser::Match* parentMatch9 = &match;
3119 {
3120 int64_t save = lexer.GetPos();
3121 soulng::parser::Match match(false);
3122 soulng::parser::Match* parentMatch10 = &match;
3123 {
3124 int64_t save = lexer.GetPos();
3125 soulng::parser::Match match(false);
3126 soulng::parser::Match* parentMatch11 = &match;
3127 {
3128 int64_t save = lexer.GetPos();
3129 soulng::parser::Match match(false);
3130 soulng::parser::Match* parentMatch12 = &match;
3131 {
3132 int64_t pos = lexer.GetPos();
3133 soulng::lexer::Span span = lexer.GetSpan();
3134 soulng::parser::Match match(false);
3135 if (*lexer == PLUSPLUS)
3136 {
3137 ++lexer;
3138 match.hit = true;
3139 }
3140 if (match.hit)
3141 {
3142 s.end = span.end;
3143 expr.reset(new PostfixIncrementNode(s, *moduleId, expr.release()));
3144 }
3145 *parentMatch12 = match;
3146 }
3147 *parentMatch11 = match;
3148 if (!match.hit)
3149 {
3150 soulng::parser::Match match(false);
3151 soulng::parser::Match* parentMatch13 = &match;
3152 lexer.SetPos(save);
3153 {
3154 soulng::parser::Match match(false);
3155 soulng::parser::Match* parentMatch14 = &match;
3156 {
3157 int64_t pos = lexer.GetPos();
3158 soulng::lexer::Span span = lexer.GetSpan();
3159 soulng::parser::Match match(false);
3160 if (*lexer == MINUSMINUS)
3161 {
3162 ++lexer;
3163 match.hit = true;
3164 }
3165 if (match.hit)
3166 {
3167 s.end = span.end;
3168 expr.reset(new PostfixDecrementNode(s, *moduleId, expr.release()));
3169 }
3170 *parentMatch14 = match;
3171 }
3172 *parentMatch13 = match;
3173 }
3174 *parentMatch11 = match;
3175 }
3176 }
3177 *parentMatch10 = match;
3178 if (!match.hit)
3179 {
3180 soulng::parser::Match match(false);
3181 soulng::parser::Match* parentMatch15 = &match;
3182 lexer.SetPos(save);
3183 {
3184 soulng::parser::Match match(false);
3185 soulng::parser::Match* parentMatch16 = &match;
3186 {
3187 soulng::parser::Match match(false);
3188 if (*lexer == DOT)
3189 {
3190 ++lexer;
3191 match.hit = true;
3192 }
3193 *parentMatch16 = match;
3194 }
3195 if (match.hit)
3196 {
3197 soulng::parser::Match match(false);
3198 soulng::parser::Match* parentMatch17 = &match;
3199 {
3200 soulng::parser::Match match(false);
3201 soulng::parser::Match* parentMatch18 = &match;
3202 {
3203 int64_t pos = lexer.GetPos();
3204 soulng::lexer::Span span = lexer.GetSpan();
3205 soulng::parser::Match match = IdentifierParser::Identifier(lexer, moduleId);
3206 dotMember.reset(static_cast<IdentifierNode*>(match.value));
3207 if (match.hit)
3208 {
3209 s.end = span.end;
3210 expr.reset(new DotNode(s, *moduleId, expr.release(), dotMember.release()));
3211 }
3212 *parentMatch18 = match;
3213 }
3214 *parentMatch17 = match;
3215 }
3216 *parentMatch16 = match;
3217 }
3218 *parentMatch15 = match;
3219 }
3220 *parentMatch10 = match;
3221 }
3222 }
3223 *parentMatch9 = match;
3224 if (!match.hit)
3225 {
3226 soulng::parser::Match match(false);
3227 soulng::parser::Match* parentMatch19 = &match;
3228 lexer.SetPos(save);
3229 {
3230 soulng::parser::Match match(false);
3231 soulng::parser::Match* parentMatch20 = &match;
3232 {
3233 soulng::parser::Match match(false);
3234 if (*lexer == ARROW)
3235 {
3236 ++lexer;
3237 match.hit = true;
3238 }
3239 *parentMatch20 = match;
3240 }
3241 if (match.hit)
3242 {
3243 soulng::parser::Match match(false);
3244 soulng::parser::Match* parentMatch21 = &match;
3245 {
3246 soulng::parser::Match match(false);
3247 soulng::parser::Match* parentMatch22 = &match;
3248 {
3249 int64_t pos = lexer.GetPos();
3250 soulng::lexer::Span span = lexer.GetSpan();
3251 soulng::parser::Match match = IdentifierParser::Identifier(lexer, moduleId);
3252 arrowMember.reset(static_cast<IdentifierNode*>(match.value));
3253 if (match.hit)
3254 {
3255 s.end = span.end;
3256 expr.reset(new ArrowNode(s, *moduleId, expr.release(), arrowMember.release()));
3257 }
3258 *parentMatch22 = match;
3259 }
3260 *parentMatch21 = match;
3261 }
3262 *parentMatch20 = match;
3263 }
3264 *parentMatch19 = match;
3265 }
3266 *parentMatch9 = match;
3267 }
3268 }
3269 *parentMatch8 = match;
3270 if (!match.hit)
3271 {
3272 soulng::parser::Match match(false);
3273 soulng::parser::Match* parentMatch23 = &match;
3274 lexer.SetPos(save);
3275 {
3276 soulng::parser::Match match(false);
3277 soulng::parser::Match* parentMatch24 = &match;
3278 {
3279 soulng::parser::Match match(false);
3280 soulng::parser::Match* parentMatch25 = &match;
3281 {
3282 soulng::parser::Match match(false);
3283 soulng::parser::Match* parentMatch26 = &match;
3284 {
3285 int64_t pos = lexer.GetPos();
3286 soulng::parser::Match match(false);
3287 if (*lexer == LBRACKET)
3288 {
3289 ++lexer;
3290 match.hit = true;
3291 }
3292 if (match.hit)
3293 {
3294 ctx->PushParsingLvalue(false);
3295 ctx->PushParsingExpressionStatement(false);
3296 }
3297 *parentMatch26 = match;
3298 }
3299 *parentMatch25 = match;
3300 }
3301 if (match.hit)
3302 {
3303 soulng::parser::Match match(false);
3304 soulng::parser::Match* parentMatch27 = &match;
3305 {
3306 soulng::parser::Match match(false);
3307 soulng::parser::Match* parentMatch28 = &match;
3308 {
3309 int64_t pos = lexer.GetPos();
3310 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
3311 index.reset(static_cast<Node*>(match.value));
3312 if (match.hit)
3313 {
3314 ctx->PopParsingExpressionStatement();
3315 ctx->PopParsingLvalue();
3316 }
3317 *parentMatch28 = match;
3318 }
3319 *parentMatch27 = match;
3320 }
3321 *parentMatch25 = match;
3322 }
3323 *parentMatch24 = match;
3324 }
3325 if (match.hit)
3326 {
3327 soulng::parser::Match match(false);
3328 soulng::parser::Match* parentMatch29 = &match;
3329 {
3330 soulng::parser::Match match(false);
3331 soulng::parser::Match* parentMatch30 = &match;
3332 {
3333 int64_t pos = lexer.GetPos();
3334 soulng::lexer::Span span = lexer.GetSpan();
3335 soulng::parser::Match match(true);
3336 soulng::parser::Match* parentMatch31 = &match;
3337 {
3338 soulng::lexer::Span span = lexer.GetSpan();
3339 soulng::parser::Match match(false);
3340 if (*lexer == RBRACKET)
3341 {
3342 ++lexer;
3343 match.hit = true;
3344 }
3345 if (match.hit)
3346 {
3347 *parentMatch31 = match;
3348 }
3349 else
3350 {
3351 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RBRACKET)));
3352 }
3353 }
3354 if (match.hit)
3355 {
3356 s.end = span.end;
3357 expr.reset(new IndexingNode(s, *moduleId, expr.release(), index.release()));
3358 }
3359 *parentMatch30 = match;
3360 }
3361 *parentMatch29 = match;
3362 }
3363 *parentMatch24 = match;
3364 }
3365 *parentMatch23 = match;
3366 }
3367 *parentMatch8 = match;
3368 }
3369 }
3370 *parentMatch7 = match;
3371 if (!match.hit)
3372 {
3373 soulng::parser::Match match(false);
3374 soulng::parser::Match* parentMatch32 = &match;
3375 lexer.SetPos(save);
3376 {
3377 soulng::parser::Match match(false);
3378 soulng::parser::Match* parentMatch33 = &match;
3379 {
3380 soulng::parser::Match match(false);
3381 soulng::parser::Match* parentMatch34 = &match;
3382 {
3383 soulng::parser::Match match(false);
3384 soulng::parser::Match* parentMatch35 = &match;
3385 {
3386 int64_t pos = lexer.GetPos();
3387 soulng::parser::Match match(false);
3388 if (*lexer == LPAREN)
3389 {
3390 ++lexer;
3391 match.hit = true;
3392 }
3393 if (match.hit)
3394 {
3395 expr.reset(new InvokeNode(s, *moduleId, expr.release()));
3396 }
3397 *parentMatch35 = match;
3398 }
3399 *parentMatch34 = match;
3400 }
3401 if (match.hit)
3402 {
3403 soulng::parser::Match match(false);
3404 soulng::parser::Match* parentMatch36 = &match;
3405 {
3406 soulng::parser::Match match = ExpressionParser::ArgumentList(lexer, moduleId, ctx, expr.get());
3407 *parentMatch36 = match;
3408 }
3409 *parentMatch34 = match;
3410 }
3411 *parentMatch33 = match;
3412 }
3413 if (match.hit)
3414 {
3415 soulng::parser::Match match(false);
3416 soulng::parser::Match* parentMatch37 = &match;
3417 {
3418 soulng::parser::Match match(false);
3419 soulng::parser::Match* parentMatch38 = &match;
3420 {
3421 int64_t pos = lexer.GetPos();
3422 soulng::lexer::Span span = lexer.GetSpan();
3423 soulng::parser::Match match(true);
3424 soulng::parser::Match* parentMatch39 = &match;
3425 {
3426 soulng::lexer::Span span = lexer.GetSpan();
3427 soulng::parser::Match match(false);
3428 if (*lexer == RPAREN)
3429 {
3430 ++lexer;
3431 match.hit = true;
3432 }
3433 if (match.hit)
3434 {
3435 *parentMatch39 = match;
3436 }
3437 else
3438 {
3439 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
3440 }
3441 }
3442 if (match.hit)
3443 {
3444 expr->SetSpanEnd(span.end);
3445 }
3446 *parentMatch38 = match;
3447 }
3448 *parentMatch37 = match;
3449 }
3450 *parentMatch33 = match;
3451 }
3452 *parentMatch32 = match;
3453 }
3454 *parentMatch7 = match;
3455 }
3456 }
3457 *parentMatch6 = match;
3458 }
3459 if (match.hit)
3460 {
3461 *parentMatch5 = match;
3462 }
3463 else
3464 {
3465 lexer.SetPos(save);
3466 break;
3467 }
3468 }
3469 }
3470 }
3471 *parentMatch4 = match;
3472 }
3473 *parentMatch2 = match;
3474 }
3475 *parentMatch1 = match;
3476 }
3477 if (match.hit)
3478 {
3479 {
3480 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3481
3482 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3483 return soulng::parser::Match(true, expr.release());
3484 }
3485 }
3486 *parentMatch0 = match;
3487 }
3488 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3489
3490
3491
3492
3493
3494 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3495 if (!match.hit)
3496 {
3497 match.value = nullptr;
3498 }
3499 return match;
3500 }
3501
3502 soulng::parser::Match ExpressionParser::Primary(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
3503 {
3504 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3505
3506
3507
3508
3509
3510
3511
3512 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3513 Span s = Span();
3514 std::unique_ptr<Node> expr;
3515 std::unique_ptr<LiteralNode> literal;
3516 std::unique_ptr<Node> basicType;
3517 std::unique_ptr<TemplateIdNode> templateId;
3518 std::unique_ptr<IdentifierNode> id;
3519 std::unique_ptr<Node> sizeOf;
3520 std::unique_ptr<Node> typeName;
3521 std::unique_ptr<Node> typeId;
3522 std::unique_ptr<Node> cast;
3523 std::unique_ptr<Node> construct;
3524 std::unique_ptr<Node> newExpr;
3525 soulng::parser::Match match(false);
3526 soulng::parser::Match* parentMatch0 = &match;
3527 {
3528 int64_t save = lexer.GetPos();
3529 soulng::parser::Match match(false);
3530 soulng::parser::Match* parentMatch1 = &match;
3531 {
3532 int64_t save = lexer.GetPos();
3533 soulng::parser::Match match(false);
3534 soulng::parser::Match* parentMatch2 = &match;
3535 {
3536 int64_t save = lexer.GetPos();
3537 soulng::parser::Match match(false);
3538 soulng::parser::Match* parentMatch3 = &match;
3539 {
3540 int64_t save = lexer.GetPos();
3541 soulng::parser::Match match(false);
3542 soulng::parser::Match* parentMatch4 = &match;
3543 {
3544 int64_t save = lexer.GetPos();
3545 soulng::parser::Match match(false);
3546 soulng::parser::Match* parentMatch5 = &match;
3547 {
3548 int64_t save = lexer.GetPos();
3549 soulng::parser::Match match(false);
3550 soulng::parser::Match* parentMatch6 = &match;
3551 {
3552 int64_t save = lexer.GetPos();
3553 soulng::parser::Match match(false);
3554 soulng::parser::Match* parentMatch7 = &match;
3555 {
3556 int64_t save = lexer.GetPos();
3557 soulng::parser::Match match(false);
3558 soulng::parser::Match* parentMatch8 = &match;
3559 {
3560 int64_t save = lexer.GetPos();
3561 soulng::parser::Match match(false);
3562 soulng::parser::Match* parentMatch9 = &match;
3563 {
3564 int64_t save = lexer.GetPos();
3565 soulng::parser::Match match(false);
3566 soulng::parser::Match* parentMatch10 = &match;
3567 {
3568 int64_t save = lexer.GetPos();
3569 soulng::parser::Match match(false);
3570 soulng::parser::Match* parentMatch11 = &match;
3571 {
3572 int64_t save = lexer.GetPos();
3573 soulng::parser::Match match(false);
3574 soulng::parser::Match* parentMatch12 = &match;
3575 {
3576 int64_t pos = lexer.GetPos();
3577 soulng::parser::Match match(false);
3578 soulng::parser::Match* parentMatch13 = &match;
3579 {
3580 soulng::parser::Match match(false);
3581 soulng::parser::Match* parentMatch14 = &match;
3582 {
3583 soulng::parser::Match match(false);
3584 soulng::parser::Match* parentMatch15 = &match;
3585 {
3586 soulng::parser::Match match(false);
3587 soulng::parser::Match* parentMatch16 = &match;
3588 {
3589 int64_t pos = lexer.GetPos();
3590 soulng::lexer::Span span = lexer.GetSpan();
3591 soulng::parser::Match match(false);
3592 if (*lexer == LPAREN)
3593 {
3594 ++lexer;
3595 match.hit = true;
3596 }
3597 if (match.hit)
3598 {
3599 s = span;
3600 }
3601 *parentMatch16 = match;
3602 }
3603 *parentMatch15 = match;
3604 }
3605 if (match.hit)
3606 {
3607 soulng::parser::Match match(false);
3608 soulng::parser::Match* parentMatch17 = &match;
3609 {
3610 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
3611 expr.reset(static_cast<Node*>(match.value));
3612 *parentMatch17 = match;
3613 }
3614 *parentMatch15 = match;
3615 }
3616 *parentMatch14 = match;
3617 }
3618 if (match.hit)
3619 {
3620 soulng::parser::Match match(false);
3621 soulng::parser::Match* parentMatch18 = &match;
3622 {
3623 soulng::parser::Match match(false);
3624 soulng::parser::Match* parentMatch19 = &match;
3625 {
3626 int64_t pos = lexer.GetPos();
3627 soulng::lexer::Span span = lexer.GetSpan();
3628 soulng::parser::Match match(false);
3629 if (*lexer == RPAREN)
3630 {
3631 ++lexer;
3632 match.hit = true;
3633 }
3634 if (match.hit)
3635 {
3636 s.end = span.end;
3637 }
3638 *parentMatch19 = match;
3639 }
3640 *parentMatch18 = match;
3641 }
3642 *parentMatch14 = match;
3643 }
3644 *parentMatch13 = match;
3645 }
3646 if (match.hit)
3647 {
3648 {
3649 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3650
3651 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3652 return soulng::parser::Match(true, new ParenthesizedExpressionNode(s, *moduleId, expr.release()));
3653 }
3654 }
3655 *parentMatch12 = match;
3656 }
3657 *parentMatch11 = match;
3658 if (!match.hit)
3659 {
3660 soulng::parser::Match match(false);
3661 soulng::parser::Match* parentMatch20 = &match;
3662 lexer.SetPos(save);
3663 {
3664 soulng::parser::Match match(false);
3665 soulng::parser::Match* parentMatch21 = &match;
3666 {
3667 int64_t pos = lexer.GetPos();
3668 soulng::parser::Match match = LiteralParser::Literal(lexer, moduleId, ctx);
3669 literal.reset(static_cast<LiteralNode*>(match.value));
3670 if (match.hit)
3671 {
3672 {
3673 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3674
3675 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3676 return soulng::parser::Match(true, literal.release());
3677 }
3678 }
3679 *parentMatch21 = match;
3680 }
3681 *parentMatch20 = match;
3682 }
3683 *parentMatch11 = match;
3684 }
3685 }
3686 *parentMatch10 = match;
3687 if (!match.hit)
3688 {
3689 soulng::parser::Match match(false);
3690 soulng::parser::Match* parentMatch22 = &match;
3691 lexer.SetPos(save);
3692 {
3693 soulng::parser::Match match(false);
3694 soulng::parser::Match* parentMatch23 = &match;
3695 {
3696 int64_t pos = lexer.GetPos();
3697 soulng::parser::Match match = BasicTypeParser::BasicType(lexer, moduleId);
3698 basicType.reset(static_cast<Node*>(match.value));
3699 if (match.hit)
3700 {
3701 {
3702 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3703
3704 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3705 return soulng::parser::Match(true, basicType.release());
3706 }
3707 }
3708 *parentMatch23 = match;
3709 }
3710 *parentMatch22 = match;
3711 }
3712 *parentMatch10 = match;
3713 }
3714 }
3715 *parentMatch9 = match;
3716 if (!match.hit)
3717 {
3718 soulng::parser::Match match(false);
3719 soulng::parser::Match* parentMatch24 = &match;
3720 lexer.SetPos(save);
3721 {
3722 soulng::parser::Match match(false);
3723 soulng::parser::Match* parentMatch25 = &match;
3724 {
3725 int64_t pos = lexer.GetPos();
3726 soulng::parser::Match match = TemplateParser::TemplateId(lexer, moduleId, ctx);
3727 templateId.reset(static_cast<TemplateIdNode*>(match.value));
3728 if (match.hit)
3729 {
3730 {
3731 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3732
3733 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3734 return soulng::parser::Match(true, templateId.release());
3735 }
3736 }
3737 *parentMatch25 = match;
3738 }
3739 *parentMatch24 = match;
3740 }
3741 *parentMatch9 = match;
3742 }
3743 }
3744 *parentMatch8 = match;
3745 if (!match.hit)
3746 {
3747 soulng::parser::Match match(false);
3748 soulng::parser::Match* parentMatch26 = &match;
3749 lexer.SetPos(save);
3750 {
3751 soulng::parser::Match match(false);
3752 soulng::parser::Match* parentMatch27 = &match;
3753 {
3754 int64_t pos = lexer.GetPos();
3755 soulng::parser::Match match = IdentifierParser::Identifier(lexer, moduleId);
3756 id.reset(static_cast<IdentifierNode*>(match.value));
3757 if (match.hit)
3758 {
3759 {
3760 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3761
3762 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3763 return soulng::parser::Match(true, id.release());
3764 }
3765 }
3766 *parentMatch27 = match;
3767 }
3768 *parentMatch26 = match;
3769 }
3770 *parentMatch8 = match;
3771 }
3772 }
3773 *parentMatch7 = match;
3774 if (!match.hit)
3775 {
3776 soulng::parser::Match match(false);
3777 soulng::parser::Match* parentMatch28 = &match;
3778 lexer.SetPos(save);
3779 {
3780 soulng::parser::Match match(false);
3781 soulng::parser::Match* parentMatch29 = &match;
3782 {
3783 int64_t pos = lexer.GetPos();
3784 soulng::lexer::Span span = lexer.GetSpan();
3785 soulng::parser::Match match(false);
3786 if (*lexer == THIS)
3787 {
3788 ++lexer;
3789 match.hit = true;
3790 }
3791 if (match.hit)
3792 {
3793 {
3794 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3795
3796 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3797 return soulng::parser::Match(true, new ThisNode(span, *moduleId));
3798 }
3799 }
3800 *parentMatch29 = match;
3801 }
3802 *parentMatch28 = match;
3803 }
3804 *parentMatch7 = match;
3805 }
3806 }
3807 *parentMatch6 = match;
3808 if (!match.hit)
3809 {
3810 soulng::parser::Match match(false);
3811 soulng::parser::Match* parentMatch30 = &match;
3812 lexer.SetPos(save);
3813 {
3814 soulng::parser::Match match(false);
3815 soulng::parser::Match* parentMatch31 = &match;
3816 {
3817 int64_t pos = lexer.GetPos();
3818 soulng::lexer::Span span = lexer.GetSpan();
3819 soulng::parser::Match match(false);
3820 if (*lexer == BASE)
3821 {
3822 ++lexer;
3823 match.hit = true;
3824 }
3825 if (match.hit)
3826 {
3827 {
3828 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3829
3830 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3831 return soulng::parser::Match(true, new BaseNode(span, *moduleId));
3832 }
3833 }
3834 *parentMatch31 = match;
3835 }
3836 *parentMatch30 = match;
3837 }
3838 *parentMatch6 = match;
3839 }
3840 }
3841 *parentMatch5 = match;
3842 if (!match.hit)
3843 {
3844 soulng::parser::Match match(false);
3845 soulng::parser::Match* parentMatch32 = &match;
3846 lexer.SetPos(save);
3847 {
3848 soulng::parser::Match match(false);
3849 soulng::parser::Match* parentMatch33 = &match;
3850 {
3851 int64_t pos = lexer.GetPos();
3852 soulng::parser::Match match = ExpressionParser::SizeOfExpr(lexer, moduleId, ctx);
3853 sizeOf.reset(static_cast<Node*>(match.value));
3854 if (match.hit)
3855 {
3856 {
3857 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3858
3859 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3860 return soulng::parser::Match(true, sizeOf.release());
3861 }
3862 }
3863 *parentMatch33 = match;
3864 }
3865 *parentMatch32 = match;
3866 }
3867 *parentMatch5 = match;
3868 }
3869 }
3870 *parentMatch4 = match;
3871 if (!match.hit)
3872 {
3873 soulng::parser::Match match(false);
3874 soulng::parser::Match* parentMatch34 = &match;
3875 lexer.SetPos(save);
3876 {
3877 soulng::parser::Match match(false);
3878 soulng::parser::Match* parentMatch35 = &match;
3879 {
3880 int64_t pos = lexer.GetPos();
3881 soulng::parser::Match match = ExpressionParser::TypeNameExpr(lexer, moduleId, ctx);
3882 typeName.reset(static_cast<Node*>(match.value));
3883 if (match.hit)
3884 {
3885 {
3886 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3887
3888 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3889 return soulng::parser::Match(true, typeName.release());
3890 }
3891 }
3892 *parentMatch35 = match;
3893 }
3894 *parentMatch34 = match;
3895 }
3896 *parentMatch4 = match;
3897 }
3898 }
3899 *parentMatch3 = match;
3900 if (!match.hit)
3901 {
3902 soulng::parser::Match match(false);
3903 soulng::parser::Match* parentMatch36 = &match;
3904 lexer.SetPos(save);
3905 {
3906 soulng::parser::Match match(false);
3907 soulng::parser::Match* parentMatch37 = &match;
3908 {
3909 int64_t pos = lexer.GetPos();
3910 soulng::parser::Match match = ExpressionParser::TypeIdExpr(lexer, moduleId, ctx);
3911 typeId.reset(static_cast<Node*>(match.value));
3912 if (match.hit)
3913 {
3914 {
3915 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3916
3917 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3918 return soulng::parser::Match(true, typeId.release());
3919 }
3920 }
3921 *parentMatch37 = match;
3922 }
3923 *parentMatch36 = match;
3924 }
3925 *parentMatch3 = match;
3926 }
3927 }
3928 *parentMatch2 = match;
3929 if (!match.hit)
3930 {
3931 soulng::parser::Match match(false);
3932 soulng::parser::Match* parentMatch38 = &match;
3933 lexer.SetPos(save);
3934 {
3935 soulng::parser::Match match(false);
3936 soulng::parser::Match* parentMatch39 = &match;
3937 {
3938 int64_t pos = lexer.GetPos();
3939 soulng::parser::Match match = ExpressionParser::CastExpr(lexer, moduleId, ctx);
3940 cast.reset(static_cast<Node*>(match.value));
3941 if (match.hit)
3942 {
3943 {
3944 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3945
3946 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3947 return soulng::parser::Match(true, cast.release());
3948 }
3949 }
3950 *parentMatch39 = match;
3951 }
3952 *parentMatch38 = match;
3953 }
3954 *parentMatch2 = match;
3955 }
3956 }
3957 *parentMatch1 = match;
3958 if (!match.hit)
3959 {
3960 soulng::parser::Match match(false);
3961 soulng::parser::Match* parentMatch40 = &match;
3962 lexer.SetPos(save);
3963 {
3964 soulng::parser::Match match(false);
3965 soulng::parser::Match* parentMatch41 = &match;
3966 {
3967 int64_t pos = lexer.GetPos();
3968 soulng::parser::Match match = ExpressionParser::ConstructExpr(lexer, moduleId, ctx);
3969 construct.reset(static_cast<Node*>(match.value));
3970 if (match.hit)
3971 {
3972 {
3973 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
3974
3975 #endif // SOULNG_PARSER_DEBUG_SUPPORT
3976 return soulng::parser::Match(true, construct.release());
3977 }
3978 }
3979 *parentMatch41 = match;
3980 }
3981 *parentMatch40 = match;
3982 }
3983 *parentMatch1 = match;
3984 }
3985 }
3986 *parentMatch0 = match;
3987 if (!match.hit)
3988 {
3989 soulng::parser::Match match(false);
3990 soulng::parser::Match* parentMatch42 = &match;
3991 lexer.SetPos(save);
3992 {
3993 soulng::parser::Match match(false);
3994 soulng::parser::Match* parentMatch43 = &match;
3995 {
3996 int64_t pos = lexer.GetPos();
3997 soulng::parser::Match match = ExpressionParser::NewExpr(lexer, moduleId, ctx);
3998 newExpr.reset(static_cast<Node*>(match.value));
3999 if (match.hit)
4000 {
4001 {
4002 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4003
4004 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4005 return soulng::parser::Match(true, newExpr.release());
4006 }
4007 }
4008 *parentMatch43 = match;
4009 }
4010 *parentMatch42 = match;
4011 }
4012 *parentMatch0 = match;
4013 }
4014 }
4015 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4016
4017
4018
4019
4020
4021 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4022 if (!match.hit)
4023 {
4024 match.value = nullptr;
4025 }
4026 return match;
4027 }
4028
4029 soulng::parser::Match ExpressionParser::SizeOfExpr(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4030 {
4031 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4032
4033
4034
4035
4036
4037
4038
4039 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4040 Span s = Span();
4041 std::unique_ptr<Node> expr;
4042 soulng::parser::Match match(false);
4043 soulng::parser::Match* parentMatch0 = &match;
4044 {
4045 int64_t pos = lexer.GetPos();
4046 soulng::lexer::Span span = lexer.GetSpan();
4047 soulng::parser::Match match(false);
4048 soulng::parser::Match* parentMatch1 = &match;
4049 {
4050 soulng::parser::Match match(false);
4051 soulng::parser::Match* parentMatch2 = &match;
4052 {
4053 soulng::parser::Match match(false);
4054 soulng::parser::Match* parentMatch3 = &match;
4055 {
4056 soulng::parser::Match match(false);
4057 soulng::parser::Match* parentMatch4 = &match;
4058 {
4059 soulng::parser::Match match(false);
4060 soulng::parser::Match* parentMatch5 = &match;
4061 {
4062 int64_t pos = lexer.GetPos();
4063 soulng::lexer::Span span = lexer.GetSpan();
4064 soulng::parser::Match match(false);
4065 if (*lexer == SIZEOF)
4066 {
4067 ++lexer;
4068 match.hit = true;
4069 }
4070 if (match.hit)
4071 {
4072 s = span;
4073 }
4074 *parentMatch5 = match;
4075 }
4076 *parentMatch4 = match;
4077 }
4078 if (match.hit)
4079 {
4080 soulng::parser::Match match(false);
4081 soulng::parser::Match* parentMatch6 = &match;
4082 {
4083 soulng::parser::Match match(true);
4084 soulng::parser::Match* parentMatch7 = &match;
4085 {
4086 soulng::lexer::Span span = lexer.GetSpan();
4087 soulng::parser::Match match(false);
4088 if (*lexer == LPAREN)
4089 {
4090 ++lexer;
4091 match.hit = true;
4092 }
4093 if (match.hit)
4094 {
4095 *parentMatch7 = match;
4096 }
4097 else
4098 {
4099 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LPAREN)));
4100 }
4101 }
4102 *parentMatch6 = match;
4103 }
4104 *parentMatch4 = match;
4105 }
4106 *parentMatch3 = match;
4107 }
4108 if (match.hit)
4109 {
4110 soulng::parser::Match match(false);
4111 soulng::parser::Match* parentMatch8 = &match;
4112 {
4113 soulng::parser::Match match(true);
4114 soulng::parser::Match* parentMatch9 = &match;
4115 {
4116 soulng::lexer::Span span = lexer.GetSpan();
4117 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
4118 expr.reset(static_cast<Node*>(match.value));
4119 if (match.hit)
4120 {
4121 *parentMatch9 = match;
4122 }
4123 else
4124 {
4125 lexer.ThrowExpectationFailure(span, U"expression");
4126 }
4127 }
4128 *parentMatch8 = match;
4129 }
4130 *parentMatch3 = match;
4131 }
4132 *parentMatch2 = match;
4133 }
4134 if (match.hit)
4135 {
4136 soulng::parser::Match match(false);
4137 soulng::parser::Match* parentMatch10 = &match;
4138 {
4139 soulng::parser::Match match(true);
4140 soulng::parser::Match* parentMatch11 = &match;
4141 {
4142 soulng::lexer::Span span = lexer.GetSpan();
4143 soulng::parser::Match match(false);
4144 if (*lexer == RPAREN)
4145 {
4146 ++lexer;
4147 match.hit = true;
4148 }
4149 if (match.hit)
4150 {
4151 *parentMatch11 = match;
4152 }
4153 else
4154 {
4155 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
4156 }
4157 }
4158 *parentMatch10 = match;
4159 }
4160 *parentMatch2 = match;
4161 }
4162 *parentMatch1 = match;
4163 }
4164 if (match.hit)
4165 {
4166 s.end = span.end;
4167 {
4168 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4169
4170 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4171 return soulng::parser::Match(true, new SizeOfNode(s, *moduleId, expr.release()));
4172 }
4173 }
4174 *parentMatch0 = match;
4175 }
4176 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4177
4178
4179
4180
4181
4182 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4183 if (!match.hit)
4184 {
4185 match.value = nullptr;
4186 }
4187 return match;
4188 }
4189
4190 soulng::parser::Match ExpressionParser::TypeNameExpr(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4191 {
4192 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4193
4194
4195
4196
4197
4198
4199
4200 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4201 Span s = Span();
4202 std::unique_ptr<Node> expr;
4203 soulng::parser::Match match(false);
4204 soulng::parser::Match* parentMatch0 = &match;
4205 {
4206 int64_t pos = lexer.GetPos();
4207 soulng::lexer::Span span = lexer.GetSpan();
4208 soulng::parser::Match match(false);
4209 soulng::parser::Match* parentMatch1 = &match;
4210 {
4211 soulng::parser::Match match(false);
4212 soulng::parser::Match* parentMatch2 = &match;
4213 {
4214 soulng::parser::Match match(false);
4215 soulng::parser::Match* parentMatch3 = &match;
4216 {
4217 soulng::parser::Match match(false);
4218 soulng::parser::Match* parentMatch4 = &match;
4219 {
4220 soulng::parser::Match match(false);
4221 soulng::parser::Match* parentMatch5 = &match;
4222 {
4223 int64_t pos = lexer.GetPos();
4224 soulng::lexer::Span span = lexer.GetSpan();
4225 soulng::parser::Match match(false);
4226 if (*lexer == TYPENAME)
4227 {
4228 ++lexer;
4229 match.hit = true;
4230 }
4231 if (match.hit)
4232 {
4233 s = span;
4234 }
4235 *parentMatch5 = match;
4236 }
4237 *parentMatch4 = match;
4238 }
4239 if (match.hit)
4240 {
4241 soulng::parser::Match match(false);
4242 soulng::parser::Match* parentMatch6 = &match;
4243 {
4244 soulng::parser::Match match(true);
4245 soulng::parser::Match* parentMatch7 = &match;
4246 {
4247 soulng::lexer::Span span = lexer.GetSpan();
4248 soulng::parser::Match match(false);
4249 if (*lexer == LPAREN)
4250 {
4251 ++lexer;
4252 match.hit = true;
4253 }
4254 if (match.hit)
4255 {
4256 *parentMatch7 = match;
4257 }
4258 else
4259 {
4260 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LPAREN)));
4261 }
4262 }
4263 *parentMatch6 = match;
4264 }
4265 *parentMatch4 = match;
4266 }
4267 *parentMatch3 = match;
4268 }
4269 if (match.hit)
4270 {
4271 soulng::parser::Match match(false);
4272 soulng::parser::Match* parentMatch8 = &match;
4273 {
4274 soulng::parser::Match match(true);
4275 soulng::parser::Match* parentMatch9 = &match;
4276 {
4277 soulng::lexer::Span span = lexer.GetSpan();
4278 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
4279 expr.reset(static_cast<Node*>(match.value));
4280 if (match.hit)
4281 {
4282 *parentMatch9 = match;
4283 }
4284 else
4285 {
4286 lexer.ThrowExpectationFailure(span, U"expression");
4287 }
4288 }
4289 *parentMatch8 = match;
4290 }
4291 *parentMatch3 = match;
4292 }
4293 *parentMatch2 = match;
4294 }
4295 if (match.hit)
4296 {
4297 soulng::parser::Match match(false);
4298 soulng::parser::Match* parentMatch10 = &match;
4299 {
4300 soulng::parser::Match match(true);
4301 soulng::parser::Match* parentMatch11 = &match;
4302 {
4303 soulng::lexer::Span span = lexer.GetSpan();
4304 soulng::parser::Match match(false);
4305 if (*lexer == RPAREN)
4306 {
4307 ++lexer;
4308 match.hit = true;
4309 }
4310 if (match.hit)
4311 {
4312 *parentMatch11 = match;
4313 }
4314 else
4315 {
4316 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
4317 }
4318 }
4319 *parentMatch10 = match;
4320 }
4321 *parentMatch2 = match;
4322 }
4323 *parentMatch1 = match;
4324 }
4325 if (match.hit)
4326 {
4327 s.end = span.end;
4328 {
4329 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4330
4331 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4332 return soulng::parser::Match(true, new TypeNameNode(s, *moduleId, expr.release()));
4333 }
4334 }
4335 *parentMatch0 = match;
4336 }
4337 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4338
4339
4340
4341
4342
4343 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4344 if (!match.hit)
4345 {
4346 match.value = nullptr;
4347 }
4348 return match;
4349 }
4350
4351 soulng::parser::Match ExpressionParser::TypeIdExpr(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4352 {
4353 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4354
4355
4356
4357
4358
4359
4360
4361 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4362 Span s = Span();
4363 std::unique_ptr<Node> expr;
4364 soulng::parser::Match match(false);
4365 soulng::parser::Match* parentMatch0 = &match;
4366 {
4367 int64_t pos = lexer.GetPos();
4368 soulng::lexer::Span span = lexer.GetSpan();
4369 soulng::parser::Match match(false);
4370 soulng::parser::Match* parentMatch1 = &match;
4371 {
4372 soulng::parser::Match match(false);
4373 soulng::parser::Match* parentMatch2 = &match;
4374 {
4375 soulng::parser::Match match(false);
4376 soulng::parser::Match* parentMatch3 = &match;
4377 {
4378 soulng::parser::Match match(false);
4379 soulng::parser::Match* parentMatch4 = &match;
4380 {
4381 soulng::parser::Match match(false);
4382 soulng::parser::Match* parentMatch5 = &match;
4383 {
4384 int64_t pos = lexer.GetPos();
4385 soulng::lexer::Span span = lexer.GetSpan();
4386 soulng::parser::Match match(false);
4387 if (*lexer == TYPEID)
4388 {
4389 ++lexer;
4390 match.hit = true;
4391 }
4392 if (match.hit)
4393 {
4394 s = span;
4395 }
4396 *parentMatch5 = match;
4397 }
4398 *parentMatch4 = match;
4399 }
4400 if (match.hit)
4401 {
4402 soulng::parser::Match match(false);
4403 soulng::parser::Match* parentMatch6 = &match;
4404 {
4405 soulng::parser::Match match(true);
4406 soulng::parser::Match* parentMatch7 = &match;
4407 {
4408 soulng::lexer::Span span = lexer.GetSpan();
4409 soulng::parser::Match match(false);
4410 if (*lexer == LPAREN)
4411 {
4412 ++lexer;
4413 match.hit = true;
4414 }
4415 if (match.hit)
4416 {
4417 *parentMatch7 = match;
4418 }
4419 else
4420 {
4421 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LPAREN)));
4422 }
4423 }
4424 *parentMatch6 = match;
4425 }
4426 *parentMatch4 = match;
4427 }
4428 *parentMatch3 = match;
4429 }
4430 if (match.hit)
4431 {
4432 soulng::parser::Match match(false);
4433 soulng::parser::Match* parentMatch8 = &match;
4434 {
4435 soulng::parser::Match match(true);
4436 soulng::parser::Match* parentMatch9 = &match;
4437 {
4438 soulng::lexer::Span span = lexer.GetSpan();
4439 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
4440 expr.reset(static_cast<Node*>(match.value));
4441 if (match.hit)
4442 {
4443 *parentMatch9 = match;
4444 }
4445 else
4446 {
4447 lexer.ThrowExpectationFailure(span, U"expression");
4448 }
4449 }
4450 *parentMatch8 = match;
4451 }
4452 *parentMatch3 = match;
4453 }
4454 *parentMatch2 = match;
4455 }
4456 if (match.hit)
4457 {
4458 soulng::parser::Match match(false);
4459 soulng::parser::Match* parentMatch10 = &match;
4460 {
4461 soulng::parser::Match match(true);
4462 soulng::parser::Match* parentMatch11 = &match;
4463 {
4464 soulng::lexer::Span span = lexer.GetSpan();
4465 soulng::parser::Match match(false);
4466 if (*lexer == RPAREN)
4467 {
4468 ++lexer;
4469 match.hit = true;
4470 }
4471 if (match.hit)
4472 {
4473 *parentMatch11 = match;
4474 }
4475 else
4476 {
4477 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
4478 }
4479 }
4480 *parentMatch10 = match;
4481 }
4482 *parentMatch2 = match;
4483 }
4484 *parentMatch1 = match;
4485 }
4486 if (match.hit)
4487 {
4488 s.end = span.end;
4489 {
4490 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4491
4492 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4493 return soulng::parser::Match(true, new TypeIdNode(s, *moduleId, expr.release()));
4494 }
4495 }
4496 *parentMatch0 = match;
4497 }
4498 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4499
4500
4501
4502
4503
4504 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4505 if (!match.hit)
4506 {
4507 match.value = nullptr;
4508 }
4509 return match;
4510 }
4511
4512 soulng::parser::Match ExpressionParser::CastExpr(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4513 {
4514 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4515
4516
4517
4518
4519
4520
4521
4522 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4523 Span s = Span();
4524 std::unique_ptr<sngcm::ast::Node> typeExpr;
4525 std::unique_ptr<Node> expr;
4526 soulng::parser::Match match(false);
4527 soulng::parser::Match* parentMatch0 = &match;
4528 {
4529 int64_t pos = lexer.GetPos();
4530 soulng::lexer::Span span = lexer.GetSpan();
4531 soulng::parser::Match match(false);
4532 soulng::parser::Match* parentMatch1 = &match;
4533 {
4534 soulng::parser::Match match(false);
4535 soulng::parser::Match* parentMatch2 = &match;
4536 {
4537 soulng::parser::Match match(false);
4538 soulng::parser::Match* parentMatch3 = &match;
4539 {
4540 soulng::parser::Match match(false);
4541 soulng::parser::Match* parentMatch4 = &match;
4542 {
4543 soulng::parser::Match match(false);
4544 soulng::parser::Match* parentMatch5 = &match;
4545 {
4546 soulng::parser::Match match(false);
4547 soulng::parser::Match* parentMatch6 = &match;
4548 {
4549 soulng::parser::Match match(false);
4550 soulng::parser::Match* parentMatch7 = &match;
4551 {
4552 soulng::parser::Match match(false);
4553 soulng::parser::Match* parentMatch8 = &match;
4554 {
4555 int64_t pos = lexer.GetPos();
4556 soulng::lexer::Span span = lexer.GetSpan();
4557 soulng::parser::Match match(false);
4558 if (*lexer == CAST)
4559 {
4560 ++lexer;
4561 match.hit = true;
4562 }
4563 if (match.hit)
4564 {
4565 s = span;
4566 }
4567 *parentMatch8 = match;
4568 }
4569 *parentMatch7 = match;
4570 }
4571 if (match.hit)
4572 {
4573 soulng::parser::Match match(false);
4574 soulng::parser::Match* parentMatch9 = &match;
4575 {
4576 soulng::parser::Match match(true);
4577 soulng::parser::Match* parentMatch10 = &match;
4578 {
4579 soulng::lexer::Span span = lexer.GetSpan();
4580 soulng::parser::Match match(false);
4581 if (*lexer == LANGLE)
4582 {
4583 ++lexer;
4584 match.hit = true;
4585 }
4586 if (match.hit)
4587 {
4588 *parentMatch10 = match;
4589 }
4590 else
4591 {
4592 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LANGLE)));
4593 }
4594 }
4595 *parentMatch9 = match;
4596 }
4597 *parentMatch7 = match;
4598 }
4599 *parentMatch6 = match;
4600 }
4601 if (match.hit)
4602 {
4603 soulng::parser::Match match(false);
4604 soulng::parser::Match* parentMatch11 = &match;
4605 {
4606 soulng::parser::Match match(true);
4607 soulng::parser::Match* parentMatch12 = &match;
4608 {
4609 soulng::lexer::Span span = lexer.GetSpan();
4610 soulng::parser::Match match = TypeExprParser::TypeExpr(lexer, moduleId, ctx);
4611 typeExpr.reset(static_cast<sngcm::ast::Node*>(match.value));
4612 if (match.hit)
4613 {
4614 *parentMatch12 = match;
4615 }
4616 else
4617 {
4618 lexer.ThrowExpectationFailure(span, U"type expression");
4619 }
4620 }
4621 *parentMatch11 = match;
4622 }
4623 *parentMatch6 = match;
4624 }
4625 *parentMatch5 = match;
4626 }
4627 if (match.hit)
4628 {
4629 soulng::parser::Match match(false);
4630 soulng::parser::Match* parentMatch13 = &match;
4631 {
4632 soulng::parser::Match match(true);
4633 soulng::parser::Match* parentMatch14 = &match;
4634 {
4635 soulng::lexer::Span span = lexer.GetSpan();
4636 soulng::parser::Match match(false);
4637 if (*lexer == RANGLE)
4638 {
4639 ++lexer;
4640 match.hit = true;
4641 }
4642 if (match.hit)
4643 {
4644 *parentMatch14 = match;
4645 }
4646 else
4647 {
4648 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RANGLE)));
4649 }
4650 }
4651 *parentMatch13 = match;
4652 }
4653 *parentMatch5 = match;
4654 }
4655 *parentMatch4 = match;
4656 }
4657 if (match.hit)
4658 {
4659 soulng::parser::Match match(false);
4660 soulng::parser::Match* parentMatch15 = &match;
4661 {
4662 soulng::parser::Match match(true);
4663 soulng::parser::Match* parentMatch16 = &match;
4664 {
4665 soulng::lexer::Span span = lexer.GetSpan();
4666 soulng::parser::Match match(false);
4667 if (*lexer == LPAREN)
4668 {
4669 ++lexer;
4670 match.hit = true;
4671 }
4672 if (match.hit)
4673 {
4674 *parentMatch16 = match;
4675 }
4676 else
4677 {
4678 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LPAREN)));
4679 }
4680 }
4681 *parentMatch15 = match;
4682 }
4683 *parentMatch4 = match;
4684 }
4685 *parentMatch3 = match;
4686 }
4687 if (match.hit)
4688 {
4689 soulng::parser::Match match(false);
4690 soulng::parser::Match* parentMatch17 = &match;
4691 {
4692 soulng::parser::Match match(true);
4693 soulng::parser::Match* parentMatch18 = &match;
4694 {
4695 soulng::lexer::Span span = lexer.GetSpan();
4696 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
4697 expr.reset(static_cast<Node*>(match.value));
4698 if (match.hit)
4699 {
4700 *parentMatch18 = match;
4701 }
4702 else
4703 {
4704 lexer.ThrowExpectationFailure(span, U"expression");
4705 }
4706 }
4707 *parentMatch17 = match;
4708 }
4709 *parentMatch3 = match;
4710 }
4711 *parentMatch2 = match;
4712 }
4713 if (match.hit)
4714 {
4715 soulng::parser::Match match(false);
4716 soulng::parser::Match* parentMatch19 = &match;
4717 {
4718 soulng::parser::Match match(true);
4719 soulng::parser::Match* parentMatch20 = &match;
4720 {
4721 soulng::lexer::Span span = lexer.GetSpan();
4722 soulng::parser::Match match(false);
4723 if (*lexer == RPAREN)
4724 {
4725 ++lexer;
4726 match.hit = true;
4727 }
4728 if (match.hit)
4729 {
4730 *parentMatch20 = match;
4731 }
4732 else
4733 {
4734 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
4735 }
4736 }
4737 *parentMatch19 = match;
4738 }
4739 *parentMatch2 = match;
4740 }
4741 *parentMatch1 = match;
4742 }
4743 if (match.hit)
4744 {
4745 s.end = span.end;
4746 {
4747 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4748
4749 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4750 return soulng::parser::Match(true, new CastNode(s, *moduleId, typeExpr.release(), expr.release()));
4751 }
4752 }
4753 *parentMatch0 = match;
4754 }
4755 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4756
4757
4758
4759
4760
4761 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4762 if (!match.hit)
4763 {
4764 match.value = nullptr;
4765 }
4766 return match;
4767 }
4768
4769 soulng::parser::Match ExpressionParser::ConstructExpr(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
4770 {
4771 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
4772
4773
4774
4775
4776
4777
4778
4779 #endif // SOULNG_PARSER_DEBUG_SUPPORT
4780 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
4781 Span s = Span();
4782 std::unique_ptr<sngcm::ast::Node> typeExpr;
4783 soulng::parser::Match match(false);
4784 soulng::parser::Match* parentMatch0 = &match;
4785 {
4786 soulng::parser::Match match(false);
4787 soulng::parser::Match* parentMatch1 = &match;
4788 {
4789 soulng::parser::Match match(false);
4790 soulng::parser::Match* parentMatch2 = &match;
4791 {
4792 soulng::parser::Match match(false);
4793 soulng::parser::Match* parentMatch3 = &match;
4794 {
4795 int64_t pos = lexer.GetPos();
4796 soulng::parser::Match match(false);
4797 soulng::parser::Match* parentMatch4 = &match;
4798 {
4799 soulng::parser::Match match(false);
4800 soulng::parser::Match* parentMatch5 = &match;
4801 {
4802 soulng::parser::Match match(false);
4803 soulng::parser::Match* parentMatch6 = &match;
4804 {
4805 soulng::parser::Match match(false);
4806 soulng::parser::Match* parentMatch7 = &match;
4807 {
4808 soulng::parser::Match match(false);
4809 soulng::parser::Match* parentMatch8 = &match;
4810 {
4811 int64_t pos = lexer.GetPos();
4812 soulng::lexer::Span span = lexer.GetSpan();
4813 soulng::parser::Match match(false);
4814 if (*lexer == CONSTRUCT)
4815 {
4816 ++lexer;
4817 match.hit = true;
4818 }
4819 if (match.hit)
4820 {
4821 s = span;
4822 }
4823 *parentMatch8 = match;
4824 }
4825 *parentMatch7 = match;
4826 }
4827 if (match.hit)
4828 {
4829 soulng::parser::Match match(false);
4830 soulng::parser::Match* parentMatch9 = &match;
4831 {
4832 soulng::parser::Match match(true);
4833 soulng::parser::Match* parentMatch10 = &match;
4834 {
4835 soulng::lexer::Span span = lexer.GetSpan();
4836 soulng::parser::Match match(false);
4837 if (*lexer == LANGLE)
4838 {
4839 ++lexer;
4840 match.hit = true;
4841 }
4842 if (match.hit)
4843 {
4844 *parentMatch10 = match;
4845 }
4846 else
4847 {
4848 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LANGLE)));
4849 }
4850 }
4851 *parentMatch9 = match;
4852 }
4853 *parentMatch7 = match;
4854 }
4855 *parentMatch6 = match;
4856 }
4857 if (match.hit)
4858 {
4859 soulng::parser::Match match(false);
4860 soulng::parser::Match* parentMatch11 = &match;
4861 {
4862 soulng::parser::Match match(true);
4863 soulng::parser::Match* parentMatch12 = &match;
4864 {
4865 soulng::lexer::Span span = lexer.GetSpan();
4866 soulng::parser::Match match = TypeExprParser::TypeExpr(lexer, moduleId, ctx);
4867 typeExpr.reset(static_cast<sngcm::ast::Node*>(match.value));
4868 if (match.hit)
4869 {
4870 *parentMatch12 = match;
4871 }
4872 else
4873 {
4874 lexer.ThrowExpectationFailure(span, U"type expression");
4875 }
4876 }
4877 *parentMatch11 = match;
4878 }
4879 *parentMatch6 = match;
4880 }
4881 *parentMatch5 = match;
4882 }
4883 if (match.hit)
4884 {
4885 soulng::parser::Match match(false);
4886 soulng::parser::Match* parentMatch13 = &match;
4887 {
4888 soulng::parser::Match match(true);
4889 soulng::parser::Match* parentMatch14 = &match;
4890 {
4891 soulng::lexer::Span span = lexer.GetSpan();
4892 soulng::parser::Match match(false);
4893 if (*lexer == RANGLE)
4894 {
4895 ++lexer;
4896 match.hit = true;
4897 }
4898 if (match.hit)
4899 {
4900 *parentMatch14 = match;
4901 }
4902 else
4903 {
4904 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RANGLE)));
4905 }
4906 }
4907 *parentMatch13 = match;
4908 }
4909 *parentMatch5 = match;
4910 }
4911 *parentMatch4 = match;
4912 }
4913 if (match.hit)
4914 {
4915 expr.reset(new ConstructNode(s, *moduleId, typeExpr.release()));
4916 }
4917 *parentMatch3 = match;
4918 }
4919 *parentMatch2 = match;
4920 }
4921 if (match.hit)
4922 {
4923 soulng::parser::Match match(false);
4924 soulng::parser::Match* parentMatch15 = &match;
4925 {
4926 soulng::parser::Match match(true);
4927 soulng::parser::Match* parentMatch16 = &match;
4928 {
4929 soulng::lexer::Span span = lexer.GetSpan();
4930 soulng::parser::Match match(false);
4931 if (*lexer == LPAREN)
4932 {
4933 ++lexer;
4934 match.hit = true;
4935 }
4936 if (match.hit)
4937 {
4938 *parentMatch16 = match;
4939 }
4940 else
4941 {
4942 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(LPAREN)));
4943 }
4944 }
4945 *parentMatch15 = match;
4946 }
4947 *parentMatch2 = match;
4948 }
4949 *parentMatch1 = match;
4950 }
4951 if (match.hit)
4952 {
4953 soulng::parser::Match match(false);
4954 soulng::parser::Match* parentMatch17 = &match;
4955 {
4956 soulng::parser::Match match(true);
4957 soulng::parser::Match* parentMatch18 = &match;
4958 {
4959 soulng::lexer::Span span = lexer.GetSpan();
4960 soulng::parser::Match match = ExpressionParser::ExpressionList(lexer, moduleId, ctx, expr.get());
4961 if (match.hit)
4962 {
4963 *parentMatch18 = match;
4964 }
4965 else
4966 {
4967 lexer.ThrowExpectationFailure(span, U"expression list");
4968 }
4969 }
4970 *parentMatch17 = match;
4971 }
4972 *parentMatch1 = match;
4973 }
4974 *parentMatch0 = match;
4975 }
4976 if (match.hit)
4977 {
4978 soulng::parser::Match match(false);
4979 soulng::parser::Match* parentMatch19 = &match;
4980 {
4981 soulng::parser::Match match(false);
4982 soulng::parser::Match* parentMatch20 = &match;
4983 {
4984 int64_t pos = lexer.GetPos();
4985 soulng::lexer::Span span = lexer.GetSpan();
4986 soulng::parser::Match match(true);
4987 soulng::parser::Match* parentMatch21 = &match;
4988 {
4989 soulng::lexer::Span span = lexer.GetSpan();
4990 soulng::parser::Match match(false);
4991 if (*lexer == RPAREN)
4992 {
4993 ++lexer;
4994 match.hit = true;
4995 }
4996 if (match.hit)
4997 {
4998 *parentMatch21 = match;
4999 }
5000 else
5001 {
5002 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
5003 }
5004 }
5005 if (match.hit)
5006 {
5007 expr->SetSpanEnd(span.end);
5008 {
5009 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5010
5011 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5012 return soulng::parser::Match(true, expr.release());
5013 }
5014 }
5015 *parentMatch20 = match;
5016 }
5017 *parentMatch19 = match;
5018 }
5019 *parentMatch0 = match;
5020 }
5021 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5022
5023
5024
5025
5026
5027 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5028 if (!match.hit)
5029 {
5030 match.value = nullptr;
5031 }
5032 return match;
5033 }
5034
5035 soulng::parser::Match ExpressionParser::NewExpr(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
5036 {
5037 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5038
5039
5040
5041
5042
5043
5044
5045 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5046 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
5047 Span s = Span();
5048 std::unique_ptr<sngcm::ast::Node> typeExpr;
5049 soulng::parser::Match match(false);
5050 soulng::parser::Match* parentMatch0 = &match;
5051 {
5052 int64_t pos = lexer.GetPos();
5053 soulng::parser::Match match(false);
5054 soulng::parser::Match* parentMatch1 = &match;
5055 {
5056 soulng::parser::Match match(false);
5057 soulng::parser::Match* parentMatch2 = &match;
5058 {
5059 soulng::parser::Match match(false);
5060 soulng::parser::Match* parentMatch3 = &match;
5061 {
5062 soulng::parser::Match match(false);
5063 soulng::parser::Match* parentMatch4 = &match;
5064 {
5065 int64_t pos = lexer.GetPos();
5066 soulng::lexer::Span span = lexer.GetSpan();
5067 soulng::parser::Match match(false);
5068 if (*lexer == NEW)
5069 {
5070 ++lexer;
5071 match.hit = true;
5072 }
5073 if (match.hit)
5074 {
5075 s = span;
5076 }
5077 *parentMatch4 = match;
5078 }
5079 *parentMatch3 = match;
5080 }
5081 if (match.hit)
5082 {
5083 soulng::parser::Match match(false);
5084 soulng::parser::Match* parentMatch5 = &match;
5085 {
5086 soulng::parser::Match match(false);
5087 soulng::parser::Match* parentMatch6 = &match;
5088 {
5089 int64_t pos = lexer.GetPos();
5090 soulng::lexer::Span span = lexer.GetSpan();
5091 soulng::parser::Match match(true);
5092 soulng::parser::Match* parentMatch7 = &match;
5093 {
5094 soulng::lexer::Span span = lexer.GetSpan();
5095 soulng::parser::Match match = TypeExprParser::TypeExpr(lexer, moduleId, ctx);
5096 typeExpr.reset(static_cast<sngcm::ast::Node*>(match.value));
5097 if (match.hit)
5098 {
5099 *parentMatch7 = match;
5100 }
5101 else
5102 {
5103 lexer.ThrowExpectationFailure(span, U"type expression");
5104 }
5105 }
5106 if (match.hit)
5107 {
5108 s.end = span.end;
5109 expr.reset(new NewNode(s, *moduleId, typeExpr.release()));
5110 }
5111 *parentMatch6 = match;
5112 }
5113 *parentMatch5 = match;
5114 }
5115 *parentMatch3 = match;
5116 }
5117 *parentMatch2 = match;
5118 }
5119 if (match.hit)
5120 {
5121 soulng::parser::Match match(false);
5122 soulng::parser::Match* parentMatch8 = &match;
5123 {
5124 soulng::parser::Match match(true);
5125 int64_t save = lexer.GetPos();
5126 soulng::parser::Match* parentMatch9 = &match;
5127 {
5128 soulng::parser::Match match(false);
5129 soulng::parser::Match* parentMatch10 = &match;
5130 {
5131 soulng::parser::Match match(false);
5132 soulng::parser::Match* parentMatch11 = &match;
5133 {
5134 soulng::parser::Match match(false);
5135 soulng::parser::Match* parentMatch12 = &match;
5136 {
5137 soulng::parser::Match match(false);
5138 if (*lexer == LPAREN)
5139 {
5140 ++lexer;
5141 match.hit = true;
5142 }
5143 *parentMatch12 = match;
5144 }
5145 if (match.hit)
5146 {
5147 soulng::parser::Match match(false);
5148 soulng::parser::Match* parentMatch13 = &match;
5149 {
5150 soulng::parser::Match match = ExpressionParser::ArgumentList(lexer, moduleId, ctx, expr.get());
5151 *parentMatch13 = match;
5152 }
5153 *parentMatch12 = match;
5154 }
5155 *parentMatch11 = match;
5156 }
5157 if (match.hit)
5158 {
5159 soulng::parser::Match match(false);
5160 soulng::parser::Match* parentMatch14 = &match;
5161 {
5162 soulng::parser::Match match(false);
5163 soulng::parser::Match* parentMatch15 = &match;
5164 {
5165 int64_t pos = lexer.GetPos();
5166 soulng::lexer::Span span = lexer.GetSpan();
5167 soulng::parser::Match match(false);
5168 if (*lexer == RPAREN)
5169 {
5170 ++lexer;
5171 match.hit = true;
5172 }
5173 if (match.hit)
5174 {
5175 expr->SetSpanEnd(span.end);
5176 }
5177 *parentMatch15 = match;
5178 }
5179 *parentMatch14 = match;
5180 }
5181 *parentMatch11 = match;
5182 }
5183 *parentMatch10 = match;
5184 }
5185 if (match.hit)
5186 {
5187 *parentMatch9 = match;
5188 }
5189 else
5190 {
5191 lexer.SetPos(save);
5192 }
5193 }
5194 *parentMatch8 = match;
5195 }
5196 *parentMatch2 = match;
5197 }
5198 *parentMatch1 = match;
5199 }
5200 if (match.hit)
5201 {
5202 {
5203 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5204
5205 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5206 return soulng::parser::Match(true, expr.release());
5207 }
5208 }
5209 *parentMatch0 = match;
5210 }
5211 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5212
5213
5214
5215
5216
5217 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5218 if (!match.hit)
5219 {
5220 match.value = nullptr;
5221 }
5222 return match;
5223 }
5224
5225 soulng::parser::Match ExpressionParser::ArgumentList(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx, sngcm::ast::Node* node)
5226 {
5227 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5228
5229
5230
5231
5232
5233
5234
5235 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5236 soulng::parser::Match match(false);
5237 soulng::parser::Match* parentMatch0 = &match;
5238 {
5239 soulng::parser::Match match(true);
5240 int64_t save = lexer.GetPos();
5241 soulng::parser::Match* parentMatch1 = &match;
5242 {
5243 soulng::parser::Match match = ExpressionParser::ExpressionList(lexer, moduleId, ctx, node);
5244 if (match.hit)
5245 {
5246 *parentMatch1 = match;
5247 }
5248 else
5249 {
5250 lexer.SetPos(save);
5251 }
5252 }
5253 *parentMatch0 = match;
5254 }
5255 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5256
5257
5258
5259
5260
5261 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5262 if (!match.hit)
5263 {
5264 match.value = nullptr;
5265 }
5266 return match;
5267 }
5268
5269 soulng::parser::Match ExpressionParser::ExpressionList(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx, sngcm::ast::Node* node)
5270 {
5271 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5272
5273
5274
5275
5276
5277
5278
5279 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5280 std::unique_ptr<Node> arg;
5281 soulng::parser::Match match(false);
5282 soulng::parser::Match* parentMatch0 = &match;
5283 {
5284 soulng::parser::Match match(false);
5285 soulng::parser::Match* parentMatch1 = &match;
5286 {
5287 int64_t pos = lexer.GetPos();
5288 soulng::parser::Match match(true);
5289 if (match.hit)
5290 {
5291 ctx->BeginParsingArguments();
5292 }
5293 *parentMatch1 = match;
5294 }
5295 *parentMatch0 = match;
5296 }
5297 if (match.hit)
5298 {
5299 soulng::parser::Match match(false);
5300 soulng::parser::Match* parentMatch2 = &match;
5301 {
5302 soulng::parser::Match match(false);
5303 soulng::parser::Match* parentMatch3 = &match;
5304 {
5305 int64_t pos = lexer.GetPos();
5306 soulng::parser::Match match(false);
5307 soulng::parser::Match* parentMatch4 = &match;
5308 {
5309 soulng::parser::Match match(false);
5310 soulng::parser::Match* parentMatch5 = &match;
5311 {
5312 soulng::parser::Match match(false);
5313 soulng::parser::Match* parentMatch6 = &match;
5314 {
5315 soulng::parser::Match match(false);
5316 soulng::parser::Match* parentMatch7 = &match;
5317 {
5318 int64_t pos = lexer.GetPos();
5319 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
5320 arg.reset(static_cast<Node*>(match.value));
5321 if (match.hit)
5322 {
5323 node->AddArgument(arg.release());
5324 }
5325 *parentMatch7 = match;
5326 }
5327 *parentMatch6 = match;
5328 }
5329 *parentMatch5 = match;
5330 }
5331 if (match.hit)
5332 {
5333 soulng::parser::Match match(false);
5334 soulng::parser::Match* parentMatch8 = &match;
5335 {
5336 soulng::parser::Match match(true);
5337 soulng::parser::Match* parentMatch9 = &match;
5338 {
5339 while (true)
5340 {
5341 int64_t save = lexer.GetPos();
5342 {
5343 soulng::parser::Match match(false);
5344 soulng::parser::Match* parentMatch10 = &match;
5345 {
5346 soulng::parser::Match match(false);
5347 if (*lexer == COMMA)
5348 {
5349 ++lexer;
5350 match.hit = true;
5351 }
5352 *parentMatch10 = match;
5353 }
5354 if (match.hit)
5355 {
5356 soulng::parser::Match match(false);
5357 soulng::parser::Match* parentMatch11 = &match;
5358 {
5359 soulng::parser::Match match(false);
5360 soulng::parser::Match* parentMatch12 = &match;
5361 {
5362 soulng::parser::Match match(false);
5363 soulng::parser::Match* parentMatch13 = &match;
5364 {
5365 int64_t pos = lexer.GetPos();
5366 soulng::parser::Match match = ExpressionParser::Expression(lexer, moduleId, ctx);
5367 arg.reset(static_cast<Node*>(match.value));
5368 if (match.hit)
5369 {
5370 node->AddArgument(arg.release());
5371 }
5372 *parentMatch13 = match;
5373 }
5374 *parentMatch12 = match;
5375 }
5376 *parentMatch11 = match;
5377 }
5378 *parentMatch10 = match;
5379 }
5380 if (match.hit)
5381 {
5382 *parentMatch9 = match;
5383 }
5384 else
5385 {
5386 lexer.SetPos(save);
5387 break;
5388 }
5389 }
5390 }
5391 }
5392 *parentMatch8 = match;
5393 }
5394 *parentMatch5 = match;
5395 }
5396 *parentMatch4 = match;
5397 }
5398 if (match.hit)
5399 {
5400 ctx->EndParsingArguments();
5401 }
5402 else
5403 {
5404 ctx->EndParsingArguments();
5405 }
5406 *parentMatch3 = match;
5407 }
5408 *parentMatch2 = match;
5409 }
5410 *parentMatch0 = match;
5411 }
5412 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5413
5414
5415
5416
5417
5418 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5419 if (!match.hit)
5420 {
5421 match.value = nullptr;
5422 }
5423 return match;
5424 }
5425
5426 soulng::parser::Match ExpressionParser::InvokeExpr(CmajorLexer& lexer, boost::uuids::uuid* moduleId, ParsingContext* ctx)
5427 {
5428 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5429
5430
5431
5432
5433
5434
5435
5436 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5437 std::unique_ptr<Node> expr = std::unique_ptr<Node>();
5438 Span s = Span();
5439 std::unique_ptr<TemplateIdNode> templateId;
5440 std::unique_ptr<IdentifierNode> id;
5441 std::unique_ptr<IdentifierNode> dotMemberId;
5442 soulng::parser::Match match(false);
5443 soulng::parser::Match* parentMatch0 = &match;
5444 {
5445 int64_t pos = lexer.GetPos();
5446 soulng::parser::Match match(false);
5447 soulng::parser::Match* parentMatch1 = &match;
5448 {
5449 soulng::parser::Match match(false);
5450 soulng::parser::Match* parentMatch2 = &match;
5451 {
5452 soulng::parser::Match match(false);
5453 soulng::parser::Match* parentMatch3 = &match;
5454 {
5455 soulng::parser::Match match(false);
5456 soulng::parser::Match* parentMatch4 = &match;
5457 {
5458 soulng::parser::Match match(false);
5459 soulng::parser::Match* parentMatch5 = &match;
5460 {
5461 soulng::parser::Match match(false);
5462 soulng::parser::Match* parentMatch6 = &match;
5463 {
5464 soulng::parser::Match match(false);
5465 soulng::parser::Match* parentMatch7 = &match;
5466 {
5467 int64_t save = lexer.GetPos();
5468 soulng::parser::Match match(false);
5469 soulng::parser::Match* parentMatch8 = &match;
5470 {
5471 int64_t pos = lexer.GetPos();
5472 soulng::lexer::Span span = lexer.GetSpan();
5473 soulng::parser::Match match = TemplateParser::TemplateId(lexer, moduleId, ctx);
5474 templateId.reset(static_cast<TemplateIdNode*>(match.value));
5475 if (match.hit)
5476 {
5477 s = span;
5478 expr.reset(templateId.release());
5479 }
5480 *parentMatch8 = match;
5481 }
5482 *parentMatch7 = match;
5483 if (!match.hit)
5484 {
5485 soulng::parser::Match match(false);
5486 soulng::parser::Match* parentMatch9 = &match;
5487 lexer.SetPos(save);
5488 {
5489 soulng::parser::Match match(false);
5490 soulng::parser::Match* parentMatch10 = &match;
5491 {
5492 int64_t pos = lexer.GetPos();
5493 soulng::lexer::Span span = lexer.GetSpan();
5494 soulng::parser::Match match = IdentifierParser::Identifier(lexer, moduleId);
5495 id.reset(static_cast<IdentifierNode*>(match.value));
5496 if (match.hit)
5497 {
5498 s = span;
5499 expr.reset(id.release());
5500 }
5501 *parentMatch10 = match;
5502 }
5503 *parentMatch9 = match;
5504 }
5505 *parentMatch7 = match;
5506 }
5507 }
5508 *parentMatch6 = match;
5509 }
5510 *parentMatch5 = match;
5511 }
5512 if (match.hit)
5513 {
5514 soulng::parser::Match match(false);
5515 soulng::parser::Match* parentMatch11 = &match;
5516 {
5517 soulng::parser::Match match(true);
5518 soulng::parser::Match* parentMatch12 = &match;
5519 {
5520 while (true)
5521 {
5522 int64_t save = lexer.GetPos();
5523 {
5524 soulng::parser::Match match(false);
5525 soulng::parser::Match* parentMatch13 = &match;
5526 {
5527 soulng::parser::Match match(false);
5528 soulng::parser::Match* parentMatch14 = &match;
5529 {
5530 soulng::parser::Match match(false);
5531 if (*lexer == DOT)
5532 {
5533 ++lexer;
5534 match.hit = true;
5535 }
5536 *parentMatch14 = match;
5537 }
5538 if (match.hit)
5539 {
5540 soulng::parser::Match match(false);
5541 soulng::parser::Match* parentMatch15 = &match;
5542 {
5543 soulng::parser::Match match(false);
5544 soulng::parser::Match* parentMatch16 = &match;
5545 {
5546 int64_t pos = lexer.GetPos();
5547 soulng::lexer::Span span = lexer.GetSpan();
5548 soulng::parser::Match match(true);
5549 soulng::parser::Match* parentMatch17 = &match;
5550 {
5551 soulng::lexer::Span span = lexer.GetSpan();
5552 soulng::parser::Match match = IdentifierParser::Identifier(lexer, moduleId);
5553 dotMemberId.reset(static_cast<IdentifierNode*>(match.value));
5554 if (match.hit)
5555 {
5556 *parentMatch17 = match;
5557 }
5558 else
5559 {
5560 lexer.ThrowExpectationFailure(span, U"identifier");
5561 }
5562 }
5563 if (match.hit)
5564 {
5565 s.end = span.end;
5566 expr.reset(new DotNode(s, *moduleId, expr.release(), dotMemberId.release()));
5567 }
5568 *parentMatch16 = match;
5569 }
5570 *parentMatch15 = match;
5571 }
5572 *parentMatch14 = match;
5573 }
5574 *parentMatch13 = match;
5575 }
5576 if (match.hit)
5577 {
5578 *parentMatch12 = match;
5579 }
5580 else
5581 {
5582 lexer.SetPos(save);
5583 break;
5584 }
5585 }
5586 }
5587 }
5588 *parentMatch11 = match;
5589 }
5590 *parentMatch5 = match;
5591 }
5592 *parentMatch4 = match;
5593 }
5594 if (match.hit)
5595 {
5596 soulng::parser::Match match(false);
5597 soulng::parser::Match* parentMatch18 = &match;
5598 {
5599 soulng::parser::Match match(false);
5600 soulng::parser::Match* parentMatch19 = &match;
5601 {
5602 int64_t pos = lexer.GetPos();
5603 soulng::parser::Match match(false);
5604 if (*lexer == LPAREN)
5605 {
5606 ++lexer;
5607 match.hit = true;
5608 }
5609 if (match.hit)
5610 {
5611 expr.reset(new InvokeNode(s, *moduleId, expr.release()));
5612 }
5613 *parentMatch19 = match;
5614 }
5615 *parentMatch18 = match;
5616 }
5617 *parentMatch4 = match;
5618 }
5619 *parentMatch3 = match;
5620 }
5621 if (match.hit)
5622 {
5623 soulng::parser::Match match(false);
5624 soulng::parser::Match* parentMatch20 = &match;
5625 {
5626 soulng::parser::Match match = ExpressionParser::ArgumentList(lexer, moduleId, ctx, expr.get());
5627 *parentMatch20 = match;
5628 }
5629 *parentMatch3 = match;
5630 }
5631 *parentMatch2 = match;
5632 }
5633 if (match.hit)
5634 {
5635 soulng::parser::Match match(false);
5636 soulng::parser::Match* parentMatch21 = &match;
5637 {
5638 soulng::parser::Match match(false);
5639 soulng::parser::Match* parentMatch22 = &match;
5640 {
5641 int64_t pos = lexer.GetPos();
5642 soulng::lexer::Span span = lexer.GetSpan();
5643 soulng::parser::Match match(true);
5644 soulng::parser::Match* parentMatch23 = &match;
5645 {
5646 soulng::lexer::Span span = lexer.GetSpan();
5647 soulng::parser::Match match(false);
5648 if (*lexer == RPAREN)
5649 {
5650 ++lexer;
5651 match.hit = true;
5652 }
5653 if (match.hit)
5654 {
5655 *parentMatch23 = match;
5656 }
5657 else
5658 {
5659 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(RPAREN)));
5660 }
5661 }
5662 if (match.hit)
5663 {
5664 expr->SetSpanEnd(span.end);
5665 }
5666 *parentMatch22 = match;
5667 }
5668 *parentMatch21 = match;
5669 }
5670 *parentMatch2 = match;
5671 }
5672 *parentMatch1 = match;
5673 }
5674 if (match.hit)
5675 {
5676 {
5677 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5678
5679 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5680 return soulng::parser::Match(true, expr.release());
5681 }
5682 }
5683 *parentMatch0 = match;
5684 }
5685 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
5686
5687
5688
5689
5690
5691 #endif // SOULNG_PARSER_DEBUG_SUPPORT
5692 if (!match.hit)
5693 {
5694 match.value = nullptr;
5695 }
5696 return match;
5697 }