1 using System;
2 using System.Collections;
3 using System.Lex;
4 using System.Parsing;
5 using System.Lex;
6 using Cm.Ast;
7 using ParserFileTokens;
8
9
10
11 public static class ParserFileParser
12 {
13 public static UniquePtr<soulcm.scmpg.ParserFile> Parse(ParserFileLexer& lexer, ParsingContext* parsingContext)
14 {
15 UniquePtr<soulcm.scmpg.ParserFile> value;
16 #if (DEBUG)
17 if (lexer.Log() != null)
18 {
19 lexer.Log()->WriteBeginRule(u"parse");
20 lexer.Log()->IncIndent();
21 }
22 #endif
23 ++lexer;
24 System.Lex.Span span = lexer.GetSpan();
25 Match match = ParserFile(lexer, parsingContext);
26 value.Reset(cast<soulcm.scmpg.ParserFile*>(match.value));
27 #if (DEBUG)
28 if (lexer.Log() != null)
29 {
30 lexer.Log()->DecIndent();
31 lexer.Log()->WriteEndRule(u"parse");
32 }
33 #endif
34 if (match.hit)
35 {
36 if (*lexer == System.Lex.END_TOKEN)
37 {
38 return value;
39 }
40 else
41 {
42 lexer.ThrowExpectationFailure(lexer.GetSpan(), GetEndTokenInfo());
43 }
44 }
45 else
46 {
47 lexer.ThrowExpectationFailure(span, u"ParserFile");
48 }
49 return value;
50 }
51 public static Match ParserFile(ParserFileLexer& lexer, ParsingContext* parsingContext)
52 {
53 #if (DEBUG)
54 Span debugSpan;
55 bool writeToLog = lexer.Log() != null;
56 if (writeToLog)
57 {
58 debugSpan = lexer.GetSpan();
59 System.Lex.WriteBeginRuleToLog(lexer, u"ParserFile");
60 }
61 #endif
62 UniquePtr<soulcm.scmpg.ParserFile> parserFile;
63 Match match(false);
64 Match* parentMatch0 = &match;
65 {
66 long pos = lexer.GetPos();
67 Match match(false);
68 Match* parentMatch1 = &match;
69 {
70 Match match(false);
71 Match* parentMatch2 = &match;
72 {
73 Match match(false);
74 Match* parentMatch3 = &match;
75 {
76 long pos = lexer.GetPos();
77 Match match(true);
78 if (match.hit)
79 {
80 parserFile.Reset(new soulcm.scmpg.ParserFile(lexer.FileName()));
81 }
82 *parentMatch3 = match;
83 }
84 *parentMatch2 = match;
85 }
86 if (match.hit)
87 {
88 Match match(false);
89 Match* parentMatch4 = &match;
90 {
91 Match match(true);
92 Match* parentMatch5 = &match;
93 {
94 while (true)
95 {
96 long save = lexer.GetPos();
97 {
98 Match match = ParserFileParser.Declaration(lexer, parserFile.Get(), parsingContext);
99 if (match.hit)
100 {
101 *parentMatch5 = match;
102 }
103 else
104 {
105 lexer.SetPos(save);
106 break;
107 }
108 }
109 }
110 }
111 *parentMatch4 = match;
112 }
113 *parentMatch2 = match;
114 }
115 *parentMatch1 = match;
116 }
117 if (match.hit)
118 {
119 {
120 #if (DEBUG)
121 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParserFile");
122 #endif
123 return Match(true, parserFile.Release());
124 }
125 }
126 *parentMatch0 = match;
127 }
128 #if (DEBUG)
129 if (writeToLog)
130 {
131 if (match.hit)
132 {
133 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParserFile");
134 }
135 else
136 {
137 System.Lex.WriteFailureToLog(lexer, u"ParserFile");
138 }
139 }
140 #endif
141 if (!match.hit)
142 {
143 match.value = null;
144 }
145 return match;
146 }
147 public static Match Declaration(ParserFileLexer& lexer, soulcm.scmpg.ParserFile* parserFile, ParsingContext* parsingContext)
148 {
149 #if (DEBUG)
150 Span debugSpan;
151 bool writeToLog = lexer.Log() != null;
152 if (writeToLog)
153 {
154 debugSpan = lexer.GetSpan();
155 System.Lex.WriteBeginRuleToLog(lexer, u"Declaration");
156 }
157 #endif
158 UniquePtr<Node> usingDirective;
159 UniquePtr<soulcm.scmpg.GrammarParser> parserDeclaration;
160 Match match(false);
161 Match* parentMatch0 = &match;
162 {
163 long save = lexer.GetPos();
164 Match match(false);
165 Match* parentMatch1 = &match;
166 {
167 long pos = lexer.GetPos();
168 Match match = ParserFileParser.UsingDirective(lexer, parsingContext);
169 usingDirective.Reset(cast<Node*>(match.value));
170 if (match.hit)
171 {
172 parserFile->AddUsingDirective(usingDirective.Release());
173 }
174 *parentMatch1 = match;
175 }
176 *parentMatch0 = match;
177 if (!match.hit)
178 {
179 Match match(false);
180 Match* parentMatch2 = &match;
181 lexer.SetPos(save);
182 {
183 Match match(false);
184 Match* parentMatch3 = &match;
185 {
186 long pos = lexer.GetPos();
187 Match match = ParserFileParser.ParserDeclaration(lexer, parsingContext);
188 parserDeclaration.Reset(cast<soulcm.scmpg.GrammarParser*>(match.value));
189 if (match.hit)
190 {
191 parserFile->AddParser(parserDeclaration.Release());
192 }
193 *parentMatch3 = match;
194 }
195 *parentMatch2 = match;
196 }
197 *parentMatch0 = match;
198 }
199 }
200 #if (DEBUG)
201 if (writeToLog)
202 {
203 if (match.hit)
204 {
205 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Declaration");
206 }
207 else
208 {
209 System.Lex.WriteFailureToLog(lexer, u"Declaration");
210 }
211 }
212 #endif
213 if (!match.hit)
214 {
215 match.value = null;
216 }
217 return match;
218 }
219 public static Match UsingDirective(ParserFileLexer& lexer, ParsingContext* ctx)
220 {
221 #if (DEBUG)
222 Span debugSpan;
223 bool writeToLog = lexer.Log() != null;
224 if (writeToLog)
225 {
226 debugSpan = lexer.GetSpan();
227 System.Lex.WriteBeginRuleToLog(lexer, u"UsingDirective");
228 }
229 #endif
230 UniquePtr<Node> usingAlias;
231 UniquePtr<Node> usingNs;
232 Match match(false);
233 Match* parentMatch0 = &match;
234 {
235 long save = lexer.GetPos();
236 Match match(false);
237 Match* parentMatch1 = &match;
238 {
239 long pos = lexer.GetPos();
240 Match match = ParserFileParser.UsingAliasDirective(lexer, ctx);
241 usingAlias.Reset(cast<Node*>(match.value));
242 if (match.hit)
243 {
244 {
245 #if (DEBUG)
246 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingDirective");
247 #endif
248 return Match(true, usingAlias.Release());
249 }
250 }
251 *parentMatch1 = match;
252 }
253 *parentMatch0 = match;
254 if (!match.hit)
255 {
256 Match match(false);
257 Match* parentMatch2 = &match;
258 lexer.SetPos(save);
259 {
260 Match match(false);
261 Match* parentMatch3 = &match;
262 {
263 long pos = lexer.GetPos();
264 Match match = ParserFileParser.UsingNamespaceDirective(lexer, ctx);
265 usingNs.Reset(cast<Node*>(match.value));
266 if (match.hit)
267 {
268 {
269 #if (DEBUG)
270 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingDirective");
271 #endif
272 return Match(true, usingNs.Release());
273 }
274 }
275 *parentMatch3 = match;
276 }
277 *parentMatch2 = match;
278 }
279 *parentMatch0 = match;
280 }
281 }
282 #if (DEBUG)
283 if (writeToLog)
284 {
285 if (match.hit)
286 {
287 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingDirective");
288 }
289 else
290 {
291 System.Lex.WriteFailureToLog(lexer, u"UsingDirective");
292 }
293 }
294 #endif
295 if (!match.hit)
296 {
297 match.value = null;
298 }
299 return match;
300 }
301 public static Match UsingAliasDirective(ParserFileLexer& lexer, ParsingContext* ctx)
302 {
303 #if (DEBUG)
304 Span debugSpan;
305 bool writeToLog = lexer.Log() != null;
306 if (writeToLog)
307 {
308 debugSpan = lexer.GetSpan();
309 System.Lex.WriteBeginRuleToLog(lexer, u"UsingAliasDirective");
310 }
311 #endif
312 Span s;
313 UniquePtr<IdentifierNode> id;
314 UniquePtr<IdentifierNode> qid;
315 Match match(false);
316 Match* parentMatch0 = &match;
317 {
318 Match match(false);
319 Match* parentMatch1 = &match;
320 {
321 Match match(false);
322 Match* parentMatch2 = &match;
323 {
324 Match match(false);
325 Match* parentMatch3 = &match;
326 {
327 Match match(false);
328 Match* parentMatch4 = &match;
329 {
330 long pos = lexer.GetPos();
331 Span span = lexer.GetSpan();
332 Match match(false);
333 if (*lexer == USING)
334 {
335 ++lexer;
336 match.hit = true;
337 }
338 if (match.hit)
339 {
340 s = span;
341 }
342 *parentMatch4 = match;
343 }
344 *parentMatch3 = match;
345 }
346 if (match.hit)
347 {
348 Match match(false);
349 Match* parentMatch5 = &match;
350 {
351 Match match = IdentifierParser.Identifier(lexer, ctx);
352 id.Reset(cast<IdentifierNode*>(match.value));
353 *parentMatch5 = match;
354 }
355 *parentMatch3 = match;
356 }
357 *parentMatch2 = match;
358 }
359 if (match.hit)
360 {
361 Match match(false);
362 Match* parentMatch6 = &match;
363 {
364 Match match(false);
365 if (*lexer == ASSIGN)
366 {
367 ++lexer;
368 match.hit = true;
369 }
370 *parentMatch6 = match;
371 }
372 *parentMatch2 = match;
373 }
374 *parentMatch1 = match;
375 }
376 if (match.hit)
377 {
378 Match match(false);
379 Match* parentMatch7 = &match;
380 {
381 Match match(true);
382 Match* parentMatch8 = &match;
383 {
384 System.Lex.Span span = lexer.GetSpan();
385 Match match = IdentifierParser.QualifiedId(lexer, ctx);
386 qid.Reset(cast<IdentifierNode*>(match.value));
387 if (match.hit)
388 {
389 *parentMatch8 = match;
390 }
391 else
392 {
393 lexer.ThrowExpectationFailure(span, u"identifier");
394 }
395 }
396 *parentMatch7 = match;
397 }
398 *parentMatch1 = match;
399 }
400 *parentMatch0 = match;
401 }
402 if (match.hit)
403 {
404 Match match(false);
405 Match* parentMatch9 = &match;
406 {
407 Match match(false);
408 Match* parentMatch10 = &match;
409 {
410 long pos = lexer.GetPos();
411 Span span = lexer.GetSpan();
412 Match match(true);
413 Match* parentMatch11 = &match;
414 {
415 System.Lex.Span span = lexer.GetSpan();
416 Match match(false);
417 if (*lexer == SEMICOLON)
418 {
419 ++lexer;
420 match.hit = true;
421 }
422 if (match.hit)
423 {
424 *parentMatch11 = match;
425 }
426 else
427 {
428 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
429 }
430 }
431 if (match.hit)
432 {
433 s.end = span.end;
434 {
435 #if (DEBUG)
436 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingAliasDirective");
437 #endif
438 return Match(true, new AliasNode(s, ctx->ModuleId(), id.Release(), qid.Release()));
439 }
440 }
441 *parentMatch10 = match;
442 }
443 *parentMatch9 = match;
444 }
445 *parentMatch0 = match;
446 }
447 #if (DEBUG)
448 if (writeToLog)
449 {
450 if (match.hit)
451 {
452 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingAliasDirective");
453 }
454 else
455 {
456 System.Lex.WriteFailureToLog(lexer, u"UsingAliasDirective");
457 }
458 }
459 #endif
460 if (!match.hit)
461 {
462 match.value = null;
463 }
464 return match;
465 }
466 public static Match UsingNamespaceDirective(ParserFileLexer& lexer, ParsingContext* ctx)
467 {
468 #if (DEBUG)
469 Span debugSpan;
470 bool writeToLog = lexer.Log() != null;
471 if (writeToLog)
472 {
473 debugSpan = lexer.GetSpan();
474 System.Lex.WriteBeginRuleToLog(lexer, u"UsingNamespaceDirective");
475 }
476 #endif
477 Span s;
478 UniquePtr<IdentifierNode> ns;
479 Match match(false);
480 Match* parentMatch0 = &match;
481 {
482 Match match(false);
483 Match* parentMatch1 = &match;
484 {
485 Match match(false);
486 Match* parentMatch2 = &match;
487 {
488 long pos = lexer.GetPos();
489 Span span = lexer.GetSpan();
490 Match match(false);
491 if (*lexer == USING)
492 {
493 ++lexer;
494 match.hit = true;
495 }
496 if (match.hit)
497 {
498 s = span;
499 }
500 *parentMatch2 = match;
501 }
502 *parentMatch1 = match;
503 }
504 if (match.hit)
505 {
506 Match match(false);
507 Match* parentMatch3 = &match;
508 {
509 Match match(true);
510 Match* parentMatch4 = &match;
511 {
512 System.Lex.Span span = lexer.GetSpan();
513 Match match = IdentifierParser.QualifiedId(lexer, ctx);
514 ns.Reset(cast<IdentifierNode*>(match.value));
515 if (match.hit)
516 {
517 *parentMatch4 = match;
518 }
519 else
520 {
521 lexer.ThrowExpectationFailure(span, u"identifier");
522 }
523 }
524 *parentMatch3 = match;
525 }
526 *parentMatch1 = match;
527 }
528 *parentMatch0 = match;
529 }
530 if (match.hit)
531 {
532 Match match(false);
533 Match* parentMatch5 = &match;
534 {
535 Match match(false);
536 Match* parentMatch6 = &match;
537 {
538 long pos = lexer.GetPos();
539 Span span = lexer.GetSpan();
540 Match match(true);
541 Match* parentMatch7 = &match;
542 {
543 System.Lex.Span span = lexer.GetSpan();
544 Match match(false);
545 if (*lexer == SEMICOLON)
546 {
547 ++lexer;
548 match.hit = true;
549 }
550 if (match.hit)
551 {
552 *parentMatch7 = match;
553 }
554 else
555 {
556 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
557 }
558 }
559 if (match.hit)
560 {
561 s.end = span.end;
562 {
563 #if (DEBUG)
564 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingNamespaceDirective");
565 #endif
566 return Match(true, new NamespaceImportNode(s, ctx->ModuleId(), ns.Release()));
567 }
568 }
569 *parentMatch6 = match;
570 }
571 *parentMatch5 = match;
572 }
573 *parentMatch0 = match;
574 }
575 #if (DEBUG)
576 if (writeToLog)
577 {
578 if (match.hit)
579 {
580 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingNamespaceDirective");
581 }
582 else
583 {
584 System.Lex.WriteFailureToLog(lexer, u"UsingNamespaceDirective");
585 }
586 }
587 #endif
588 if (!match.hit)
589 {
590 match.value = null;
591 }
592 return match;
593 }
594 public static Match ParserDeclaration(ParserFileLexer& lexer, ParsingContext* parsingContext)
595 {
596 #if (DEBUG)
597 Span debugSpan;
598 bool writeToLog = lexer.Log() != null;
599 if (writeToLog)
600 {
601 debugSpan = lexer.GetSpan();
602 System.Lex.WriteBeginRuleToLog(lexer, u"ParserDeclaration");
603 }
604 #endif
605 UniquePtr<soulcm.scmpg.GrammarParser> grammarParser;
606 Match match(false);
607 Match* parentMatch0 = &match;
608 {
609 long pos = lexer.GetPos();
610 Match match(false);
611 Match* parentMatch1 = &match;
612 {
613 Match match(false);
614 Match* parentMatch2 = &match;
615 {
616 Match match(false);
617 Match* parentMatch3 = &match;
618 {
619 Match match(false);
620 Match* parentMatch4 = &match;
621 {
622 Match match(false);
623 Match* parentMatch5 = &match;
624 {
625 Match match(false);
626 if (*lexer == PARSER)
627 {
628 ++lexer;
629 match.hit = true;
630 }
631 *parentMatch5 = match;
632 }
633 if (match.hit)
634 {
635 Match match(false);
636 Match* parentMatch6 = &match;
637 {
638 Match match(false);
639 Match* parentMatch7 = &match;
640 {
641 long pos = lexer.GetPos();
642 Span span = lexer.GetSpan();
643 Match match(false);
644 if (*lexer == ID)
645 {
646 ++lexer;
647 match.hit = true;
648 }
649 if (match.hit)
650 {
651 grammarParser.Reset(new soulcm.scmpg.GrammarParser(lexer.GetMatch(span), u""));
652 }
653 *parentMatch7 = match;
654 }
655 *parentMatch6 = match;
656 }
657 *parentMatch5 = match;
658 }
659 *parentMatch4 = match;
660 }
661 if (match.hit)
662 {
663 Match match(false);
664 Match* parentMatch8 = &match;
665 {
666 Match match(true);
667 Match* parentMatch9 = &match;
668 {
669 System.Lex.Span span = lexer.GetSpan();
670 Match match(false);
671 if (*lexer == LBRACE)
672 {
673 ++lexer;
674 match.hit = true;
675 }
676 if (match.hit)
677 {
678 *parentMatch9 = match;
679 }
680 else
681 {
682 lexer.ThrowExpectationFailure(span, GetTokenName(LBRACE));
683 }
684 }
685 *parentMatch8 = match;
686 }
687 *parentMatch4 = match;
688 }
689 *parentMatch3 = match;
690 }
691 if (match.hit)
692 {
693 Match match(false);
694 Match* parentMatch10 = &match;
695 {
696 Match match(true);
697 Match* parentMatch11 = &match;
698 {
699 while (true)
700 {
701 long save = lexer.GetPos();
702 {
703 Match match = ParserFileParser.Statement(lexer, grammarParser.Get(), parsingContext);
704 if (match.hit)
705 {
706 *parentMatch11 = match;
707 }
708 else
709 {
710 lexer.SetPos(save);
711 break;
712 }
713 }
714 }
715 }
716 *parentMatch10 = match;
717 }
718 *parentMatch3 = match;
719 }
720 *parentMatch2 = match;
721 }
722 if (match.hit)
723 {
724 Match match(false);
725 Match* parentMatch12 = &match;
726 {
727 Match match(true);
728 Match* parentMatch13 = &match;
729 {
730 System.Lex.Span span = lexer.GetSpan();
731 Match match(false);
732 if (*lexer == RBRACE)
733 {
734 ++lexer;
735 match.hit = true;
736 }
737 if (match.hit)
738 {
739 *parentMatch13 = match;
740 }
741 else
742 {
743 lexer.ThrowExpectationFailure(span, GetTokenName(RBRACE));
744 }
745 }
746 *parentMatch12 = match;
747 }
748 *parentMatch2 = match;
749 }
750 *parentMatch1 = match;
751 }
752 if (match.hit)
753 {
754 {
755 #if (DEBUG)
756 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParserDeclaration");
757 #endif
758 return Match(true, grammarParser.Release());
759 }
760 }
761 *parentMatch0 = match;
762 }
763 #if (DEBUG)
764 if (writeToLog)
765 {
766 if (match.hit)
767 {
768 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParserDeclaration");
769 }
770 else
771 {
772 System.Lex.WriteFailureToLog(lexer, u"ParserDeclaration");
773 }
774 }
775 #endif
776 if (!match.hit)
777 {
778 match.value = null;
779 }
780 return match;
781 }
782 public static Match Statement(ParserFileLexer& lexer, soulcm.scmpg.GrammarParser* grammarParser, ParsingContext* parsingContext)
783 {
784 #if (DEBUG)
785 Span debugSpan;
786 bool writeToLog = lexer.Log() != null;
787 if (writeToLog)
788 {
789 debugSpan = lexer.GetSpan();
790 System.Lex.WriteBeginRuleToLog(lexer, u"Statement");
791 }
792 #endif
793 Match match(false);
794 Match* parentMatch0 = &match;
795 {
796 long save = lexer.GetPos();
797 Match match(false);
798 Match* parentMatch1 = &match;
799 {
800 long save = lexer.GetPos();
801 Match match(false);
802 Match* parentMatch2 = &match;
803 {
804 long save = lexer.GetPos();
805 Match match(false);
806 Match* parentMatch3 = &match;
807 {
808 long save = lexer.GetPos();
809 Match match(false);
810 Match* parentMatch4 = &match;
811 {
812 long save = lexer.GetPos();
813 Match match(false);
814 Match* parentMatch5 = &match;
815 {
816 long save = lexer.GetPos();
817 Match match(false);
818 Match* parentMatch6 = &match;
819 {
820 long save = lexer.GetPos();
821 Match match(false);
822 Match* parentMatch7 = &match;
823 {
824 long save = lexer.GetPos();
825 Match match = ParserFileParser.MainStatement(lexer, grammarParser);
826 *parentMatch7 = match;
827 if (!match.hit)
828 {
829 Match match(false);
830 Match* parentMatch8 = &match;
831 lexer.SetPos(save);
832 {
833 Match match = ParserFileParser.StartStatement(lexer, grammarParser);
834 *parentMatch8 = match;
835 }
836 *parentMatch7 = match;
837 }
838 }
839 *parentMatch6 = match;
840 if (!match.hit)
841 {
842 Match match(false);
843 Match* parentMatch9 = &match;
844 lexer.SetPos(save);
845 {
846 Match match = ParserFileParser.NothrowStatement(lexer, grammarParser);
847 *parentMatch9 = match;
848 }
849 *parentMatch6 = match;
850 }
851 }
852 *parentMatch5 = match;
853 if (!match.hit)
854 {
855 Match match(false);
856 Match* parentMatch10 = &match;
857 lexer.SetPos(save);
858 {
859 Match match = ParserFileParser.FarthestErrorStatement(lexer, grammarParser);
860 *parentMatch10 = match;
861 }
862 *parentMatch5 = match;
863 }
864 }
865 *parentMatch4 = match;
866 if (!match.hit)
867 {
868 Match match(false);
869 Match* parentMatch11 = &match;
870 lexer.SetPos(save);
871 {
872 Match match = ParserFileParser.StateStatement(lexer, grammarParser);
873 *parentMatch11 = match;
874 }
875 *parentMatch4 = match;
876 }
877 }
878 *parentMatch3 = match;
879 if (!match.hit)
880 {
881 Match match(false);
882 Match* parentMatch12 = &match;
883 lexer.SetPos(save);
884 {
885 Match match = ParserFileParser.UsingStatement(lexer, grammarParser);
886 *parentMatch12 = match;
887 }
888 *parentMatch3 = match;
889 }
890 }
891 *parentMatch2 = match;
892 if (!match.hit)
893 {
894 Match match(false);
895 Match* parentMatch13 = &match;
896 lexer.SetPos(save);
897 {
898 Match match = ParserFileParser.LexerStatement(lexer, grammarParser);
899 *parentMatch13 = match;
900 }
901 *parentMatch2 = match;
902 }
903 }
904 *parentMatch1 = match;
905 if (!match.hit)
906 {
907 Match match(false);
908 Match* parentMatch14 = &match;
909 lexer.SetPos(save);
910 {
911 Match match = ParserFileParser.RuleInfoStatement(lexer, grammarParser);
912 *parentMatch14 = match;
913 }
914 *parentMatch1 = match;
915 }
916 }
917 *parentMatch0 = match;
918 if (!match.hit)
919 {
920 Match match(false);
921 Match* parentMatch15 = &match;
922 lexer.SetPos(save);
923 {
924 Match match = ParserFileParser.RuleStatement(lexer, grammarParser, parsingContext);
925 *parentMatch15 = match;
926 }
927 *parentMatch0 = match;
928 }
929 }
930 #if (DEBUG)
931 if (writeToLog)
932 {
933 if (match.hit)
934 {
935 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Statement");
936 }
937 else
938 {
939 System.Lex.WriteFailureToLog(lexer, u"Statement");
940 }
941 }
942 #endif
943 if (!match.hit)
944 {
945 match.value = null;
946 }
947 return match;
948 }
949 public static Match MainStatement(ParserFileLexer& lexer, soulcm.scmpg.GrammarParser* grammarParser)
950 {
951 #if (DEBUG)
952 Span debugSpan;
953 bool writeToLog = lexer.Log() != null;
954 if (writeToLog)
955 {
956 debugSpan = lexer.GetSpan();
957 System.Lex.WriteBeginRuleToLog(lexer, u"MainStatement");
958 }
959 #endif
960 Match match(false);
961 Match* parentMatch0 = &match;
962 {
963 Match match(false);
964 if (*lexer == MAIN)
965 {
966 ++lexer;
967 match.hit = true;
968 }
969 *parentMatch0 = match;
970 }
971 if (match.hit)
972 {
973 Match match(false);
974 Match* parentMatch1 = &match;
975 {
976 Match match(false);
977 Match* parentMatch2 = &match;
978 {
979 long pos = lexer.GetPos();
980 Match match(true);
981 Match* parentMatch3 = &match;
982 {
983 System.Lex.Span span = lexer.GetSpan();
984 Match match(false);
985 if (*lexer == SEMICOLON)
986 {
987 ++lexer;
988 match.hit = true;
989 }
990 if (match.hit)
991 {
992 *parentMatch3 = match;
993 }
994 else
995 {
996 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
997 }
998 }
999 if (match.hit)
1000 {
1001 grammarParser->SetMain();
1002 }
1003 *parentMatch2 = match;
1004 }
1005 *parentMatch1 = match;
1006 }
1007 *parentMatch0 = match;
1008 }
1009 #if (DEBUG)
1010 if (writeToLog)
1011 {
1012 if (match.hit)
1013 {
1014 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MainStatement");
1015 }
1016 else
1017 {
1018 System.Lex.WriteFailureToLog(lexer, u"MainStatement");
1019 }
1020 }
1021 #endif
1022 if (!match.hit)
1023 {
1024 match.value = null;
1025 }
1026 return match;
1027 }
1028 public static Match StartStatement(ParserFileLexer& lexer, soulcm.scmpg.GrammarParser* grammarParser)
1029 {
1030 #if (DEBUG)
1031 Span debugSpan;
1032 bool writeToLog = lexer.Log() != null;
1033 if (writeToLog)
1034 {
1035 debugSpan = lexer.GetSpan();
1036 System.Lex.WriteBeginRuleToLog(lexer, u"StartStatement");
1037 }
1038 #endif
1039 Match match(false);
1040 Match* parentMatch0 = &match;
1041 {
1042 Match match(false);
1043 if (*lexer == START)
1044 {
1045 ++lexer;
1046 match.hit = true;
1047 }
1048 *parentMatch0 = match;
1049 }
1050 if (match.hit)
1051 {
1052 Match match(false);
1053 Match* parentMatch1 = &match;
1054 {
1055 Match match(false);
1056 Match* parentMatch2 = &match;
1057 {
1058 long pos = lexer.GetPos();
1059 Match match(true);
1060 Match* parentMatch3 = &match;
1061 {
1062 System.Lex.Span span = lexer.GetSpan();
1063 Match match(false);
1064 if (*lexer == SEMICOLON)
1065 {
1066 ++lexer;
1067 match.hit = true;
1068 }
1069 if (match.hit)
1070 {
1071 *parentMatch3 = match;
1072 }
1073 else
1074 {
1075 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
1076 }
1077 }
1078 if (match.hit)
1079 {
1080 grammarParser->SetStart();
1081 }
1082 *parentMatch2 = match;
1083 }
1084 *parentMatch1 = match;
1085 }
1086 *parentMatch0 = match;
1087 }
1088 #if (DEBUG)
1089 if (writeToLog)
1090 {
1091 if (match.hit)
1092 {
1093 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StartStatement");
1094 }
1095 else
1096 {
1097 System.Lex.WriteFailureToLog(lexer, u"StartStatement");
1098 }
1099 }
1100 #endif
1101 if (!match.hit)
1102 {
1103 match.value = null;
1104 }
1105 return match;
1106 }
1107 public static Match NothrowStatement(ParserFileLexer& lexer, soulcm.scmpg.GrammarParser* grammarParser)
1108 {
1109 #if (DEBUG)
1110 Span debugSpan;
1111 bool writeToLog = lexer.Log() != null;
1112 if (writeToLog)
1113 {
1114 debugSpan = lexer.GetSpan();
1115 System.Lex.WriteBeginRuleToLog(lexer, u"NothrowStatement");
1116 }
1117 #endif
1118 Match match(false);
1119 Match* parentMatch0 = &match;
1120 {
1121 Match match(false);
1122 if (*lexer == NOTHROW)
1123 {
1124 ++lexer;
1125 match.hit = true;
1126 }
1127 *parentMatch0 = match;
1128 }
1129 if (match.hit)
1130 {
1131 Match match(false);
1132 Match* parentMatch1 = &match;
1133 {
1134 Match match(false);
1135 Match* parentMatch2 = &match;
1136 {
1137 long pos = lexer.GetPos();
1138 Match match(true);
1139 Match* parentMatch3 = &match;
1140 {
1141 System.Lex.Span span = lexer.GetSpan();
1142 Match match(false);
1143 if (*lexer == SEMICOLON)
1144 {
1145 ++lexer;
1146 match.hit = true;
1147 }
1148 if (match.hit)
1149 {
1150 *parentMatch3 = match;
1151 }
1152 else
1153 {
1154 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
1155 }
1156 }
1157 if (match.hit)
1158 {
1159 grammarParser->SetNothrow();
1160 }
1161 *parentMatch2 = match;
1162 }
1163 *parentMatch1 = match;
1164 }
1165 *parentMatch0 = match;
1166 }
1167 #if (DEBUG)
1168 if (writeToLog)
1169 {
1170 if (match.hit)
1171 {
1172 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NothrowStatement");
1173 }
1174 else
1175 {
1176 System.Lex.WriteFailureToLog(lexer, u"NothrowStatement");
1177 }
1178 }
1179 #endif
1180 if (!match.hit)
1181 {
1182 match.value = null;
1183 }
1184 return match;
1185 }
1186 public static Match FarthestErrorStatement(ParserFileLexer& lexer, soulcm.scmpg.GrammarParser* grammarParser)
1187 {
1188 #if (DEBUG)
1189 Span debugSpan;
1190 bool writeToLog = lexer.Log() != null;
1191 if (writeToLog)
1192 {
1193 debugSpan = lexer.GetSpan();
1194 System.Lex.WriteBeginRuleToLog(lexer, u"FarthestErrorStatement");
1195 }
1196 #endif
1197 Match match(false);
1198 Match* parentMatch0 = &match;
1199 {
1200 Match match(false);
1201 if (*lexer == FARTHEST_ERROR)
1202 {
1203 ++lexer;
1204 match.hit = true;
1205 }
1206 *parentMatch0 = match;
1207 }
1208 if (match.hit)
1209 {
1210 Match match(false);
1211 Match* parentMatch1 = &match;
1212 {
1213 Match match(false);
1214 Match* parentMatch2 = &match;
1215 {
1216 long pos = lexer.GetPos();
1217 Match match(true);
1218 Match* parentMatch3 = &match;
1219 {
1220 System.Lex.Span span = lexer.GetSpan();
1221 Match match(false);
1222 if (*lexer == SEMICOLON)
1223 {
1224 ++lexer;
1225 match.hit = true;
1226 }
1227 if (match.hit)
1228 {
1229 *parentMatch3 = match;
1230 }
1231 else
1232 {
1233 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
1234 }
1235 }
1236 if (match.hit)
1237 {
1238 grammarParser->SetFarthestError();
1239 }
1240 *parentMatch2 = match;
1241 }
1242 *parentMatch1 = match;
1243 }
1244 *parentMatch0 = match;
1245 }
1246 #if (DEBUG)
1247 if (writeToLog)
1248 {
1249 if (match.hit)
1250 {
1251 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FarthestErrorStatement");
1252 }
1253 else
1254 {
1255 System.Lex.WriteFailureToLog(lexer, u"FarthestErrorStatement");
1256 }
1257 }
1258 #endif
1259 if (!match.hit)
1260 {
1261 match.value = null;
1262 }
1263 return match;
1264 }
1265 public static Match StateStatement(ParserFileLexer& lexer, soulcm.scmpg.GrammarParser* grammarParser)
1266 {
1267 #if (DEBUG)
1268 Span debugSpan;
1269 bool writeToLog = lexer.Log() != null;
1270 if (writeToLog)
1271 {
1272 debugSpan = lexer.GetSpan();
1273 System.Lex.WriteBeginRuleToLog(lexer, u"StateStatement");
1274 }
1275 #endif
1276 Match match(false);
1277 Match* parentMatch0 = &match;
1278 {
1279 Match match(false);
1280 if (*lexer == STATE)
1281 {
1282 ++lexer;
1283 match.hit = true;
1284 }
1285 *parentMatch0 = match;
1286 }
1287 if (match.hit)
1288 {
1289 Match match(false);
1290 Match* parentMatch1 = &match;
1291 {
1292 Match match(false);
1293 Match* parentMatch2 = &match;
1294 {
1295 long pos = lexer.GetPos();
1296 Match match(true);
1297 Match* parentMatch3 = &match;
1298 {
1299 System.Lex.Span span = lexer.GetSpan();
1300 Match match(false);
1301 if (*lexer == SEMICOLON)
1302 {
1303 ++lexer;
1304 match.hit = true;
1305 }
1306 if (match.hit)
1307 {
1308 *parentMatch3 = match;
1309 }
1310 else
1311 {
1312 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
1313 }
1314 }
1315 if (match.hit)
1316 {
1317 grammarParser->SetState();
1318 }
1319 *parentMatch2 = match;
1320 }
1321 *parentMatch1 = match;
1322 }
1323 *parentMatch0 = match;
1324 }
1325 #if (DEBUG)
1326 if (writeToLog)
1327 {
1328 if (match.hit)
1329 {
1330 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StateStatement");
1331 }
1332 else
1333 {
1334 System.Lex.WriteFailureToLog(lexer, u"StateStatement");
1335 }
1336 }
1337 #endif
1338 if (!match.hit)
1339 {
1340 match.value = null;
1341 }
1342 return match;
1343 }
1344 public static Match UsingStatement(ParserFileLexer& lexer, soulcm.scmpg.GrammarParser* grammarParser)
1345 {
1346 #if (DEBUG)
1347 Span debugSpan;
1348 bool writeToLog = lexer.Log() != null;
1349 if (writeToLog)
1350 {
1351 debugSpan = lexer.GetSpan();
1352 System.Lex.WriteBeginRuleToLog(lexer, u"UsingStatement");
1353 }
1354 #endif
1355 UniquePtr<Value<ustring>> parserId;
1356 Match match(false);
1357 Match* parentMatch0 = &match;
1358 {
1359 Match match(false);
1360 Match* parentMatch1 = &match;
1361 {
1362 Match match(false);
1363 if (*lexer == USING)
1364 {
1365 ++lexer;
1366 match.hit = true;
1367 }
1368 *parentMatch1 = match;
1369 }
1370 if (match.hit)
1371 {
1372 Match match(false);
1373 Match* parentMatch2 = &match;
1374 {
1375 Match match(true);
1376 Match* parentMatch3 = &match;
1377 {
1378 System.Lex.Span span = lexer.GetSpan();
1379 Match match = ParserFileParser.UsingQualifiedId(lexer);
1380 parserId.Reset(cast<Value<ustring>*>(match.value));
1381 if (match.hit)
1382 {
1383 *parentMatch3 = match;
1384 }
1385 else
1386 {
1387 lexer.ThrowExpectationFailure(span, u"UsingQualifiedId");
1388 }
1389 }
1390 *parentMatch2 = match;
1391 }
1392 *parentMatch1 = match;
1393 }
1394 *parentMatch0 = match;
1395 }
1396 if (match.hit)
1397 {
1398 Match match(false);
1399 Match* parentMatch4 = &match;
1400 {
1401 Match match(false);
1402 Match* parentMatch5 = &match;
1403 {
1404 long pos = lexer.GetPos();
1405 Match match(true);
1406 Match* parentMatch6 = &match;
1407 {
1408 System.Lex.Span span = lexer.GetSpan();
1409 Match match(false);
1410 if (*lexer == SEMICOLON)
1411 {
1412 ++lexer;
1413 match.hit = true;
1414 }
1415 if (match.hit)
1416 {
1417 *parentMatch6 = match;
1418 }
1419 else
1420 {
1421 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
1422 }
1423 }
1424 if (match.hit)
1425 {
1426 grammarParser->AddUsing(parserId->value);
1427 }
1428 *parentMatch5 = match;
1429 }
1430 *parentMatch4 = match;
1431 }
1432 *parentMatch0 = match;
1433 }
1434 #if (DEBUG)
1435 if (writeToLog)
1436 {
1437 if (match.hit)
1438 {
1439 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingStatement");
1440 }
1441 else
1442 {
1443 System.Lex.WriteFailureToLog(lexer, u"UsingStatement");
1444 }
1445 }
1446 #endif
1447 if (!match.hit)
1448 {
1449 match.value = null;
1450 }
1451 return match;
1452 }
1453 public static Match UsingQualifiedId(ParserFileLexer& lexer)
1454 {
1455 #if (DEBUG)
1456 Span debugSpan;
1457 bool writeToLog = lexer.Log() != null;
1458 if (writeToLog)
1459 {
1460 debugSpan = lexer.GetSpan();
1461 System.Lex.WriteBeginRuleToLog(lexer, u"UsingQualifiedId");
1462 }
1463 #endif
1464 Span s;
1465 Match match(false);
1466 Match* parentMatch0 = &match;
1467 {
1468 long pos = lexer.GetPos();
1469 Match match(false);
1470 Match* parentMatch1 = &match;
1471 {
1472 Match match(false);
1473 Match* parentMatch2 = &match;
1474 {
1475 Match match(false);
1476 Match* parentMatch3 = &match;
1477 {
1478 long pos = lexer.GetPos();
1479 Span span = lexer.GetSpan();
1480 Match match(false);
1481 if (*lexer == ID)
1482 {
1483 ++lexer;
1484 match.hit = true;
1485 }
1486 if (match.hit)
1487 {
1488 s = span;
1489 }
1490 *parentMatch3 = match;
1491 }
1492 *parentMatch2 = match;
1493 }
1494 if (match.hit)
1495 {
1496 Match match(false);
1497 Match* parentMatch4 = &match;
1498 {
1499 Match match(true);
1500 Match* parentMatch5 = &match;
1501 {
1502 while (true)
1503 {
1504 long save = lexer.GetPos();
1505 {
1506 Match match(false);
1507 Match* parentMatch6 = &match;
1508 {
1509 Match match(false);
1510 Match* parentMatch7 = &match;
1511 {
1512 Match match(false);
1513 if (*lexer == DOT)
1514 {
1515 ++lexer;
1516 match.hit = true;
1517 }
1518 *parentMatch7 = match;
1519 }
1520 if (match.hit)
1521 {
1522 Match match(false);
1523 Match* parentMatch8 = &match;
1524 {
1525 Match match(false);
1526 Match* parentMatch9 = &match;
1527 {
1528 long pos = lexer.GetPos();
1529 Span span = lexer.GetSpan();
1530 Match match(false);
1531 if (*lexer == ID)
1532 {
1533 ++lexer;
1534 match.hit = true;
1535 }
1536 if (match.hit)
1537 {
1538 s.end = span.end;
1539 }
1540 *parentMatch9 = match;
1541 }
1542 *parentMatch8 = match;
1543 }
1544 *parentMatch7 = match;
1545 }
1546 *parentMatch6 = match;
1547 }
1548 if (match.hit)
1549 {
1550 *parentMatch5 = match;
1551 }
1552 else
1553 {
1554 lexer.SetPos(save);
1555 break;
1556 }
1557 }
1558 }
1559 }
1560 *parentMatch4 = match;
1561 }
1562 *parentMatch2 = match;
1563 }
1564 *parentMatch1 = match;
1565 }
1566 if (match.hit)
1567 {
1568 {
1569 #if (DEBUG)
1570 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingQualifiedId");
1571 #endif
1572 return Match(true, new Value<ustring>(lexer.GetMatch(s)));
1573 }
1574 }
1575 *parentMatch0 = match;
1576 }
1577 #if (DEBUG)
1578 if (writeToLog)
1579 {
1580 if (match.hit)
1581 {
1582 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingQualifiedId");
1583 }
1584 else
1585 {
1586 System.Lex.WriteFailureToLog(lexer, u"UsingQualifiedId");
1587 }
1588 }
1589 #endif
1590 if (!match.hit)
1591 {
1592 match.value = null;
1593 }
1594 return match;
1595 }
1596 public static Match LexerStatement(ParserFileLexer& lexer, soulcm.scmpg.GrammarParser* grammarParser)
1597 {
1598 #if (DEBUG)
1599 Span debugSpan;
1600 bool writeToLog = lexer.Log() != null;
1601 if (writeToLog)
1602 {
1603 debugSpan = lexer.GetSpan();
1604 System.Lex.WriteBeginRuleToLog(lexer, u"LexerStatement");
1605 }
1606 #endif
1607 ustring lexerName;
1608 Match match(false);
1609 Match* parentMatch0 = &match;
1610 {
1611 Match match(false);
1612 Match* parentMatch1 = &match;
1613 {
1614 Match match(false);
1615 if (*lexer == USELEXER)
1616 {
1617 ++lexer;
1618 match.hit = true;
1619 }
1620 *parentMatch1 = match;
1621 }
1622 if (match.hit)
1623 {
1624 Match match(false);
1625 Match* parentMatch2 = &match;
1626 {
1627 Match match(false);
1628 Match* parentMatch3 = &match;
1629 {
1630 long pos = lexer.GetPos();
1631 Span span = lexer.GetSpan();
1632 Match match(true);
1633 Match* parentMatch4 = &match;
1634 {
1635 System.Lex.Span span = lexer.GetSpan();
1636 Match match(false);
1637 if (*lexer == ID)
1638 {
1639 ++lexer;
1640 match.hit = true;
1641 }
1642 if (match.hit)
1643 {
1644 *parentMatch4 = match;
1645 }
1646 else
1647 {
1648 lexer.ThrowExpectationFailure(span, GetTokenName(ID));
1649 }
1650 }
1651 if (match.hit)
1652 {
1653 lexerName = lexer.GetMatch(span);
1654 }
1655 *parentMatch3 = match;
1656 }
1657 *parentMatch2 = match;
1658 }
1659 *parentMatch1 = match;
1660 }
1661 *parentMatch0 = match;
1662 }
1663 if (match.hit)
1664 {
1665 Match match(false);
1666 Match* parentMatch5 = &match;
1667 {
1668 Match match(false);
1669 Match* parentMatch6 = &match;
1670 {
1671 long pos = lexer.GetPos();
1672 Match match(true);
1673 Match* parentMatch7 = &match;
1674 {
1675 System.Lex.Span span = lexer.GetSpan();
1676 Match match(false);
1677 if (*lexer == SEMICOLON)
1678 {
1679 ++lexer;
1680 match.hit = true;
1681 }
1682 if (match.hit)
1683 {
1684 *parentMatch7 = match;
1685 }
1686 else
1687 {
1688 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
1689 }
1690 }
1691 if (match.hit)
1692 {
1693 grammarParser->SetLexer(lexerName);
1694 }
1695 *parentMatch6 = match;
1696 }
1697 *parentMatch5 = match;
1698 }
1699 *parentMatch0 = match;
1700 }
1701 #if (DEBUG)
1702 if (writeToLog)
1703 {
1704 if (match.hit)
1705 {
1706 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LexerStatement");
1707 }
1708 else
1709 {
1710 System.Lex.WriteFailureToLog(lexer, u"LexerStatement");
1711 }
1712 }
1713 #endif
1714 if (!match.hit)
1715 {
1716 match.value = null;
1717 }
1718 return match;
1719 }
1720 public static Match RuleInfoStatement(ParserFileLexer& lexer, soulcm.scmpg.GrammarParser* grammarParser)
1721 {
1722 #if (DEBUG)
1723 Span debugSpan;
1724 bool writeToLog = lexer.Log() != null;
1725 if (writeToLog)
1726 {
1727 debugSpan = lexer.GetSpan();
1728 System.Lex.WriteBeginRuleToLog(lexer, u"RuleInfoStatement");
1729 }
1730 #endif
1731 Match match(false);
1732 Match* parentMatch0 = &match;
1733 {
1734 Match match(false);
1735 Match* parentMatch1 = &match;
1736 {
1737 Match match(false);
1738 Match* parentMatch2 = &match;
1739 {
1740 Match match(false);
1741 if (*lexer == RULEINFO)
1742 {
1743 ++lexer;
1744 match.hit = true;
1745 }
1746 *parentMatch2 = match;
1747 }
1748 if (match.hit)
1749 {
1750 Match match(false);
1751 Match* parentMatch3 = &match;
1752 {
1753 Match match(true);
1754 Match* parentMatch4 = &match;
1755 {
1756 System.Lex.Span span = lexer.GetSpan();
1757 Match match(false);
1758 if (*lexer == LBRACE)
1759 {
1760 ++lexer;
1761 match.hit = true;
1762 }
1763 if (match.hit)
1764 {
1765 *parentMatch4 = match;
1766 }
1767 else
1768 {
1769 lexer.ThrowExpectationFailure(span, GetTokenName(LBRACE));
1770 }
1771 }
1772 *parentMatch3 = match;
1773 }
1774 *parentMatch2 = match;
1775 }
1776 *parentMatch1 = match;
1777 }
1778 if (match.hit)
1779 {
1780 Match match(false);
1781 Match* parentMatch5 = &match;
1782 {
1783 Match match(true);
1784 long save = lexer.GetPos();
1785 Match* parentMatch6 = &match;
1786 {
1787 Match match(false);
1788 Match* parentMatch7 = &match;
1789 {
1790 Match match(false);
1791 Match* parentMatch8 = &match;
1792 {
1793 Match match = ParserFileParser.RuleInfo(lexer, grammarParser);
1794 *parentMatch8 = match;
1795 }
1796 if (match.hit)
1797 {
1798 Match match(false);
1799 Match* parentMatch9 = &match;
1800 {
1801 Match match(true);
1802 Match* parentMatch10 = &match;
1803 {
1804 while (true)
1805 {
1806 long save = lexer.GetPos();
1807 {
1808 Match match(false);
1809 Match* parentMatch11 = &match;
1810 {
1811 Match match(false);
1812 if (*lexer == COMMA)
1813 {
1814 ++lexer;
1815 match.hit = true;
1816 }
1817 *parentMatch11 = match;
1818 }
1819 if (match.hit)
1820 {
1821 Match match(false);
1822 Match* parentMatch12 = &match;
1823 {
1824 Match match = ParserFileParser.RuleInfo(lexer, grammarParser);
1825 *parentMatch12 = match;
1826 }
1827 *parentMatch11 = match;
1828 }
1829 if (match.hit)
1830 {
1831 *parentMatch10 = match;
1832 }
1833 else
1834 {
1835 lexer.SetPos(save);
1836 break;
1837 }
1838 }
1839 }
1840 }
1841 *parentMatch9 = match;
1842 }
1843 *parentMatch8 = match;
1844 }
1845 *parentMatch7 = match;
1846 }
1847 if (match.hit)
1848 {
1849 *parentMatch6 = match;
1850 }
1851 else
1852 {
1853 lexer.SetPos(save);
1854 }
1855 }
1856 *parentMatch5 = match;
1857 }
1858 *parentMatch1 = match;
1859 }
1860 *parentMatch0 = match;
1861 }
1862 if (match.hit)
1863 {
1864 Match match(false);
1865 Match* parentMatch13 = &match;
1866 {
1867 Match match(true);
1868 Match* parentMatch14 = &match;
1869 {
1870 System.Lex.Span span = lexer.GetSpan();
1871 Match match(false);
1872 if (*lexer == RBRACE)
1873 {
1874 ++lexer;
1875 match.hit = true;
1876 }
1877 if (match.hit)
1878 {
1879 *parentMatch14 = match;
1880 }
1881 else
1882 {
1883 lexer.ThrowExpectationFailure(span, GetTokenName(RBRACE));
1884 }
1885 }
1886 *parentMatch13 = match;
1887 }
1888 *parentMatch0 = match;
1889 }
1890 #if (DEBUG)
1891 if (writeToLog)
1892 {
1893 if (match.hit)
1894 {
1895 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleInfoStatement");
1896 }
1897 else
1898 {
1899 System.Lex.WriteFailureToLog(lexer, u"RuleInfoStatement");
1900 }
1901 }
1902 #endif
1903 if (!match.hit)
1904 {
1905 match.value = null;
1906 }
1907 return match;
1908 }
1909 public static Match RuleInfo(ParserFileLexer& lexer, soulcm.scmpg.GrammarParser* grammarParser)
1910 {
1911 #if (DEBUG)
1912 Span debugSpan;
1913 bool writeToLog = lexer.Log() != null;
1914 if (writeToLog)
1915 {
1916 debugSpan = lexer.GetSpan();
1917 System.Lex.WriteBeginRuleToLog(lexer, u"RuleInfo");
1918 }
1919 #endif
1920 ustring ruleName;
1921 ustring ruleInfo;
1922 Match match(false);
1923 Match* parentMatch0 = &match;
1924 {
1925 Match match(false);
1926 Match* parentMatch1 = &match;
1927 {
1928 Match match(false);
1929 Match* parentMatch2 = &match;
1930 {
1931 Match match(false);
1932 Match* parentMatch3 = &match;
1933 {
1934 Match match(false);
1935 if (*lexer == LPAREN)
1936 {
1937 ++lexer;
1938 match.hit = true;
1939 }
1940 *parentMatch3 = match;
1941 }
1942 if (match.hit)
1943 {
1944 Match match(false);
1945 Match* parentMatch4 = &match;
1946 {
1947 Match match(false);
1948 Match* parentMatch5 = &match;
1949 {
1950 long pos = lexer.GetPos();
1951 Span span = lexer.GetSpan();
1952 Match match(true);
1953 Match* parentMatch6 = &match;
1954 {
1955 System.Lex.Span span = lexer.GetSpan();
1956 Match match(false);
1957 if (*lexer == ID)
1958 {
1959 ++lexer;
1960 match.hit = true;
1961 }
1962 if (match.hit)
1963 {
1964 *parentMatch6 = match;
1965 }
1966 else
1967 {
1968 lexer.ThrowExpectationFailure(span, GetTokenName(ID));
1969 }
1970 }
1971 if (match.hit)
1972 {
1973 ruleName = lexer.GetMatch(span);
1974 }
1975 *parentMatch5 = match;
1976 }
1977 *parentMatch4 = match;
1978 }
1979 *parentMatch3 = match;
1980 }
1981 *parentMatch2 = match;
1982 }
1983 if (match.hit)
1984 {
1985 Match match(false);
1986 Match* parentMatch7 = &match;
1987 {
1988 Match match(true);
1989 Match* parentMatch8 = &match;
1990 {
1991 System.Lex.Span span = lexer.GetSpan();
1992 Match match(false);
1993 if (*lexer == COMMA)
1994 {
1995 ++lexer;
1996 match.hit = true;
1997 }
1998 if (match.hit)
1999 {
2000 *parentMatch8 = match;
2001 }
2002 else
2003 {
2004 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
2005 }
2006 }
2007 *parentMatch7 = match;
2008 }
2009 *parentMatch2 = match;
2010 }
2011 *parentMatch1 = match;
2012 }
2013 if (match.hit)
2014 {
2015 Match match(false);
2016 Match* parentMatch9 = &match;
2017 {
2018 Match match(false);
2019 Match* parentMatch10 = &match;
2020 {
2021 long pos = lexer.GetPos();
2022 Match match(true);
2023 Match* parentMatch11 = &match;
2024 {
2025 System.Lex.Span span = lexer.GetSpan();
2026 Match match(false);
2027 if (*lexer == STRINGLIT)
2028 {
2029 ++lexer;
2030 match.hit = true;
2031 }
2032 if (match.hit)
2033 {
2034 *parentMatch11 = match;
2035 }
2036 else
2037 {
2038 lexer.ThrowExpectationFailure(span, GetTokenName(STRINGLIT));
2039 }
2040 }
2041 if (match.hit)
2042 {
2043 ruleInfo = soulcm.scmpg.ParseStringLiteral(lexer.FileName(), lexer.GetToken(pos));
2044 }
2045 *parentMatch10 = match;
2046 }
2047 *parentMatch9 = match;
2048 }
2049 *parentMatch1 = match;
2050 }
2051 *parentMatch0 = match;
2052 }
2053 if (match.hit)
2054 {
2055 Match match(false);
2056 Match* parentMatch12 = &match;
2057 {
2058 Match match(false);
2059 Match* parentMatch13 = &match;
2060 {
2061 long pos = lexer.GetPos();
2062 Match match(true);
2063 Match* parentMatch14 = &match;
2064 {
2065 System.Lex.Span span = lexer.GetSpan();
2066 Match match(false);
2067 if (*lexer == RPAREN)
2068 {
2069 ++lexer;
2070 match.hit = true;
2071 }
2072 if (match.hit)
2073 {
2074 *parentMatch14 = match;
2075 }
2076 else
2077 {
2078 lexer.ThrowExpectationFailure(span, GetTokenName(RPAREN));
2079 }
2080 }
2081 if (match.hit)
2082 {
2083 grammarParser->AddRuleInfo(ruleName, ruleInfo);
2084 }
2085 *parentMatch13 = match;
2086 }
2087 *parentMatch12 = match;
2088 }
2089 *parentMatch0 = match;
2090 }
2091 #if (DEBUG)
2092 if (writeToLog)
2093 {
2094 if (match.hit)
2095 {
2096 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleInfo");
2097 }
2098 else
2099 {
2100 System.Lex.WriteFailureToLog(lexer, u"RuleInfo");
2101 }
2102 }
2103 #endif
2104 if (!match.hit)
2105 {
2106 match.value = null;
2107 }
2108 return match;
2109 }
2110 public static Match RuleStatement(ParserFileLexer& lexer, soulcm.scmpg.GrammarParser* grammarParser, ParsingContext* parsingContext)
2111 {
2112 #if (DEBUG)
2113 Span debugSpan;
2114 bool writeToLog = lexer.Log() != null;
2115 if (writeToLog)
2116 {
2117 debugSpan = lexer.GetSpan();
2118 System.Lex.WriteBeginRuleToLog(lexer, u"RuleStatement");
2119 }
2120 #endif
2121 UniquePtr<soulcm.scmpg.RuleParser> rule;
2122 UniquePtr<Node> returnType;
2123 UniquePtr<soulcm.scmpg.Parser> definition;
2124 Match match(false);
2125 Match* parentMatch0 = &match;
2126 {
2127 Match match(false);
2128 Match* parentMatch1 = &match;
2129 {
2130 Match match(false);
2131 Match* parentMatch2 = &match;
2132 {
2133 Match match(false);
2134 Match* parentMatch3 = &match;
2135 {
2136 Match match(false);
2137 Match* parentMatch4 = &match;
2138 {
2139 Match match(false);
2140 Match* parentMatch5 = &match;
2141 {
2142 long pos = lexer.GetPos();
2143 Span span = lexer.GetSpan();
2144 Match match(false);
2145 if (*lexer == ID)
2146 {
2147 ++lexer;
2148 match.hit = true;
2149 }
2150 if (match.hit)
2151 {
2152 ustring id = lexer.GetMatch(span);
2153 rule.Reset(new soulcm.scmpg.RuleParser(id));
2154 }
2155 *parentMatch5 = match;
2156 }
2157 *parentMatch4 = match;
2158 }
2159 if (match.hit)
2160 {
2161 Match match(false);
2162 Match* parentMatch6 = &match;
2163 {
2164 Match match(true);
2165 long save = lexer.GetPos();
2166 Match* parentMatch7 = &match;
2167 {
2168 Match match = ParserFileParser.ParametersAndVariables(lexer, rule.Get(), parsingContext);
2169 if (match.hit)
2170 {
2171 *parentMatch7 = match;
2172 }
2173 else
2174 {
2175 lexer.SetPos(save);
2176 }
2177 }
2178 *parentMatch6 = match;
2179 }
2180 *parentMatch4 = match;
2181 }
2182 *parentMatch3 = match;
2183 }
2184 if (match.hit)
2185 {
2186 Match match(false);
2187 Match* parentMatch8 = &match;
2188 {
2189 Match match(true);
2190 long save = lexer.GetPos();
2191 Match* parentMatch9 = &match;
2192 {
2193 Match match = ParserFileParser.ReturnType(lexer, parsingContext);
2194 returnType.Reset(cast<Node*>(match.value));
2195 if (match.hit)
2196 {
2197 *parentMatch9 = match;
2198 }
2199 else
2200 {
2201 lexer.SetPos(save);
2202 }
2203 }
2204 *parentMatch8 = match;
2205 }
2206 *parentMatch3 = match;
2207 }
2208 *parentMatch2 = match;
2209 }
2210 if (match.hit)
2211 {
2212 Match match(false);
2213 Match* parentMatch10 = &match;
2214 {
2215 Match match(false);
2216 if (*lexer == PRODUCES)
2217 {
2218 ++lexer;
2219 match.hit = true;
2220 }
2221 *parentMatch10 = match;
2222 }
2223 *parentMatch2 = match;
2224 }
2225 *parentMatch1 = match;
2226 }
2227 if (match.hit)
2228 {
2229 Match match(false);
2230 Match* parentMatch11 = &match;
2231 {
2232 Match match(true);
2233 Match* parentMatch12 = &match;
2234 {
2235 System.Lex.Span span = lexer.GetSpan();
2236 Match match = ParserFileParser.RuleBody(lexer, parsingContext);
2237 definition.Reset(cast<soulcm.scmpg.Parser*>(match.value));
2238 if (match.hit)
2239 {
2240 *parentMatch12 = match;
2241 }
2242 else
2243 {
2244 lexer.ThrowExpectationFailure(span, u"RuleBody");
2245 }
2246 }
2247 *parentMatch11 = match;
2248 }
2249 *parentMatch1 = match;
2250 }
2251 *parentMatch0 = match;
2252 }
2253 if (match.hit)
2254 {
2255 Match match(false);
2256 Match* parentMatch13 = &match;
2257 {
2258 Match match(false);
2259 Match* parentMatch14 = &match;
2260 {
2261 long pos = lexer.GetPos();
2262 Match match(true);
2263 Match* parentMatch15 = &match;
2264 {
2265 System.Lex.Span span = lexer.GetSpan();
2266 Match match(false);
2267 if (*lexer == SEMICOLON)
2268 {
2269 ++lexer;
2270 match.hit = true;
2271 }
2272 if (match.hit)
2273 {
2274 *parentMatch15 = match;
2275 }
2276 else
2277 {
2278 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
2279 }
2280 }
2281 if (match.hit)
2282 {
2283 rule->SetDefinition(definition.Release());
2284 rule->SetReturnType(returnType.Release());
2285 grammarParser->AddRule(rule.Release());
2286 }
2287 *parentMatch14 = match;
2288 }
2289 *parentMatch13 = match;
2290 }
2291 *parentMatch0 = match;
2292 }
2293 #if (DEBUG)
2294 if (writeToLog)
2295 {
2296 if (match.hit)
2297 {
2298 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleStatement");
2299 }
2300 else
2301 {
2302 System.Lex.WriteFailureToLog(lexer, u"RuleStatement");
2303 }
2304 }
2305 #endif
2306 if (!match.hit)
2307 {
2308 match.value = null;
2309 }
2310 return match;
2311 }
2312 public static Match ParametersAndVariables(ParserFileLexer& lexer, soulcm.scmpg.RuleParser* rule, ParsingContext* parsingContext)
2313 {
2314 #if (DEBUG)
2315 Span debugSpan;
2316 bool writeToLog = lexer.Log() != null;
2317 if (writeToLog)
2318 {
2319 debugSpan = lexer.GetSpan();
2320 System.Lex.WriteBeginRuleToLog(lexer, u"ParametersAndVariables");
2321 }
2322 #endif
2323 UniquePtr<soulcm.scmpg.Parameter> paramOrVariable;
2324 Match match(false);
2325 Match* parentMatch0 = &match;
2326 {
2327 Match match(false);
2328 Match* parentMatch1 = &match;
2329 {
2330 Match match(false);
2331 if (*lexer == LPAREN)
2332 {
2333 ++lexer;
2334 match.hit = true;
2335 }
2336 *parentMatch1 = match;
2337 }
2338 if (match.hit)
2339 {
2340 Match match(false);
2341 Match* parentMatch2 = &match;
2342 {
2343 Match match(true);
2344 long save = lexer.GetPos();
2345 Match* parentMatch3 = &match;
2346 {
2347 Match match(false);
2348 Match* parentMatch4 = &match;
2349 {
2350 Match match(false);
2351 Match* parentMatch5 = &match;
2352 {
2353 Match match(false);
2354 Match* parentMatch6 = &match;
2355 {
2356 long pos = lexer.GetPos();
2357 Match match = ParserFileParser.ParamOrVariable(lexer, parsingContext);
2358 paramOrVariable.Reset(cast<soulcm.scmpg.Parameter*>(match.value));
2359 if (match.hit)
2360 {
2361 rule->AddParamOrVariable(paramOrVariable.Release());
2362 }
2363 *parentMatch6 = match;
2364 }
2365 *parentMatch5 = match;
2366 }
2367 if (match.hit)
2368 {
2369 Match match(false);
2370 Match* parentMatch7 = &match;
2371 {
2372 Match match(true);
2373 Match* parentMatch8 = &match;
2374 {
2375 while (true)
2376 {
2377 long save = lexer.GetPos();
2378 {
2379 Match match(false);
2380 Match* parentMatch9 = &match;
2381 {
2382 Match match(false);
2383 if (*lexer == COMMA)
2384 {
2385 ++lexer;
2386 match.hit = true;
2387 }
2388 *parentMatch9 = match;
2389 }
2390 if (match.hit)
2391 {
2392 Match match(false);
2393 Match* parentMatch10 = &match;
2394 {
2395 Match match(false);
2396 Match* parentMatch11 = &match;
2397 {
2398 long pos = lexer.GetPos();
2399 Match match = ParserFileParser.ParamOrVariable(lexer, parsingContext);
2400 paramOrVariable.Reset(cast<soulcm.scmpg.Parameter*>(match.value));
2401 if (match.hit)
2402 {
2403 rule->AddParamOrVariable(paramOrVariable.Release());
2404 }
2405 *parentMatch11 = match;
2406 }
2407 *parentMatch10 = match;
2408 }
2409 *parentMatch9 = match;
2410 }
2411 if (match.hit)
2412 {
2413 *parentMatch8 = match;
2414 }
2415 else
2416 {
2417 lexer.SetPos(save);
2418 break;
2419 }
2420 }
2421 }
2422 }
2423 *parentMatch7 = match;
2424 }
2425 *parentMatch5 = match;
2426 }
2427 *parentMatch4 = match;
2428 }
2429 if (match.hit)
2430 {
2431 *parentMatch3 = match;
2432 }
2433 else
2434 {
2435 lexer.SetPos(save);
2436 }
2437 }
2438 *parentMatch2 = match;
2439 }
2440 *parentMatch1 = match;
2441 }
2442 *parentMatch0 = match;
2443 }
2444 if (match.hit)
2445 {
2446 Match match(false);
2447 Match* parentMatch12 = &match;
2448 {
2449 Match match(true);
2450 Match* parentMatch13 = &match;
2451 {
2452 System.Lex.Span span = lexer.GetSpan();
2453 Match match(false);
2454 if (*lexer == RPAREN)
2455 {
2456 ++lexer;
2457 match.hit = true;
2458 }
2459 if (match.hit)
2460 {
2461 *parentMatch13 = match;
2462 }
2463 else
2464 {
2465 lexer.ThrowExpectationFailure(span, GetTokenName(RPAREN));
2466 }
2467 }
2468 *parentMatch12 = match;
2469 }
2470 *parentMatch0 = match;
2471 }
2472 #if (DEBUG)
2473 if (writeToLog)
2474 {
2475 if (match.hit)
2476 {
2477 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParametersAndVariables");
2478 }
2479 else
2480 {
2481 System.Lex.WriteFailureToLog(lexer, u"ParametersAndVariables");
2482 }
2483 }
2484 #endif
2485 if (!match.hit)
2486 {
2487 match.value = null;
2488 }
2489 return match;
2490 }
2491 public static Match ParamOrVariable(ParserFileLexer& lexer, ParsingContext* parsingContext)
2492 {
2493 #if (DEBUG)
2494 Span debugSpan;
2495 bool writeToLog = lexer.Log() != null;
2496 if (writeToLog)
2497 {
2498 debugSpan = lexer.GetSpan();
2499 System.Lex.WriteBeginRuleToLog(lexer, u"ParamOrVariable");
2500 }
2501 #endif
2502 UniquePtr<Node> varType;
2503 UniquePtr<IdentifierNode> varName;
2504 UniquePtr<Node> paramType;
2505 UniquePtr<IdentifierNode> paramName;
2506 Match match(false);
2507 Match* parentMatch0 = &match;
2508 {
2509 long save = lexer.GetPos();
2510 Match match(false);
2511 Match* parentMatch1 = &match;
2512 {
2513 Match match(false);
2514 Match* parentMatch2 = &match;
2515 {
2516 Match match(false);
2517 if (*lexer == VAR)
2518 {
2519 ++lexer;
2520 match.hit = true;
2521 }
2522 *parentMatch2 = match;
2523 }
2524 if (match.hit)
2525 {
2526 Match match(false);
2527 Match* parentMatch3 = &match;
2528 {
2529 Match match = TypeExprParser.TypeExpr(lexer, parsingContext);
2530 varType.Reset(cast<Node*>(match.value));
2531 *parentMatch3 = match;
2532 }
2533 *parentMatch2 = match;
2534 }
2535 *parentMatch1 = match;
2536 }
2537 if (match.hit)
2538 {
2539 Match match(false);
2540 Match* parentMatch4 = &match;
2541 {
2542 Match match(false);
2543 Match* parentMatch5 = &match;
2544 {
2545 long pos = lexer.GetPos();
2546 Match match = IdentifierParser.Identifier(lexer, parsingContext);
2547 varName.Reset(cast<IdentifierNode*>(match.value));
2548 if (match.hit)
2549 {
2550 {
2551 #if (DEBUG)
2552 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParamOrVariable");
2553 #endif
2554 return Match(true, new soulcm.scmpg.Variable(varType.Release(), varName.Release()));
2555 }
2556 }
2557 *parentMatch5 = match;
2558 }
2559 *parentMatch4 = match;
2560 }
2561 *parentMatch1 = match;
2562 }
2563 *parentMatch0 = match;
2564 if (!match.hit)
2565 {
2566 Match match(false);
2567 Match* parentMatch6 = &match;
2568 lexer.SetPos(save);
2569 {
2570 Match match(false);
2571 Match* parentMatch7 = &match;
2572 {
2573 Match match = TypeExprParser.TypeExpr(lexer, parsingContext);
2574 paramType.Reset(cast<Node*>(match.value));
2575 *parentMatch7 = match;
2576 }
2577 if (match.hit)
2578 {
2579 Match match(false);
2580 Match* parentMatch8 = &match;
2581 {
2582 Match match(false);
2583 Match* parentMatch9 = &match;
2584 {
2585 long pos = lexer.GetPos();
2586 Match match = IdentifierParser.Identifier(lexer, parsingContext);
2587 paramName.Reset(cast<IdentifierNode*>(match.value));
2588 if (match.hit)
2589 {
2590 {
2591 #if (DEBUG)
2592 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParamOrVariable");
2593 #endif
2594 return Match(true, new soulcm.scmpg.Parameter(paramType.Release(), paramName.Release()));
2595 }
2596 }
2597 *parentMatch9 = match;
2598 }
2599 *parentMatch8 = match;
2600 }
2601 *parentMatch7 = match;
2602 }
2603 *parentMatch6 = match;
2604 }
2605 *parentMatch0 = match;
2606 }
2607 }
2608 #if (DEBUG)
2609 if (writeToLog)
2610 {
2611 if (match.hit)
2612 {
2613 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParamOrVariable");
2614 }
2615 else
2616 {
2617 System.Lex.WriteFailureToLog(lexer, u"ParamOrVariable");
2618 }
2619 }
2620 #endif
2621 if (!match.hit)
2622 {
2623 match.value = null;
2624 }
2625 return match;
2626 }
2627 public static Match ReturnType(ParserFileLexer& lexer, ParsingContext* parsingContext)
2628 {
2629 #if (DEBUG)
2630 Span debugSpan;
2631 bool writeToLog = lexer.Log() != null;
2632 if (writeToLog)
2633 {
2634 debugSpan = lexer.GetSpan();
2635 System.Lex.WriteBeginRuleToLog(lexer, u"ReturnType");
2636 }
2637 #endif
2638 UniquePtr<Node> type;
2639 Match match(false);
2640 Match* parentMatch0 = &match;
2641 {
2642 Match match(false);
2643 if (*lexer == COLON)
2644 {
2645 ++lexer;
2646 match.hit = true;
2647 }
2648 *parentMatch0 = match;
2649 }
2650 if (match.hit)
2651 {
2652 Match match(false);
2653 Match* parentMatch1 = &match;
2654 {
2655 Match match(false);
2656 Match* parentMatch2 = &match;
2657 {
2658 long pos = lexer.GetPos();
2659 Match match = TypeExprParser.TypeExpr(lexer, parsingContext);
2660 type.Reset(cast<Node*>(match.value));
2661 if (match.hit)
2662 {
2663 {
2664 #if (DEBUG)
2665 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ReturnType");
2666 #endif
2667 return Match(true, type.Release());
2668 }
2669 }
2670 *parentMatch2 = match;
2671 }
2672 *parentMatch1 = match;
2673 }
2674 *parentMatch0 = match;
2675 }
2676 #if (DEBUG)
2677 if (writeToLog)
2678 {
2679 if (match.hit)
2680 {
2681 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ReturnType");
2682 }
2683 else
2684 {
2685 System.Lex.WriteFailureToLog(lexer, u"ReturnType");
2686 }
2687 }
2688 #endif
2689 if (!match.hit)
2690 {
2691 match.value = null;
2692 }
2693 return match;
2694 }
2695 public static Match RuleBody(ParserFileLexer& lexer, ParsingContext* parsingContext)
2696 {
2697 #if (DEBUG)
2698 Span debugSpan;
2699 bool writeToLog = lexer.Log() != null;
2700 if (writeToLog)
2701 {
2702 debugSpan = lexer.GetSpan();
2703 System.Lex.WriteBeginRuleToLog(lexer, u"RuleBody");
2704 }
2705 #endif
2706 UniquePtr<soulcm.scmpg.Parser> alt;
2707 Match match(false);
2708 Match* parentMatch0 = &match;
2709 {
2710 long pos = lexer.GetPos();
2711 Match match = ParserFileParser.Alternative(lexer, parsingContext);
2712 alt.Reset(cast<soulcm.scmpg.Parser*>(match.value));
2713 if (match.hit)
2714 {
2715 {
2716 #if (DEBUG)
2717 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleBody");
2718 #endif
2719 return Match(true, alt.Release());
2720 }
2721 }
2722 *parentMatch0 = match;
2723 }
2724 #if (DEBUG)
2725 if (writeToLog)
2726 {
2727 if (match.hit)
2728 {
2729 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleBody");
2730 }
2731 else
2732 {
2733 System.Lex.WriteFailureToLog(lexer, u"RuleBody");
2734 }
2735 }
2736 #endif
2737 if (!match.hit)
2738 {
2739 match.value = null;
2740 }
2741 return match;
2742 }
2743 public static Match Alternative(ParserFileLexer& lexer, ParsingContext* parsingContext)
2744 {
2745 #if (DEBUG)
2746 Span debugSpan;
2747 bool writeToLog = lexer.Log() != null;
2748 if (writeToLog)
2749 {
2750 debugSpan = lexer.GetSpan();
2751 System.Lex.WriteBeginRuleToLog(lexer, u"Alternative");
2752 }
2753 #endif
2754 UniquePtr<soulcm.scmpg.Parser> value;
2755 UniquePtr<soulcm.scmpg.Parser> left;
2756 UniquePtr<soulcm.scmpg.Parser> right;
2757 Match match(false);
2758 Match* parentMatch0 = &match;
2759 {
2760 long pos = lexer.GetPos();
2761 Match match(false);
2762 Match* parentMatch1 = &match;
2763 {
2764 Match match(false);
2765 Match* parentMatch2 = &match;
2766 {
2767 Match match(false);
2768 Match* parentMatch3 = &match;
2769 {
2770 long pos = lexer.GetPos();
2771 Match match = ParserFileParser.Sequence(lexer, parsingContext);
2772 left.Reset(cast<soulcm.scmpg.Parser*>(match.value));
2773 if (match.hit)
2774 {
2775 value.Reset(left.Release());
2776 }
2777 *parentMatch3 = match;
2778 }
2779 *parentMatch2 = match;
2780 }
2781 if (match.hit)
2782 {
2783 Match match(false);
2784 Match* parentMatch4 = &match;
2785 {
2786 Match match(true);
2787 Match* parentMatch5 = &match;
2788 {
2789 while (true)
2790 {
2791 long save = lexer.GetPos();
2792 {
2793 Match match(false);
2794 Match* parentMatch6 = &match;
2795 {
2796 Match match(false);
2797 Match* parentMatch7 = &match;
2798 {
2799 Match match(false);
2800 if (*lexer == BITOR)
2801 {
2802 ++lexer;
2803 match.hit = true;
2804 }
2805 *parentMatch7 = match;
2806 }
2807 if (match.hit)
2808 {
2809 Match match(false);
2810 Match* parentMatch8 = &match;
2811 {
2812 Match match(false);
2813 Match* parentMatch9 = &match;
2814 {
2815 long pos = lexer.GetPos();
2816 Match match(true);
2817 Match* parentMatch10 = &match;
2818 {
2819 System.Lex.Span span = lexer.GetSpan();
2820 Match match = ParserFileParser.Sequence(lexer, parsingContext);
2821 right.Reset(cast<soulcm.scmpg.Parser*>(match.value));
2822 if (match.hit)
2823 {
2824 *parentMatch10 = match;
2825 }
2826 else
2827 {
2828 lexer.ThrowExpectationFailure(span, u"Sequence");
2829 }
2830 }
2831 if (match.hit)
2832 {
2833 value.Reset(new soulcm.scmpg.AlternativeParser(value.Release(), right.Release()));
2834 }
2835 *parentMatch9 = match;
2836 }
2837 *parentMatch8 = match;
2838 }
2839 *parentMatch7 = match;
2840 }
2841 *parentMatch6 = match;
2842 }
2843 if (match.hit)
2844 {
2845 *parentMatch5 = match;
2846 }
2847 else
2848 {
2849 lexer.SetPos(save);
2850 break;
2851 }
2852 }
2853 }
2854 }
2855 *parentMatch4 = match;
2856 }
2857 *parentMatch2 = match;
2858 }
2859 *parentMatch1 = match;
2860 }
2861 if (match.hit)
2862 {
2863 {
2864 #if (DEBUG)
2865 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Alternative");
2866 #endif
2867 return Match(true, value.Release());
2868 }
2869 }
2870 *parentMatch0 = match;
2871 }
2872 #if (DEBUG)
2873 if (writeToLog)
2874 {
2875 if (match.hit)
2876 {
2877 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Alternative");
2878 }
2879 else
2880 {
2881 System.Lex.WriteFailureToLog(lexer, u"Alternative");
2882 }
2883 }
2884 #endif
2885 if (!match.hit)
2886 {
2887 match.value = null;
2888 }
2889 return match;
2890 }
2891 public static Match Sequence(ParserFileLexer& lexer, ParsingContext* parsingContext)
2892 {
2893 #if (DEBUG)
2894 Span debugSpan;
2895 bool writeToLog = lexer.Log() != null;
2896 if (writeToLog)
2897 {
2898 debugSpan = lexer.GetSpan();
2899 System.Lex.WriteBeginRuleToLog(lexer, u"Sequence");
2900 }
2901 #endif
2902 UniquePtr<soulcm.scmpg.Parser> value;
2903 UniquePtr<soulcm.scmpg.Parser> left;
2904 UniquePtr<soulcm.scmpg.Parser> right;
2905 Match match(false);
2906 Match* parentMatch0 = &match;
2907 {
2908 long pos = lexer.GetPos();
2909 Match match(false);
2910 Match* parentMatch1 = &match;
2911 {
2912 Match match(false);
2913 Match* parentMatch2 = &match;
2914 {
2915 Match match(false);
2916 Match* parentMatch3 = &match;
2917 {
2918 long pos = lexer.GetPos();
2919 Match match = ParserFileParser.Difference(lexer, parsingContext);
2920 left.Reset(cast<soulcm.scmpg.Parser*>(match.value));
2921 if (match.hit)
2922 {
2923 value.Reset(left.Release());
2924 }
2925 *parentMatch3 = match;
2926 }
2927 *parentMatch2 = match;
2928 }
2929 if (match.hit)
2930 {
2931 Match match(false);
2932 Match* parentMatch4 = &match;
2933 {
2934 Match match(true);
2935 Match* parentMatch5 = &match;
2936 {
2937 while (true)
2938 {
2939 long save = lexer.GetPos();
2940 {
2941 Match match(false);
2942 Match* parentMatch6 = &match;
2943 {
2944 Match match(false);
2945 Match* parentMatch7 = &match;
2946 {
2947 long pos = lexer.GetPos();
2948 Match match = ParserFileParser.Difference(lexer, parsingContext);
2949 right.Reset(cast<soulcm.scmpg.Parser*>(match.value));
2950 if (match.hit)
2951 {
2952 value.Reset(new soulcm.scmpg.SequenceParser(value.Release(), right.Release()));
2953 }
2954 *parentMatch7 = match;
2955 }
2956 *parentMatch6 = match;
2957 }
2958 if (match.hit)
2959 {
2960 *parentMatch5 = match;
2961 }
2962 else
2963 {
2964 lexer.SetPos(save);
2965 break;
2966 }
2967 }
2968 }
2969 }
2970 *parentMatch4 = match;
2971 }
2972 *parentMatch2 = match;
2973 }
2974 *parentMatch1 = match;
2975 }
2976 if (match.hit)
2977 {
2978 {
2979 #if (DEBUG)
2980 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Sequence");
2981 #endif
2982 return Match(true, value.Release());
2983 }
2984 }
2985 *parentMatch0 = match;
2986 }
2987 #if (DEBUG)
2988 if (writeToLog)
2989 {
2990 if (match.hit)
2991 {
2992 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Sequence");
2993 }
2994 else
2995 {
2996 System.Lex.WriteFailureToLog(lexer, u"Sequence");
2997 }
2998 }
2999 #endif
3000 if (!match.hit)
3001 {
3002 match.value = null;
3003 }
3004 return match;
3005 }
3006 public static Match Difference(ParserFileLexer& lexer, ParsingContext* parsingContext)
3007 {
3008 #if (DEBUG)
3009 Span debugSpan;
3010 bool writeToLog = lexer.Log() != null;
3011 if (writeToLog)
3012 {
3013 debugSpan = lexer.GetSpan();
3014 System.Lex.WriteBeginRuleToLog(lexer, u"Difference");
3015 }
3016 #endif
3017 UniquePtr<soulcm.scmpg.Parser> value;
3018 UniquePtr<soulcm.scmpg.Parser> left;
3019 UniquePtr<soulcm.scmpg.Parser> right;
3020 Match match(false);
3021 Match* parentMatch0 = &match;
3022 {
3023 long pos = lexer.GetPos();
3024 Match match(false);
3025 Match* parentMatch1 = &match;
3026 {
3027 Match match(false);
3028 Match* parentMatch2 = &match;
3029 {
3030 Match match(false);
3031 Match* parentMatch3 = &match;
3032 {
3033 long pos = lexer.GetPos();
3034 Match match = ParserFileParser.List(lexer, parsingContext);
3035 left.Reset(cast<soulcm.scmpg.Parser*>(match.value));
3036 if (match.hit)
3037 {
3038 value.Reset(left.Release());
3039 }
3040 *parentMatch3 = match;
3041 }
3042 *parentMatch2 = match;
3043 }
3044 if (match.hit)
3045 {
3046 Match match(false);
3047 Match* parentMatch4 = &match;
3048 {
3049 Match match(true);
3050 Match* parentMatch5 = &match;
3051 {
3052 while (true)
3053 {
3054 long save = lexer.GetPos();
3055 {
3056 Match match(false);
3057 Match* parentMatch6 = &match;
3058 {
3059 Match match(false);
3060 Match* parentMatch7 = &match;
3061 {
3062 Match match(false);
3063 if (*lexer == MINUS)
3064 {
3065 ++lexer;
3066 match.hit = true;
3067 }
3068 *parentMatch7 = match;
3069 }
3070 if (match.hit)
3071 {
3072 Match match(false);
3073 Match* parentMatch8 = &match;
3074 {
3075 Match match(false);
3076 Match* parentMatch9 = &match;
3077 {
3078 long pos = lexer.GetPos();
3079 Match match(true);
3080 Match* parentMatch10 = &match;
3081 {
3082 System.Lex.Span span = lexer.GetSpan();
3083 Match match = ParserFileParser.List(lexer, parsingContext);
3084 right.Reset(cast<soulcm.scmpg.Parser*>(match.value));
3085 if (match.hit)
3086 {
3087 *parentMatch10 = match;
3088 }
3089 else
3090 {
3091 lexer.ThrowExpectationFailure(span, u"List");
3092 }
3093 }
3094 if (match.hit)
3095 {
3096 value.Reset(new soulcm.scmpg.DifferenceParser(value.Release(), right.Release()));
3097 }
3098 *parentMatch9 = match;
3099 }
3100 *parentMatch8 = match;
3101 }
3102 *parentMatch7 = match;
3103 }
3104 *parentMatch6 = match;
3105 }
3106 if (match.hit)
3107 {
3108 *parentMatch5 = match;
3109 }
3110 else
3111 {
3112 lexer.SetPos(save);
3113 break;
3114 }
3115 }
3116 }
3117 }
3118 *parentMatch4 = match;
3119 }
3120 *parentMatch2 = match;
3121 }
3122 *parentMatch1 = match;
3123 }
3124 if (match.hit)
3125 {
3126 {
3127 #if (DEBUG)
3128 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Difference");
3129 #endif
3130 return Match(true, value.Release());
3131 }
3132 }
3133 *parentMatch0 = match;
3134 }
3135 #if (DEBUG)
3136 if (writeToLog)
3137 {
3138 if (match.hit)
3139 {
3140 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Difference");
3141 }
3142 else
3143 {
3144 System.Lex.WriteFailureToLog(lexer, u"Difference");
3145 }
3146 }
3147 #endif
3148 if (!match.hit)
3149 {
3150 match.value = null;
3151 }
3152 return match;
3153 }
3154 public static Match List(ParserFileLexer& lexer, ParsingContext* parsingContext)
3155 {
3156 #if (DEBUG)
3157 Span debugSpan;
3158 bool writeToLog = lexer.Log() != null;
3159 if (writeToLog)
3160 {
3161 debugSpan = lexer.GetSpan();
3162 System.Lex.WriteBeginRuleToLog(lexer, u"List");
3163 }
3164 #endif
3165 UniquePtr<soulcm.scmpg.Parser> value;
3166 UniquePtr<soulcm.scmpg.Parser> left;
3167 UniquePtr<soulcm.scmpg.Parser> right;
3168 Match match(false);
3169 Match* parentMatch0 = &match;
3170 {
3171 long pos = lexer.GetPos();
3172 Match match(false);
3173 Match* parentMatch1 = &match;
3174 {
3175 Match match(false);
3176 Match* parentMatch2 = &match;
3177 {
3178 Match match(false);
3179 Match* parentMatch3 = &match;
3180 {
3181 long pos = lexer.GetPos();
3182 Match match = ParserFileParser.Postfix(lexer, parsingContext);
3183 left.Reset(cast<soulcm.scmpg.Parser*>(match.value));
3184 if (match.hit)
3185 {
3186 value.Reset(left.Release());
3187 }
3188 *parentMatch3 = match;
3189 }
3190 *parentMatch2 = match;
3191 }
3192 if (match.hit)
3193 {
3194 Match match(false);
3195 Match* parentMatch4 = &match;
3196 {
3197 Match match(true);
3198 long save = lexer.GetPos();
3199 Match* parentMatch5 = &match;
3200 {
3201 Match match(false);
3202 Match* parentMatch6 = &match;
3203 {
3204 Match match(false);
3205 Match* parentMatch7 = &match;
3206 {
3207 Match match(false);
3208 if (*lexer == REM)
3209 {
3210 ++lexer;
3211 match.hit = true;
3212 }
3213 *parentMatch7 = match;
3214 }
3215 if (match.hit)
3216 {
3217 Match match(false);
3218 Match* parentMatch8 = &match;
3219 {
3220 Match match(false);
3221 Match* parentMatch9 = &match;
3222 {
3223 long pos = lexer.GetPos();
3224 Match match(true);
3225 Match* parentMatch10 = &match;
3226 {
3227 System.Lex.Span span = lexer.GetSpan();
3228 Match match = ParserFileParser.Postfix(lexer, parsingContext);
3229 right.Reset(cast<soulcm.scmpg.Parser*>(match.value));
3230 if (match.hit)
3231 {
3232 *parentMatch10 = match;
3233 }
3234 else
3235 {
3236 lexer.ThrowExpectationFailure(span, u"Postfix");
3237 }
3238 }
3239 if (match.hit)
3240 {
3241 value.Reset(new soulcm.scmpg.ListParser(value.Release(), right.Release()));
3242 }
3243 *parentMatch9 = match;
3244 }
3245 *parentMatch8 = match;
3246 }
3247 *parentMatch7 = match;
3248 }
3249 *parentMatch6 = match;
3250 }
3251 if (match.hit)
3252 {
3253 *parentMatch5 = match;
3254 }
3255 else
3256 {
3257 lexer.SetPos(save);
3258 }
3259 }
3260 *parentMatch4 = match;
3261 }
3262 *parentMatch2 = match;
3263 }
3264 *parentMatch1 = match;
3265 }
3266 if (match.hit)
3267 {
3268 {
3269 #if (DEBUG)
3270 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"List");
3271 #endif
3272 return Match(true, value.Release());
3273 }
3274 }
3275 *parentMatch0 = match;
3276 }
3277 #if (DEBUG)
3278 if (writeToLog)
3279 {
3280 if (match.hit)
3281 {
3282 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"List");
3283 }
3284 else
3285 {
3286 System.Lex.WriteFailureToLog(lexer, u"List");
3287 }
3288 }
3289 #endif
3290 if (!match.hit)
3291 {
3292 match.value = null;
3293 }
3294 return match;
3295 }
3296 public static Match Postfix(ParserFileLexer& lexer, ParsingContext* parsingContext)
3297 {
3298 #if (DEBUG)
3299 Span debugSpan;
3300 bool writeToLog = lexer.Log() != null;
3301 if (writeToLog)
3302 {
3303 debugSpan = lexer.GetSpan();
3304 System.Lex.WriteBeginRuleToLog(lexer, u"Postfix");
3305 }
3306 #endif
3307 UniquePtr<soulcm.scmpg.Parser> value;
3308 UniquePtr<soulcm.scmpg.Parser> primary;
3309 Match match(false);
3310 Match* parentMatch0 = &match;
3311 {
3312 long pos = lexer.GetPos();
3313 Match match(false);
3314 Match* parentMatch1 = &match;
3315 {
3316 Match match(false);
3317 Match* parentMatch2 = &match;
3318 {
3319 Match match(false);
3320 Match* parentMatch3 = &match;
3321 {
3322 long pos = lexer.GetPos();
3323 Match match = ParserFileParser.Primary(lexer, parsingContext);
3324 primary.Reset(cast<soulcm.scmpg.Parser*>(match.value));
3325 if (match.hit)
3326 {
3327 value.Reset(primary.Release());
3328 }
3329 *parentMatch3 = match;
3330 }
3331 *parentMatch2 = match;
3332 }
3333 if (match.hit)
3334 {
3335 Match match(false);
3336 Match* parentMatch4 = &match;
3337 {
3338 Match match(true);
3339 long save = lexer.GetPos();
3340 Match* parentMatch5 = &match;
3341 {
3342 Match match(false);
3343 Match* parentMatch6 = &match;
3344 {
3345 Match match(false);
3346 Match* parentMatch7 = &match;
3347 {
3348 long save = lexer.GetPos();
3349 Match match(false);
3350 Match* parentMatch8 = &match;
3351 {
3352 long save = lexer.GetPos();
3353 Match match(false);
3354 Match* parentMatch9 = &match;
3355 {
3356 long pos = lexer.GetPos();
3357 Match match(false);
3358 if (*lexer == STAR)
3359 {
3360 ++lexer;
3361 match.hit = true;
3362 }
3363 if (match.hit)
3364 {
3365 value.Reset(new soulcm.scmpg.KleeneParser(value.Release()));
3366 }
3367 *parentMatch9 = match;
3368 }
3369 *parentMatch8 = match;
3370 if (!match.hit)
3371 {
3372 Match match(false);
3373 Match* parentMatch10 = &match;
3374 lexer.SetPos(save);
3375 {
3376 Match match(false);
3377 Match* parentMatch11 = &match;
3378 {
3379 long pos = lexer.GetPos();
3380 Match match(false);
3381 if (*lexer == PLUS)
3382 {
3383 ++lexer;
3384 match.hit = true;
3385 }
3386 if (match.hit)
3387 {
3388 value.Reset(new soulcm.scmpg.PositiveParser(value.Release()));
3389 }
3390 *parentMatch11 = match;
3391 }
3392 *parentMatch10 = match;
3393 }
3394 *parentMatch8 = match;
3395 }
3396 }
3397 *parentMatch7 = match;
3398 if (!match.hit)
3399 {
3400 Match match(false);
3401 Match* parentMatch12 = &match;
3402 lexer.SetPos(save);
3403 {
3404 Match match(false);
3405 Match* parentMatch13 = &match;
3406 {
3407 long pos = lexer.GetPos();
3408 Match match(false);
3409 if (*lexer == QUEST)
3410 {
3411 ++lexer;
3412 match.hit = true;
3413 }
3414 if (match.hit)
3415 {
3416 value.Reset(new soulcm.scmpg.OptionalParser(value.Release()));
3417 }
3418 *parentMatch13 = match;
3419 }
3420 *parentMatch12 = match;
3421 }
3422 *parentMatch7 = match;
3423 }
3424 }
3425 *parentMatch6 = match;
3426 }
3427 if (match.hit)
3428 {
3429 *parentMatch5 = match;
3430 }
3431 else
3432 {
3433 lexer.SetPos(save);
3434 }
3435 }
3436 *parentMatch4 = match;
3437 }
3438 *parentMatch2 = match;
3439 }
3440 *parentMatch1 = match;
3441 }
3442 if (match.hit)
3443 {
3444 {
3445 #if (DEBUG)
3446 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Postfix");
3447 #endif
3448 return Match(true, value.Release());
3449 }
3450 }
3451 *parentMatch0 = match;
3452 }
3453 #if (DEBUG)
3454 if (writeToLog)
3455 {
3456 if (match.hit)
3457 {
3458 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Postfix");
3459 }
3460 else
3461 {
3462 System.Lex.WriteFailureToLog(lexer, u"Postfix");
3463 }
3464 }
3465 #endif
3466 if (!match.hit)
3467 {
3468 match.value = null;
3469 }
3470 return match;
3471 }
3472 public static Match Primary(ParserFileLexer& lexer, ParsingContext* parsingContext)
3473 {
3474 #if (DEBUG)
3475 Span debugSpan;
3476 bool writeToLog = lexer.Log() != null;
3477 if (writeToLog)
3478 {
3479 debugSpan = lexer.GetSpan();
3480 System.Lex.WriteBeginRuleToLog(lexer, u"Primary");
3481 }
3482 #endif
3483 UniquePtr<soulcm.scmpg.Parser> value;
3484 UniquePtr<soulcm.scmpg.Parser> ruleCall;
3485 UniquePtr<soulcm.scmpg.Parser> primitive;
3486 UniquePtr<soulcm.scmpg.Parser> grouping;
3487 UniquePtr<CompoundStatementNode> successCode;
3488 UniquePtr<CompoundStatementNode> failureCode;
3489 Match match(false);
3490 Match* parentMatch0 = &match;
3491 {
3492 long pos = lexer.GetPos();
3493 Match match(false);
3494 Match* parentMatch1 = &match;
3495 {
3496 Match match(false);
3497 Match* parentMatch2 = &match;
3498 {
3499 Match match(false);
3500 Match* parentMatch3 = &match;
3501 {
3502 Match match(false);
3503 Match* parentMatch4 = &match;
3504 {
3505 Match match(false);
3506 Match* parentMatch5 = &match;
3507 {
3508 long save = lexer.GetPos();
3509 Match match(false);
3510 Match* parentMatch6 = &match;
3511 {
3512 long save = lexer.GetPos();
3513 Match match(false);
3514 Match* parentMatch7 = &match;
3515 {
3516 long pos = lexer.GetPos();
3517 Match match = ParserFileParser.RuleCall(lexer, parsingContext);
3518 ruleCall.Reset(cast<soulcm.scmpg.Parser*>(match.value));
3519 if (match.hit)
3520 {
3521 value.Reset(ruleCall.Release());
3522 }
3523 *parentMatch7 = match;
3524 }
3525 *parentMatch6 = match;
3526 if (!match.hit)
3527 {
3528 Match match(false);
3529 Match* parentMatch8 = &match;
3530 lexer.SetPos(save);
3531 {
3532 Match match(false);
3533 Match* parentMatch9 = &match;
3534 {
3535 long pos = lexer.GetPos();
3536 Match match = ParserFileParser.Primitive(lexer);
3537 primitive.Reset(cast<soulcm.scmpg.Parser*>(match.value));
3538 if (match.hit)
3539 {
3540 value.Reset(primitive.Release());
3541 }
3542 *parentMatch9 = match;
3543 }
3544 *parentMatch8 = match;
3545 }
3546 *parentMatch6 = match;
3547 }
3548 }
3549 *parentMatch5 = match;
3550 if (!match.hit)
3551 {
3552 Match match(false);
3553 Match* parentMatch10 = &match;
3554 lexer.SetPos(save);
3555 {
3556 Match match(false);
3557 Match* parentMatch11 = &match;
3558 {
3559 long pos = lexer.GetPos();
3560 Match match = ParserFileParser.Grouping(lexer, parsingContext);
3561 grouping.Reset(cast<soulcm.scmpg.Parser*>(match.value));
3562 if (match.hit)
3563 {
3564 value.Reset(grouping.Release());
3565 }
3566 *parentMatch11 = match;
3567 }
3568 *parentMatch10 = match;
3569 }
3570 *parentMatch5 = match;
3571 }
3572 }
3573 *parentMatch4 = match;
3574 }
3575 *parentMatch3 = match;
3576 }
3577 if (match.hit)
3578 {
3579 Match match(false);
3580 Match* parentMatch12 = &match;
3581 {
3582 Match match(true);
3583 long save = lexer.GetPos();
3584 Match* parentMatch13 = &match;
3585 {
3586 Match match(false);
3587 Match* parentMatch14 = &match;
3588 {
3589 Match match(false);
3590 Match* parentMatch15 = &match;
3591 {
3592 long pos = lexer.GetPos();
3593 Match match(false);
3594 if (*lexer == EXCLAMATION)
3595 {
3596 ++lexer;
3597 match.hit = true;
3598 }
3599 if (match.hit)
3600 {
3601 value.Reset(new soulcm.scmpg.ExpectationParser(value.Release()));
3602 }
3603 *parentMatch15 = match;
3604 }
3605 *parentMatch14 = match;
3606 }
3607 if (match.hit)
3608 {
3609 *parentMatch13 = match;
3610 }
3611 else
3612 {
3613 lexer.SetPos(save);
3614 }
3615 }
3616 *parentMatch12 = match;
3617 }
3618 *parentMatch3 = match;
3619 }
3620 *parentMatch2 = match;
3621 }
3622 if (match.hit)
3623 {
3624 Match match(false);
3625 Match* parentMatch16 = &match;
3626 {
3627 Match match(true);
3628 long save = lexer.GetPos();
3629 Match* parentMatch17 = &match;
3630 {
3631 Match match(false);
3632 Match* parentMatch18 = &match;
3633 {
3634 Match match(false);
3635 Match* parentMatch19 = &match;
3636 {
3637 Match match(false);
3638 Match* parentMatch20 = &match;
3639 {
3640 long pos = lexer.GetPos();
3641 Match match(false);
3642 Match* parentMatch21 = &match;
3643 {
3644 Match match(false);
3645 Match* parentMatch22 = &match;
3646 {
3647 Match match = StatementParser.CompoundStatement(lexer, parsingContext);
3648 successCode.Reset(cast<CompoundStatementNode*>(match.value));
3649 *parentMatch22 = match;
3650 }
3651 if (match.hit)
3652 {
3653 Match match(false);
3654 Match* parentMatch23 = &match;
3655 {
3656 Match match(true);
3657 long save = lexer.GetPos();
3658 Match* parentMatch24 = &match;
3659 {
3660 Match match(false);
3661 Match* parentMatch25 = &match;
3662 {
3663 Match match(false);
3664 Match* parentMatch26 = &match;
3665 {
3666 Match match(false);
3667 if (*lexer == DIV)
3668 {
3669 ++lexer;
3670 match.hit = true;
3671 }
3672 *parentMatch26 = match;
3673 }
3674 if (match.hit)
3675 {
3676 Match match(false);
3677 Match* parentMatch27 = &match;
3678 {
3679 Match match = StatementParser.CompoundStatement(lexer, parsingContext);
3680 failureCode.Reset(cast<CompoundStatementNode*>(match.value));
3681 *parentMatch27 = match;
3682 }
3683 *parentMatch26 = match;
3684 }
3685 *parentMatch25 = match;
3686 }
3687 if (match.hit)
3688 {
3689 *parentMatch24 = match;
3690 }
3691 else
3692 {
3693 lexer.SetPos(save);
3694 }
3695 }
3696 *parentMatch23 = match;
3697 }
3698 *parentMatch22 = match;
3699 }
3700 *parentMatch21 = match;
3701 }
3702 if (match.hit)
3703 {
3704 value.Reset(new soulcm.scmpg.ActionParser(successCode.Release(), failureCode.Release(), value.Release()));
3705 }
3706 *parentMatch20 = match;
3707 }
3708 *parentMatch19 = match;
3709 }
3710 *parentMatch18 = match;
3711 }
3712 if (match.hit)
3713 {
3714 *parentMatch17 = match;
3715 }
3716 else
3717 {
3718 lexer.SetPos(save);
3719 }
3720 }
3721 *parentMatch16 = match;
3722 }
3723 *parentMatch2 = match;
3724 }
3725 *parentMatch1 = match;
3726 }
3727 if (match.hit)
3728 {
3729 {
3730 #if (DEBUG)
3731 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primary");
3732 #endif
3733 return Match(true, value.Release());
3734 }
3735 }
3736 *parentMatch0 = match;
3737 }
3738 #if (DEBUG)
3739 if (writeToLog)
3740 {
3741 if (match.hit)
3742 {
3743 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primary");
3744 }
3745 else
3746 {
3747 System.Lex.WriteFailureToLog(lexer, u"Primary");
3748 }
3749 }
3750 #endif
3751 if (!match.hit)
3752 {
3753 match.value = null;
3754 }
3755 return match;
3756 }
3757 public static Match RuleCall(ParserFileLexer& lexer, ParsingContext* parsingContext)
3758 {
3759 #if (DEBUG)
3760 Span debugSpan;
3761 bool writeToLog = lexer.Log() != null;
3762 if (writeToLog)
3763 {
3764 debugSpan = lexer.GetSpan();
3765 System.Lex.WriteBeginRuleToLog(lexer, u"RuleCall");
3766 }
3767 #endif
3768 ustring ruleName;
3769 UniquePtr<InvokeNode> invoke;
3770 long nonterminalPos;
3771 UniquePtr<Value<ustring>> nt;
3772 Match match(false);
3773 Match* parentMatch0 = &match;
3774 {
3775 Match match(false);
3776 Match* parentMatch1 = &match;
3777 {
3778 Match match(false);
3779 Match* parentMatch2 = &match;
3780 {
3781 Match match(false);
3782 Match* parentMatch3 = &match;
3783 {
3784 long pos = lexer.GetPos();
3785 Match match = ParserFileParser.Nonterminal(lexer);
3786 nt.Reset(cast<Value<ustring>*>(match.value));
3787 if (match.hit)
3788 {
3789 ruleName = nt->value;
3790 nonterminalPos = pos;
3791 invoke.Reset(new InvokeNode(Span(), parsingContext->ModuleId()));
3792 }
3793 *parentMatch3 = match;
3794 }
3795 *parentMatch2 = match;
3796 }
3797 if (match.hit)
3798 {
3799 Match match(false);
3800 Match* parentMatch4 = &match;
3801 {
3802 Match match(true);
3803 long save = lexer.GetPos();
3804 Match* parentMatch5 = &match;
3805 {
3806 Match match(false);
3807 Match* parentMatch6 = &match;
3808 {
3809 Match match(false);
3810 Match* parentMatch7 = &match;
3811 {
3812 Match match(false);
3813 Match* parentMatch8 = &match;
3814 {
3815 Match match(false);
3816 Match* parentMatch9 = &match;
3817 {
3818 long pos = lexer.GetPos();
3819 bool pass = true;
3820 Match match(false);
3821 if (*lexer == LPAREN)
3822 {
3823 ++lexer;
3824 match.hit = true;
3825 }
3826 if (match.hit)
3827 {
3828 pass = NoWhiteSpaceBetweenTokens(lexer.GetToken(nonterminalPos), lexer.GetToken(pos));
3829 }
3830 if (match.hit && !pass)
3831 {
3832 match = Match(false);
3833 }
3834 *parentMatch9 = match;
3835 }
3836 *parentMatch8 = match;
3837 }
3838 if (match.hit)
3839 {
3840 Match match(false);
3841 Match* parentMatch10 = &match;
3842 {
3843 Match match = ExpressionParser.ExpressionList(lexer, parsingContext, invoke.Get());
3844 *parentMatch10 = match;
3845 }
3846 *parentMatch8 = match;
3847 }
3848 *parentMatch7 = match;
3849 }
3850 if (match.hit)
3851 {
3852 Match match(false);
3853 Match* parentMatch11 = &match;
3854 {
3855 Match match(false);
3856 if (*lexer == RPAREN)
3857 {
3858 ++lexer;
3859 match.hit = true;
3860 }
3861 *parentMatch11 = match;
3862 }
3863 *parentMatch7 = match;
3864 }
3865 *parentMatch6 = match;
3866 }
3867 if (match.hit)
3868 {
3869 *parentMatch5 = match;
3870 }
3871 else
3872 {
3873 lexer.SetPos(save);
3874 }
3875 }
3876 *parentMatch4 = match;
3877 }
3878 *parentMatch2 = match;
3879 }
3880 *parentMatch1 = match;
3881 }
3882 if (match.hit)
3883 {
3884 Match match(false);
3885 Match* parentMatch12 = &match;
3886 {
3887 Match match(false);
3888 if (*lexer == COLON)
3889 {
3890 ++lexer;
3891 match.hit = true;
3892 }
3893 *parentMatch12 = match;
3894 }
3895 *parentMatch1 = match;
3896 }
3897 *parentMatch0 = match;
3898 }
3899 if (match.hit)
3900 {
3901 Match match(false);
3902 Match* parentMatch13 = &match;
3903 {
3904 Match match(false);
3905 Match* parentMatch14 = &match;
3906 {
3907 long pos = lexer.GetPos();
3908 Span span = lexer.GetSpan();
3909 Match match(true);
3910 Match* parentMatch15 = &match;
3911 {
3912 System.Lex.Span span = lexer.GetSpan();
3913 Match match(false);
3914 if (*lexer == ID)
3915 {
3916 ++lexer;
3917 match.hit = true;
3918 }
3919 if (match.hit)
3920 {
3921 *parentMatch15 = match;
3922 }
3923 else
3924 {
3925 lexer.ThrowExpectationFailure(span, GetTokenName(ID));
3926 }
3927 }
3928 if (match.hit)
3929 {
3930 ustring name = lexer.GetMatch(span);
3931 soulcm.scmpg.NonterminalParser* nonterminalParser = new soulcm.scmpg.NonterminalParser(name, ruleName);
3932 nonterminalParser->SetArguments(invoke.Get());
3933 {
3934 #if (DEBUG)
3935 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleCall");
3936 #endif
3937 return Match(true, nonterminalParser);
3938 }
3939 }
3940 *parentMatch14 = match;
3941 }
3942 *parentMatch13 = match;
3943 }
3944 *parentMatch0 = match;
3945 }
3946 #if (DEBUG)
3947 if (writeToLog)
3948 {
3949 if (match.hit)
3950 {
3951 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleCall");
3952 }
3953 else
3954 {
3955 System.Lex.WriteFailureToLog(lexer, u"RuleCall");
3956 }
3957 }
3958 #endif
3959 if (!match.hit)
3960 {
3961 match.value = null;
3962 }
3963 return match;
3964 }
3965 public static Match Nonterminal(ParserFileLexer& lexer)
3966 {
3967 #if (DEBUG)
3968 Span debugSpan;
3969 bool writeToLog = lexer.Log() != null;
3970 if (writeToLog)
3971 {
3972 debugSpan = lexer.GetSpan();
3973 System.Lex.WriteBeginRuleToLog(lexer, u"Nonterminal");
3974 }
3975 #endif
3976 Match match(false);
3977 Match* parentMatch0 = &match;
3978 {
3979 long pos = lexer.GetPos();
3980 Span span = lexer.GetSpan();
3981 Match match(false);
3982 if (*lexer == ID)
3983 {
3984 ++lexer;
3985 match.hit = true;
3986 }
3987 if (match.hit)
3988 {
3989 {
3990 #if (DEBUG)
3991 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Nonterminal");
3992 #endif
3993 return Match(true, new Value<ustring>(lexer.GetMatch(span)));
3994 }
3995 }
3996 *parentMatch0 = match;
3997 }
3998 #if (DEBUG)
3999 if (writeToLog)
4000 {
4001 if (match.hit)
4002 {
4003 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Nonterminal");
4004 }
4005 else
4006 {
4007 System.Lex.WriteFailureToLog(lexer, u"Nonterminal");
4008 }
4009 }
4010 #endif
4011 if (!match.hit)
4012 {
4013 match.value = null;
4014 }
4015 return match;
4016 }
4017 public static Match Primitive(ParserFileLexer& lexer)
4018 {
4019 #if (DEBUG)
4020 Span debugSpan;
4021 bool writeToLog = lexer.Log() != null;
4022 if (writeToLog)
4023 {
4024 debugSpan = lexer.GetSpan();
4025 System.Lex.WriteBeginRuleToLog(lexer, u"Primitive");
4026 }
4027 #endif
4028 Match match(false);
4029 long pos = lexer.GetPos();
4030 Span span = lexer.GetSpan();
4031 switch (*lexer)
4032 {
4033 case EMPTY:
4034 {
4035 ++lexer;
4036 {
4037 #if (DEBUG)
4038 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
4039 #endif
4040 return Match(true, new soulcm.scmpg.EmptyParser());
4041 }
4042 break;
4043 }
4044 case ANY:
4045 {
4046 ++lexer;
4047 {
4048 #if (DEBUG)
4049 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
4050 #endif
4051 return Match(true, new soulcm.scmpg.AnyParser());
4052 }
4053 break;
4054 }
4055 case ID:
4056 {
4057 ++lexer;
4058 ustring tokenName = lexer.GetMatch(span);
4059 {
4060 #if (DEBUG)
4061 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
4062 #endif
4063 return Match(true, new soulcm.scmpg.TokenParser(tokenName));
4064 }
4065 break;
4066 }
4067 case CHARLIT:
4068 {
4069 ++lexer;
4070 uchar charLit = soulcm.scmpg.ParseCharLiteral(lexer.FileName(), lexer.GetToken(pos));
4071 {
4072 #if (DEBUG)
4073 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
4074 #endif
4075 return Match(true, new soulcm.scmpg.CharParser(charLit));
4076 }
4077 break;
4078 }
4079 case STRINGLIT:
4080 {
4081 ++lexer;
4082 ustring strLit = soulcm.scmpg.ParseStringLiteral(lexer.FileName(), lexer.GetToken(pos));
4083 if (strLit.Length() > 0 && strLit[0] == '[' && strLit[strLit.Length() - 1] == ']')
4084 {
4085 soulcm.scmpg.CharSet charSet = soulcm.scmpg.ParseCharSet(lexer.FileName(), lexer.GetToken(pos), strLit);
4086 {
4087 #if (DEBUG)
4088 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
4089 #endif
4090 return Match(true, new soulcm.scmpg.CharSetParser(charSet));
4091 }
4092 }
4093 else
4094 {
4095 {
4096 #if (DEBUG)
4097 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
4098 #endif
4099 return Match(true, new soulcm.scmpg.StringParser(strLit));
4100 }
4101 }
4102 break;
4103 }
4104 }
4105 #if (DEBUG)
4106 if (writeToLog)
4107 {
4108 if (match.hit)
4109 {
4110 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
4111 }
4112 else
4113 {
4114 System.Lex.WriteFailureToLog(lexer, u"Primitive");
4115 }
4116 }
4117 #endif
4118 if (!match.hit)
4119 {
4120 match.value = null;
4121 }
4122 return match;
4123 }
4124 public static Match Grouping(ParserFileLexer& lexer, ParsingContext* parsingContext)
4125 {
4126 #if (DEBUG)
4127 Span debugSpan;
4128 bool writeToLog = lexer.Log() != null;
4129 if (writeToLog)
4130 {
4131 debugSpan = lexer.GetSpan();
4132 System.Lex.WriteBeginRuleToLog(lexer, u"Grouping");
4133 }
4134 #endif
4135 UniquePtr<soulcm.scmpg.Parser> alt;
4136 Match match(false);
4137 Match* parentMatch0 = &match;
4138 {
4139 long pos = lexer.GetPos();
4140 Match match(false);
4141 Match* parentMatch1 = &match;
4142 {
4143 Match match(false);
4144 Match* parentMatch2 = &match;
4145 {
4146 Match match(false);
4147 Match* parentMatch3 = &match;
4148 {
4149 Match match(false);
4150 if (*lexer == LPAREN)
4151 {
4152 ++lexer;
4153 match.hit = true;
4154 }
4155 *parentMatch3 = match;
4156 }
4157 if (match.hit)
4158 {
4159 Match match(false);
4160 Match* parentMatch4 = &match;
4161 {
4162 Match match = ParserFileParser.Alternative(lexer, parsingContext);
4163 alt.Reset(cast<soulcm.scmpg.Parser*>(match.value));
4164 *parentMatch4 = match;
4165 }
4166 *parentMatch3 = match;
4167 }
4168 *parentMatch2 = match;
4169 }
4170 if (match.hit)
4171 {
4172 Match match(false);
4173 Match* parentMatch5 = &match;
4174 {
4175 Match match(true);
4176 Match* parentMatch6 = &match;
4177 {
4178 System.Lex.Span span = lexer.GetSpan();
4179 Match match(false);
4180 if (*lexer == RPAREN)
4181 {
4182 ++lexer;
4183 match.hit = true;
4184 }
4185 if (match.hit)
4186 {
4187 *parentMatch6 = match;
4188 }
4189 else
4190 {
4191 lexer.ThrowExpectationFailure(span, GetTokenName(RPAREN));
4192 }
4193 }
4194 *parentMatch5 = match;
4195 }
4196 *parentMatch2 = match;
4197 }
4198 *parentMatch1 = match;
4199 }
4200 if (match.hit)
4201 {
4202 {
4203 #if (DEBUG)
4204 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Grouping");
4205 #endif
4206 return Match(true, new soulcm.scmpg.GroupingParser(alt.Release()));
4207 }
4208 }
4209 *parentMatch0 = match;
4210 }
4211 #if (DEBUG)
4212 if (writeToLog)
4213 {
4214 if (match.hit)
4215 {
4216 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Grouping");
4217 }
4218 else
4219 {
4220 System.Lex.WriteFailureToLog(lexer, u"Grouping");
4221 }
4222 }
4223 #endif
4224 if (!match.hit)
4225 {
4226 match.value = null;
4227 }
4228 return match;
4229 }
4230 }