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.scm2html.ParserFile> Parse(ParserFileLexer& lexer, ParsingContext* parsingContext)
14 {
15 UniquePtr<soulcm.scm2html.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.scm2html.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.scm2html.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.scm2html.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.scm2html.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.scm2html.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.scm2html.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* parsingContext)
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, parsingContext);
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, parsingContext);
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* parsingContext)
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 = ParIdentifierParser.Identifier(lexer, parsingContext);
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 = ParIdentifierParser.QualifiedId(lexer, parsingContext);
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, parsingContext->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* parsingContext)
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 = ParIdentifierParser.QualifiedId(lexer, parsingContext);
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, parsingContext->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.scm2html.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.scm2html.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.scm2html.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 = ParserFileParser.MainStatement(lexer, grammarParser);
810 *parentMatch3 = match;
811 if (!match.hit)
812 {
813 Match match(false);
814 Match* parentMatch4 = &match;
815 lexer.SetPos(save);
816 {
817 Match match = ParserFileParser.UsingStatement(lexer, grammarParser);
818 *parentMatch4 = match;
819 }
820 *parentMatch3 = match;
821 }
822 }
823 *parentMatch2 = match;
824 if (!match.hit)
825 {
826 Match match(false);
827 Match* parentMatch5 = &match;
828 lexer.SetPos(save);
829 {
830 Match match = ParserFileParser.LexerStatement(lexer, grammarParser);
831 *parentMatch5 = match;
832 }
833 *parentMatch2 = match;
834 }
835 }
836 *parentMatch1 = match;
837 if (!match.hit)
838 {
839 Match match(false);
840 Match* parentMatch6 = &match;
841 lexer.SetPos(save);
842 {
843 Match match = ParserFileParser.RuleInfoStatement(lexer, grammarParser);
844 *parentMatch6 = match;
845 }
846 *parentMatch1 = match;
847 }
848 }
849 *parentMatch0 = match;
850 if (!match.hit)
851 {
852 Match match(false);
853 Match* parentMatch7 = &match;
854 lexer.SetPos(save);
855 {
856 Match match = ParserFileParser.RuleStatement(lexer, grammarParser, parsingContext);
857 *parentMatch7 = match;
858 }
859 *parentMatch0 = match;
860 }
861 }
862 #if (DEBUG)
863 if (writeToLog)
864 {
865 if (match.hit)
866 {
867 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Statement");
868 }
869 else
870 {
871 System.Lex.WriteFailureToLog(lexer, u"Statement");
872 }
873 }
874 #endif
875 if (!match.hit)
876 {
877 match.value = null;
878 }
879 return match;
880 }
881 public static Match MainStatement(ParserFileLexer& lexer, soulcm.scm2html.GrammarParser* grammarParser)
882 {
883 #if (DEBUG)
884 Span debugSpan;
885 bool writeToLog = lexer.Log() != null;
886 if (writeToLog)
887 {
888 debugSpan = lexer.GetSpan();
889 System.Lex.WriteBeginRuleToLog(lexer, u"MainStatement");
890 }
891 #endif
892 Match match(false);
893 Match* parentMatch0 = &match;
894 {
895 Match match(false);
896 if (*lexer == MAIN)
897 {
898 ++lexer;
899 match.hit = true;
900 }
901 *parentMatch0 = match;
902 }
903 if (match.hit)
904 {
905 Match match(false);
906 Match* parentMatch1 = &match;
907 {
908 Match match(false);
909 Match* parentMatch2 = &match;
910 {
911 long pos = lexer.GetPos();
912 Match match(true);
913 Match* parentMatch3 = &match;
914 {
915 System.Lex.Span span = lexer.GetSpan();
916 Match match(false);
917 if (*lexer == SEMICOLON)
918 {
919 ++lexer;
920 match.hit = true;
921 }
922 if (match.hit)
923 {
924 *parentMatch3 = match;
925 }
926 else
927 {
928 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
929 }
930 }
931 if (match.hit)
932 {
933 grammarParser->SetMain();
934 }
935 *parentMatch2 = match;
936 }
937 *parentMatch1 = match;
938 }
939 *parentMatch0 = match;
940 }
941 #if (DEBUG)
942 if (writeToLog)
943 {
944 if (match.hit)
945 {
946 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MainStatement");
947 }
948 else
949 {
950 System.Lex.WriteFailureToLog(lexer, u"MainStatement");
951 }
952 }
953 #endif
954 if (!match.hit)
955 {
956 match.value = null;
957 }
958 return match;
959 }
960 public static Match UsingStatement(ParserFileLexer& lexer, soulcm.scm2html.GrammarParser* grammarParser)
961 {
962 #if (DEBUG)
963 Span debugSpan;
964 bool writeToLog = lexer.Log() != null;
965 if (writeToLog)
966 {
967 debugSpan = lexer.GetSpan();
968 System.Lex.WriteBeginRuleToLog(lexer, u"UsingStatement");
969 }
970 #endif
971 UniquePtr<Value<ustring>> parserId;
972 Match match(false);
973 Match* parentMatch0 = &match;
974 {
975 Match match(false);
976 Match* parentMatch1 = &match;
977 {
978 Match match(false);
979 if (*lexer == USING)
980 {
981 ++lexer;
982 match.hit = true;
983 }
984 *parentMatch1 = match;
985 }
986 if (match.hit)
987 {
988 Match match(false);
989 Match* parentMatch2 = &match;
990 {
991 Match match(true);
992 Match* parentMatch3 = &match;
993 {
994 System.Lex.Span span = lexer.GetSpan();
995 Match match = ParserFileParser.UsingQualifiedId(lexer);
996 parserId.Reset(cast<Value<ustring>*>(match.value));
997 if (match.hit)
998 {
999 *parentMatch3 = match;
1000 }
1001 else
1002 {
1003 lexer.ThrowExpectationFailure(span, u"UsingQualifiedId");
1004 }
1005 }
1006 *parentMatch2 = match;
1007 }
1008 *parentMatch1 = match;
1009 }
1010 *parentMatch0 = match;
1011 }
1012 if (match.hit)
1013 {
1014 Match match(false);
1015 Match* parentMatch4 = &match;
1016 {
1017 Match match(false);
1018 Match* parentMatch5 = &match;
1019 {
1020 long pos = lexer.GetPos();
1021 Match match(true);
1022 Match* parentMatch6 = &match;
1023 {
1024 System.Lex.Span span = lexer.GetSpan();
1025 Match match(false);
1026 if (*lexer == SEMICOLON)
1027 {
1028 ++lexer;
1029 match.hit = true;
1030 }
1031 if (match.hit)
1032 {
1033 *parentMatch6 = match;
1034 }
1035 else
1036 {
1037 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
1038 }
1039 }
1040 if (match.hit)
1041 {
1042 grammarParser->AddUsing(parserId->value);
1043 }
1044 *parentMatch5 = match;
1045 }
1046 *parentMatch4 = match;
1047 }
1048 *parentMatch0 = match;
1049 }
1050 #if (DEBUG)
1051 if (writeToLog)
1052 {
1053 if (match.hit)
1054 {
1055 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingStatement");
1056 }
1057 else
1058 {
1059 System.Lex.WriteFailureToLog(lexer, u"UsingStatement");
1060 }
1061 }
1062 #endif
1063 if (!match.hit)
1064 {
1065 match.value = null;
1066 }
1067 return match;
1068 }
1069 public static Match UsingQualifiedId(ParserFileLexer& lexer)
1070 {
1071 #if (DEBUG)
1072 Span debugSpan;
1073 bool writeToLog = lexer.Log() != null;
1074 if (writeToLog)
1075 {
1076 debugSpan = lexer.GetSpan();
1077 System.Lex.WriteBeginRuleToLog(lexer, u"UsingQualifiedId");
1078 }
1079 #endif
1080 Span s;
1081 Match match(false);
1082 Match* parentMatch0 = &match;
1083 {
1084 long pos = lexer.GetPos();
1085 Match match(false);
1086 Match* parentMatch1 = &match;
1087 {
1088 Match match(false);
1089 Match* parentMatch2 = &match;
1090 {
1091 Match match(false);
1092 Match* parentMatch3 = &match;
1093 {
1094 long pos = lexer.GetPos();
1095 Span span = lexer.GetSpan();
1096 Match match(false);
1097 if (*lexer == ID)
1098 {
1099 ++lexer;
1100 match.hit = true;
1101 }
1102 if (match.hit)
1103 {
1104 s = span;
1105 }
1106 *parentMatch3 = match;
1107 }
1108 *parentMatch2 = match;
1109 }
1110 if (match.hit)
1111 {
1112 Match match(false);
1113 Match* parentMatch4 = &match;
1114 {
1115 Match match(true);
1116 Match* parentMatch5 = &match;
1117 {
1118 while (true)
1119 {
1120 long save = lexer.GetPos();
1121 {
1122 Match match(false);
1123 Match* parentMatch6 = &match;
1124 {
1125 Match match(false);
1126 Match* parentMatch7 = &match;
1127 {
1128 Match match(false);
1129 if (*lexer == DOT)
1130 {
1131 ++lexer;
1132 match.hit = true;
1133 }
1134 *parentMatch7 = match;
1135 }
1136 if (match.hit)
1137 {
1138 Match match(false);
1139 Match* parentMatch8 = &match;
1140 {
1141 Match match(false);
1142 Match* parentMatch9 = &match;
1143 {
1144 long pos = lexer.GetPos();
1145 Span span = lexer.GetSpan();
1146 Match match(false);
1147 if (*lexer == ID)
1148 {
1149 ++lexer;
1150 match.hit = true;
1151 }
1152 if (match.hit)
1153 {
1154 s.end = span.end;
1155 }
1156 *parentMatch9 = match;
1157 }
1158 *parentMatch8 = match;
1159 }
1160 *parentMatch7 = match;
1161 }
1162 *parentMatch6 = match;
1163 }
1164 if (match.hit)
1165 {
1166 *parentMatch5 = match;
1167 }
1168 else
1169 {
1170 lexer.SetPos(save);
1171 break;
1172 }
1173 }
1174 }
1175 }
1176 *parentMatch4 = match;
1177 }
1178 *parentMatch2 = match;
1179 }
1180 *parentMatch1 = match;
1181 }
1182 if (match.hit)
1183 {
1184 {
1185 #if (DEBUG)
1186 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingQualifiedId");
1187 #endif
1188 return Match(true, new Value<ustring>(lexer.GetMatch(s)));
1189 }
1190 }
1191 *parentMatch0 = match;
1192 }
1193 #if (DEBUG)
1194 if (writeToLog)
1195 {
1196 if (match.hit)
1197 {
1198 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UsingQualifiedId");
1199 }
1200 else
1201 {
1202 System.Lex.WriteFailureToLog(lexer, u"UsingQualifiedId");
1203 }
1204 }
1205 #endif
1206 if (!match.hit)
1207 {
1208 match.value = null;
1209 }
1210 return match;
1211 }
1212 public static Match LexerStatement(ParserFileLexer& lexer, soulcm.scm2html.GrammarParser* grammarParser)
1213 {
1214 #if (DEBUG)
1215 Span debugSpan;
1216 bool writeToLog = lexer.Log() != null;
1217 if (writeToLog)
1218 {
1219 debugSpan = lexer.GetSpan();
1220 System.Lex.WriteBeginRuleToLog(lexer, u"LexerStatement");
1221 }
1222 #endif
1223 ustring lexerName;
1224 Match match(false);
1225 Match* parentMatch0 = &match;
1226 {
1227 Match match(false);
1228 Match* parentMatch1 = &match;
1229 {
1230 Match match(false);
1231 if (*lexer == USELEXER)
1232 {
1233 ++lexer;
1234 match.hit = true;
1235 }
1236 *parentMatch1 = match;
1237 }
1238 if (match.hit)
1239 {
1240 Match match(false);
1241 Match* parentMatch2 = &match;
1242 {
1243 Match match(false);
1244 Match* parentMatch3 = &match;
1245 {
1246 long pos = lexer.GetPos();
1247 Span span = lexer.GetSpan();
1248 Match match(true);
1249 Match* parentMatch4 = &match;
1250 {
1251 System.Lex.Span span = lexer.GetSpan();
1252 Match match(false);
1253 if (*lexer == ID)
1254 {
1255 ++lexer;
1256 match.hit = true;
1257 }
1258 if (match.hit)
1259 {
1260 *parentMatch4 = match;
1261 }
1262 else
1263 {
1264 lexer.ThrowExpectationFailure(span, GetTokenName(ID));
1265 }
1266 }
1267 if (match.hit)
1268 {
1269 lexerName = lexer.GetMatch(span);
1270 }
1271 *parentMatch3 = match;
1272 }
1273 *parentMatch2 = match;
1274 }
1275 *parentMatch1 = match;
1276 }
1277 *parentMatch0 = match;
1278 }
1279 if (match.hit)
1280 {
1281 Match match(false);
1282 Match* parentMatch5 = &match;
1283 {
1284 Match match(false);
1285 Match* parentMatch6 = &match;
1286 {
1287 long pos = lexer.GetPos();
1288 Match match(true);
1289 Match* parentMatch7 = &match;
1290 {
1291 System.Lex.Span span = lexer.GetSpan();
1292 Match match(false);
1293 if (*lexer == SEMICOLON)
1294 {
1295 ++lexer;
1296 match.hit = true;
1297 }
1298 if (match.hit)
1299 {
1300 *parentMatch7 = match;
1301 }
1302 else
1303 {
1304 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
1305 }
1306 }
1307 if (match.hit)
1308 {
1309 grammarParser->SetLexer(lexerName);
1310 }
1311 *parentMatch6 = match;
1312 }
1313 *parentMatch5 = match;
1314 }
1315 *parentMatch0 = match;
1316 }
1317 #if (DEBUG)
1318 if (writeToLog)
1319 {
1320 if (match.hit)
1321 {
1322 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LexerStatement");
1323 }
1324 else
1325 {
1326 System.Lex.WriteFailureToLog(lexer, u"LexerStatement");
1327 }
1328 }
1329 #endif
1330 if (!match.hit)
1331 {
1332 match.value = null;
1333 }
1334 return match;
1335 }
1336 public static Match RuleInfoStatement(ParserFileLexer& lexer, soulcm.scm2html.GrammarParser* grammarParser)
1337 {
1338 #if (DEBUG)
1339 Span debugSpan;
1340 bool writeToLog = lexer.Log() != null;
1341 if (writeToLog)
1342 {
1343 debugSpan = lexer.GetSpan();
1344 System.Lex.WriteBeginRuleToLog(lexer, u"RuleInfoStatement");
1345 }
1346 #endif
1347 Match match(false);
1348 Match* parentMatch0 = &match;
1349 {
1350 Match match(false);
1351 Match* parentMatch1 = &match;
1352 {
1353 Match match(false);
1354 Match* parentMatch2 = &match;
1355 {
1356 Match match(false);
1357 if (*lexer == RULEINFO)
1358 {
1359 ++lexer;
1360 match.hit = true;
1361 }
1362 *parentMatch2 = match;
1363 }
1364 if (match.hit)
1365 {
1366 Match match(false);
1367 Match* parentMatch3 = &match;
1368 {
1369 Match match(true);
1370 Match* parentMatch4 = &match;
1371 {
1372 System.Lex.Span span = lexer.GetSpan();
1373 Match match(false);
1374 if (*lexer == LBRACE)
1375 {
1376 ++lexer;
1377 match.hit = true;
1378 }
1379 if (match.hit)
1380 {
1381 *parentMatch4 = match;
1382 }
1383 else
1384 {
1385 lexer.ThrowExpectationFailure(span, GetTokenName(LBRACE));
1386 }
1387 }
1388 *parentMatch3 = match;
1389 }
1390 *parentMatch2 = match;
1391 }
1392 *parentMatch1 = match;
1393 }
1394 if (match.hit)
1395 {
1396 Match match(false);
1397 Match* parentMatch5 = &match;
1398 {
1399 Match match(true);
1400 long save = lexer.GetPos();
1401 Match* parentMatch6 = &match;
1402 {
1403 Match match(false);
1404 Match* parentMatch7 = &match;
1405 {
1406 Match match(false);
1407 Match* parentMatch8 = &match;
1408 {
1409 Match match = ParserFileParser.RuleInfo(lexer, grammarParser);
1410 *parentMatch8 = match;
1411 }
1412 if (match.hit)
1413 {
1414 Match match(false);
1415 Match* parentMatch9 = &match;
1416 {
1417 Match match(true);
1418 Match* parentMatch10 = &match;
1419 {
1420 while (true)
1421 {
1422 long save = lexer.GetPos();
1423 {
1424 Match match(false);
1425 Match* parentMatch11 = &match;
1426 {
1427 Match match(false);
1428 if (*lexer == COMMA)
1429 {
1430 ++lexer;
1431 match.hit = true;
1432 }
1433 *parentMatch11 = match;
1434 }
1435 if (match.hit)
1436 {
1437 Match match(false);
1438 Match* parentMatch12 = &match;
1439 {
1440 Match match = ParserFileParser.RuleInfo(lexer, grammarParser);
1441 *parentMatch12 = match;
1442 }
1443 *parentMatch11 = match;
1444 }
1445 if (match.hit)
1446 {
1447 *parentMatch10 = match;
1448 }
1449 else
1450 {
1451 lexer.SetPos(save);
1452 break;
1453 }
1454 }
1455 }
1456 }
1457 *parentMatch9 = match;
1458 }
1459 *parentMatch8 = match;
1460 }
1461 *parentMatch7 = match;
1462 }
1463 if (match.hit)
1464 {
1465 *parentMatch6 = match;
1466 }
1467 else
1468 {
1469 lexer.SetPos(save);
1470 }
1471 }
1472 *parentMatch5 = match;
1473 }
1474 *parentMatch1 = match;
1475 }
1476 *parentMatch0 = match;
1477 }
1478 if (match.hit)
1479 {
1480 Match match(false);
1481 Match* parentMatch13 = &match;
1482 {
1483 Match match(true);
1484 Match* parentMatch14 = &match;
1485 {
1486 System.Lex.Span span = lexer.GetSpan();
1487 Match match(false);
1488 if (*lexer == RBRACE)
1489 {
1490 ++lexer;
1491 match.hit = true;
1492 }
1493 if (match.hit)
1494 {
1495 *parentMatch14 = match;
1496 }
1497 else
1498 {
1499 lexer.ThrowExpectationFailure(span, GetTokenName(RBRACE));
1500 }
1501 }
1502 *parentMatch13 = match;
1503 }
1504 *parentMatch0 = match;
1505 }
1506 #if (DEBUG)
1507 if (writeToLog)
1508 {
1509 if (match.hit)
1510 {
1511 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleInfoStatement");
1512 }
1513 else
1514 {
1515 System.Lex.WriteFailureToLog(lexer, u"RuleInfoStatement");
1516 }
1517 }
1518 #endif
1519 if (!match.hit)
1520 {
1521 match.value = null;
1522 }
1523 return match;
1524 }
1525 public static Match RuleInfo(ParserFileLexer& lexer, soulcm.scm2html.GrammarParser* grammarParser)
1526 {
1527 #if (DEBUG)
1528 Span debugSpan;
1529 bool writeToLog = lexer.Log() != null;
1530 if (writeToLog)
1531 {
1532 debugSpan = lexer.GetSpan();
1533 System.Lex.WriteBeginRuleToLog(lexer, u"RuleInfo");
1534 }
1535 #endif
1536 ustring ruleName;
1537 ustring ruleInfo;
1538 Match match(false);
1539 Match* parentMatch0 = &match;
1540 {
1541 Match match(false);
1542 Match* parentMatch1 = &match;
1543 {
1544 Match match(false);
1545 Match* parentMatch2 = &match;
1546 {
1547 Match match(false);
1548 Match* parentMatch3 = &match;
1549 {
1550 Match match(false);
1551 if (*lexer == LPAREN)
1552 {
1553 ++lexer;
1554 match.hit = true;
1555 }
1556 *parentMatch3 = match;
1557 }
1558 if (match.hit)
1559 {
1560 Match match(false);
1561 Match* parentMatch4 = &match;
1562 {
1563 Match match(false);
1564 Match* parentMatch5 = &match;
1565 {
1566 long pos = lexer.GetPos();
1567 Span span = lexer.GetSpan();
1568 Match match(true);
1569 Match* parentMatch6 = &match;
1570 {
1571 System.Lex.Span span = lexer.GetSpan();
1572 Match match(false);
1573 if (*lexer == ID)
1574 {
1575 ++lexer;
1576 match.hit = true;
1577 }
1578 if (match.hit)
1579 {
1580 *parentMatch6 = match;
1581 }
1582 else
1583 {
1584 lexer.ThrowExpectationFailure(span, GetTokenName(ID));
1585 }
1586 }
1587 if (match.hit)
1588 {
1589 ruleName = lexer.GetMatch(span);
1590 }
1591 *parentMatch5 = match;
1592 }
1593 *parentMatch4 = match;
1594 }
1595 *parentMatch3 = match;
1596 }
1597 *parentMatch2 = match;
1598 }
1599 if (match.hit)
1600 {
1601 Match match(false);
1602 Match* parentMatch7 = &match;
1603 {
1604 Match match(true);
1605 Match* parentMatch8 = &match;
1606 {
1607 System.Lex.Span span = lexer.GetSpan();
1608 Match match(false);
1609 if (*lexer == COMMA)
1610 {
1611 ++lexer;
1612 match.hit = true;
1613 }
1614 if (match.hit)
1615 {
1616 *parentMatch8 = match;
1617 }
1618 else
1619 {
1620 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
1621 }
1622 }
1623 *parentMatch7 = match;
1624 }
1625 *parentMatch2 = match;
1626 }
1627 *parentMatch1 = match;
1628 }
1629 if (match.hit)
1630 {
1631 Match match(false);
1632 Match* parentMatch9 = &match;
1633 {
1634 Match match(false);
1635 Match* parentMatch10 = &match;
1636 {
1637 long pos = lexer.GetPos();
1638 Match match(true);
1639 Match* parentMatch11 = &match;
1640 {
1641 System.Lex.Span span = lexer.GetSpan();
1642 Match match(false);
1643 if (*lexer == STRINGLIT)
1644 {
1645 ++lexer;
1646 match.hit = true;
1647 }
1648 if (match.hit)
1649 {
1650 *parentMatch11 = match;
1651 }
1652 else
1653 {
1654 lexer.ThrowExpectationFailure(span, GetTokenName(STRINGLIT));
1655 }
1656 }
1657 if (match.hit)
1658 {
1659 ruleInfo = soulcm.scm2html.ParseStringLiteral(lexer.FileName(), lexer.GetToken(pos));
1660 }
1661 *parentMatch10 = match;
1662 }
1663 *parentMatch9 = match;
1664 }
1665 *parentMatch1 = match;
1666 }
1667 *parentMatch0 = match;
1668 }
1669 if (match.hit)
1670 {
1671 Match match(false);
1672 Match* parentMatch12 = &match;
1673 {
1674 Match match(false);
1675 Match* parentMatch13 = &match;
1676 {
1677 long pos = lexer.GetPos();
1678 Match match(true);
1679 Match* parentMatch14 = &match;
1680 {
1681 System.Lex.Span span = lexer.GetSpan();
1682 Match match(false);
1683 if (*lexer == RPAREN)
1684 {
1685 ++lexer;
1686 match.hit = true;
1687 }
1688 if (match.hit)
1689 {
1690 *parentMatch14 = match;
1691 }
1692 else
1693 {
1694 lexer.ThrowExpectationFailure(span, GetTokenName(RPAREN));
1695 }
1696 }
1697 if (match.hit)
1698 {
1699 grammarParser->AddRuleInfo(ruleName, ruleInfo);
1700 }
1701 *parentMatch13 = match;
1702 }
1703 *parentMatch12 = match;
1704 }
1705 *parentMatch0 = match;
1706 }
1707 #if (DEBUG)
1708 if (writeToLog)
1709 {
1710 if (match.hit)
1711 {
1712 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleInfo");
1713 }
1714 else
1715 {
1716 System.Lex.WriteFailureToLog(lexer, u"RuleInfo");
1717 }
1718 }
1719 #endif
1720 if (!match.hit)
1721 {
1722 match.value = null;
1723 }
1724 return match;
1725 }
1726 public static Match RuleStatement(ParserFileLexer& lexer, soulcm.scm2html.GrammarParser* grammarParser, ParsingContext* parsingContext)
1727 {
1728 #if (DEBUG)
1729 Span debugSpan;
1730 bool writeToLog = lexer.Log() != null;
1731 if (writeToLog)
1732 {
1733 debugSpan = lexer.GetSpan();
1734 System.Lex.WriteBeginRuleToLog(lexer, u"RuleStatement");
1735 }
1736 #endif
1737 UniquePtr<soulcm.scm2html.RuleParser> rule;
1738 UniquePtr<Node> returnType;
1739 UniquePtr<soulcm.scm2html.Parser> definition;
1740 Match match(false);
1741 Match* parentMatch0 = &match;
1742 {
1743 Match match(false);
1744 Match* parentMatch1 = &match;
1745 {
1746 Match match(false);
1747 Match* parentMatch2 = &match;
1748 {
1749 Match match(false);
1750 Match* parentMatch3 = &match;
1751 {
1752 Match match(false);
1753 Match* parentMatch4 = &match;
1754 {
1755 Match match(false);
1756 Match* parentMatch5 = &match;
1757 {
1758 long pos = lexer.GetPos();
1759 Span span = lexer.GetSpan();
1760 Match match(false);
1761 if (*lexer == ID)
1762 {
1763 ++lexer;
1764 match.hit = true;
1765 }
1766 if (match.hit)
1767 {
1768 ustring id = lexer.GetMatch(span);
1769 rule.Reset(new soulcm.scm2html.RuleParser(id));
1770 }
1771 *parentMatch5 = match;
1772 }
1773 *parentMatch4 = match;
1774 }
1775 if (match.hit)
1776 {
1777 Match match(false);
1778 Match* parentMatch6 = &match;
1779 {
1780 Match match(true);
1781 long save = lexer.GetPos();
1782 Match* parentMatch7 = &match;
1783 {
1784 Match match = ParserFileParser.ParametersAndVariables(lexer, rule.Get(), parsingContext);
1785 if (match.hit)
1786 {
1787 *parentMatch7 = match;
1788 }
1789 else
1790 {
1791 lexer.SetPos(save);
1792 }
1793 }
1794 *parentMatch6 = match;
1795 }
1796 *parentMatch4 = match;
1797 }
1798 *parentMatch3 = match;
1799 }
1800 if (match.hit)
1801 {
1802 Match match(false);
1803 Match* parentMatch8 = &match;
1804 {
1805 Match match(true);
1806 long save = lexer.GetPos();
1807 Match* parentMatch9 = &match;
1808 {
1809 Match match = ParserFileParser.ReturnType(lexer, parsingContext);
1810 returnType.Reset(cast<Node*>(match.value));
1811 if (match.hit)
1812 {
1813 *parentMatch9 = match;
1814 }
1815 else
1816 {
1817 lexer.SetPos(save);
1818 }
1819 }
1820 *parentMatch8 = match;
1821 }
1822 *parentMatch3 = match;
1823 }
1824 *parentMatch2 = match;
1825 }
1826 if (match.hit)
1827 {
1828 Match match(false);
1829 Match* parentMatch10 = &match;
1830 {
1831 Match match(false);
1832 if (*lexer == PRODUCES)
1833 {
1834 ++lexer;
1835 match.hit = true;
1836 }
1837 *parentMatch10 = match;
1838 }
1839 *parentMatch2 = match;
1840 }
1841 *parentMatch1 = match;
1842 }
1843 if (match.hit)
1844 {
1845 Match match(false);
1846 Match* parentMatch11 = &match;
1847 {
1848 Match match(true);
1849 Match* parentMatch12 = &match;
1850 {
1851 System.Lex.Span span = lexer.GetSpan();
1852 Match match = ParserFileParser.RuleBody(lexer, parsingContext);
1853 definition.Reset(cast<soulcm.scm2html.Parser*>(match.value));
1854 if (match.hit)
1855 {
1856 *parentMatch12 = match;
1857 }
1858 else
1859 {
1860 lexer.ThrowExpectationFailure(span, u"RuleBody");
1861 }
1862 }
1863 *parentMatch11 = match;
1864 }
1865 *parentMatch1 = match;
1866 }
1867 *parentMatch0 = match;
1868 }
1869 if (match.hit)
1870 {
1871 Match match(false);
1872 Match* parentMatch13 = &match;
1873 {
1874 Match match(false);
1875 Match* parentMatch14 = &match;
1876 {
1877 long pos = lexer.GetPos();
1878 Match match(true);
1879 Match* parentMatch15 = &match;
1880 {
1881 System.Lex.Span span = lexer.GetSpan();
1882 Match match(false);
1883 if (*lexer == SEMICOLON)
1884 {
1885 ++lexer;
1886 match.hit = true;
1887 }
1888 if (match.hit)
1889 {
1890 *parentMatch15 = match;
1891 }
1892 else
1893 {
1894 lexer.ThrowExpectationFailure(span, GetTokenName(SEMICOLON));
1895 }
1896 }
1897 if (match.hit)
1898 {
1899 rule->SetDefinition(definition.Release());
1900 rule->SetReturnType(returnType.Release());
1901 grammarParser->AddRule(rule.Release());
1902 }
1903 *parentMatch14 = match;
1904 }
1905 *parentMatch13 = match;
1906 }
1907 *parentMatch0 = match;
1908 }
1909 #if (DEBUG)
1910 if (writeToLog)
1911 {
1912 if (match.hit)
1913 {
1914 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleStatement");
1915 }
1916 else
1917 {
1918 System.Lex.WriteFailureToLog(lexer, u"RuleStatement");
1919 }
1920 }
1921 #endif
1922 if (!match.hit)
1923 {
1924 match.value = null;
1925 }
1926 return match;
1927 }
1928 public static Match ParametersAndVariables(ParserFileLexer& lexer, soulcm.scm2html.RuleParser* rule, ParsingContext* parsingContext)
1929 {
1930 #if (DEBUG)
1931 Span debugSpan;
1932 bool writeToLog = lexer.Log() != null;
1933 if (writeToLog)
1934 {
1935 debugSpan = lexer.GetSpan();
1936 System.Lex.WriteBeginRuleToLog(lexer, u"ParametersAndVariables");
1937 }
1938 #endif
1939 UniquePtr<soulcm.scm2html.Parameter> paramOrVariable;
1940 Match match(false);
1941 Match* parentMatch0 = &match;
1942 {
1943 Match match(false);
1944 Match* parentMatch1 = &match;
1945 {
1946 Match match(false);
1947 if (*lexer == LPAREN)
1948 {
1949 ++lexer;
1950 match.hit = true;
1951 }
1952 *parentMatch1 = match;
1953 }
1954 if (match.hit)
1955 {
1956 Match match(false);
1957 Match* parentMatch2 = &match;
1958 {
1959 Match match(true);
1960 long save = lexer.GetPos();
1961 Match* parentMatch3 = &match;
1962 {
1963 Match match(false);
1964 Match* parentMatch4 = &match;
1965 {
1966 Match match(false);
1967 Match* parentMatch5 = &match;
1968 {
1969 Match match(false);
1970 Match* parentMatch6 = &match;
1971 {
1972 long pos = lexer.GetPos();
1973 Match match = ParserFileParser.ParamOrVariable(lexer, parsingContext);
1974 paramOrVariable.Reset(cast<soulcm.scm2html.Parameter*>(match.value));
1975 if (match.hit)
1976 {
1977 rule->AddParamOrVariable(paramOrVariable.Release());
1978 }
1979 *parentMatch6 = match;
1980 }
1981 *parentMatch5 = 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 while (true)
1992 {
1993 long save = lexer.GetPos();
1994 {
1995 Match match(false);
1996 Match* parentMatch9 = &match;
1997 {
1998 Match match(false);
1999 if (*lexer == COMMA)
2000 {
2001 ++lexer;
2002 match.hit = true;
2003 }
2004 *parentMatch9 = match;
2005 }
2006 if (match.hit)
2007 {
2008 Match match(false);
2009 Match* parentMatch10 = &match;
2010 {
2011 Match match(false);
2012 Match* parentMatch11 = &match;
2013 {
2014 long pos = lexer.GetPos();
2015 Match match = ParserFileParser.ParamOrVariable(lexer, parsingContext);
2016 paramOrVariable.Reset(cast<soulcm.scm2html.Parameter*>(match.value));
2017 if (match.hit)
2018 {
2019 rule->AddParamOrVariable(paramOrVariable.Release());
2020 }
2021 *parentMatch11 = match;
2022 }
2023 *parentMatch10 = match;
2024 }
2025 *parentMatch9 = match;
2026 }
2027 if (match.hit)
2028 {
2029 *parentMatch8 = match;
2030 }
2031 else
2032 {
2033 lexer.SetPos(save);
2034 break;
2035 }
2036 }
2037 }
2038 }
2039 *parentMatch7 = match;
2040 }
2041 *parentMatch5 = match;
2042 }
2043 *parentMatch4 = match;
2044 }
2045 if (match.hit)
2046 {
2047 *parentMatch3 = match;
2048 }
2049 else
2050 {
2051 lexer.SetPos(save);
2052 }
2053 }
2054 *parentMatch2 = match;
2055 }
2056 *parentMatch1 = match;
2057 }
2058 *parentMatch0 = match;
2059 }
2060 if (match.hit)
2061 {
2062 Match match(false);
2063 Match* parentMatch12 = &match;
2064 {
2065 Match match(true);
2066 Match* parentMatch13 = &match;
2067 {
2068 System.Lex.Span span = lexer.GetSpan();
2069 Match match(false);
2070 if (*lexer == RPAREN)
2071 {
2072 ++lexer;
2073 match.hit = true;
2074 }
2075 if (match.hit)
2076 {
2077 *parentMatch13 = match;
2078 }
2079 else
2080 {
2081 lexer.ThrowExpectationFailure(span, GetTokenName(RPAREN));
2082 }
2083 }
2084 *parentMatch12 = match;
2085 }
2086 *parentMatch0 = match;
2087 }
2088 #if (DEBUG)
2089 if (writeToLog)
2090 {
2091 if (match.hit)
2092 {
2093 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParametersAndVariables");
2094 }
2095 else
2096 {
2097 System.Lex.WriteFailureToLog(lexer, u"ParametersAndVariables");
2098 }
2099 }
2100 #endif
2101 if (!match.hit)
2102 {
2103 match.value = null;
2104 }
2105 return match;
2106 }
2107 public static Match ParamOrVariable(ParserFileLexer& lexer, ParsingContext* parsingContext)
2108 {
2109 #if (DEBUG)
2110 Span debugSpan;
2111 bool writeToLog = lexer.Log() != null;
2112 if (writeToLog)
2113 {
2114 debugSpan = lexer.GetSpan();
2115 System.Lex.WriteBeginRuleToLog(lexer, u"ParamOrVariable");
2116 }
2117 #endif
2118 UniquePtr<Node> varType;
2119 UniquePtr<IdentifierNode> varName;
2120 UniquePtr<Node> paramType;
2121 UniquePtr<IdentifierNode> paramName;
2122 Match match(false);
2123 Match* parentMatch0 = &match;
2124 {
2125 long save = lexer.GetPos();
2126 Match match(false);
2127 Match* parentMatch1 = &match;
2128 {
2129 Match match(false);
2130 Match* parentMatch2 = &match;
2131 {
2132 Match match(false);
2133 if (*lexer == VAR)
2134 {
2135 ++lexer;
2136 match.hit = true;
2137 }
2138 *parentMatch2 = match;
2139 }
2140 if (match.hit)
2141 {
2142 Match match(false);
2143 Match* parentMatch3 = &match;
2144 {
2145 Match match = ParTypeExprParser.TypeExpr(lexer, parsingContext);
2146 varType.Reset(cast<Node*>(match.value));
2147 *parentMatch3 = match;
2148 }
2149 *parentMatch2 = match;
2150 }
2151 *parentMatch1 = match;
2152 }
2153 if (match.hit)
2154 {
2155 Match match(false);
2156 Match* parentMatch4 = &match;
2157 {
2158 Match match(false);
2159 Match* parentMatch5 = &match;
2160 {
2161 long pos = lexer.GetPos();
2162 Match match = ParIdentifierParser.Identifier(lexer, parsingContext);
2163 varName.Reset(cast<IdentifierNode*>(match.value));
2164 if (match.hit)
2165 {
2166 {
2167 #if (DEBUG)
2168 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParamOrVariable");
2169 #endif
2170 return Match(true, new soulcm.scm2html.Variable(varType.Release(), varName.Release()));
2171 }
2172 }
2173 *parentMatch5 = match;
2174 }
2175 *parentMatch4 = match;
2176 }
2177 *parentMatch1 = match;
2178 }
2179 *parentMatch0 = match;
2180 if (!match.hit)
2181 {
2182 Match match(false);
2183 Match* parentMatch6 = &match;
2184 lexer.SetPos(save);
2185 {
2186 Match match(false);
2187 Match* parentMatch7 = &match;
2188 {
2189 Match match = ParTypeExprParser.TypeExpr(lexer, parsingContext);
2190 paramType.Reset(cast<Node*>(match.value));
2191 *parentMatch7 = match;
2192 }
2193 if (match.hit)
2194 {
2195 Match match(false);
2196 Match* parentMatch8 = &match;
2197 {
2198 Match match(false);
2199 Match* parentMatch9 = &match;
2200 {
2201 long pos = lexer.GetPos();
2202 Match match = ParIdentifierParser.Identifier(lexer, parsingContext);
2203 paramName.Reset(cast<IdentifierNode*>(match.value));
2204 if (match.hit)
2205 {
2206 {
2207 #if (DEBUG)
2208 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParamOrVariable");
2209 #endif
2210 return Match(true, new soulcm.scm2html.Parameter(paramType.Release(), paramName.Release()));
2211 }
2212 }
2213 *parentMatch9 = match;
2214 }
2215 *parentMatch8 = match;
2216 }
2217 *parentMatch7 = match;
2218 }
2219 *parentMatch6 = match;
2220 }
2221 *parentMatch0 = match;
2222 }
2223 }
2224 #if (DEBUG)
2225 if (writeToLog)
2226 {
2227 if (match.hit)
2228 {
2229 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParamOrVariable");
2230 }
2231 else
2232 {
2233 System.Lex.WriteFailureToLog(lexer, u"ParamOrVariable");
2234 }
2235 }
2236 #endif
2237 if (!match.hit)
2238 {
2239 match.value = null;
2240 }
2241 return match;
2242 }
2243 public static Match ReturnType(ParserFileLexer& lexer, ParsingContext* parsingContext)
2244 {
2245 #if (DEBUG)
2246 Span debugSpan;
2247 bool writeToLog = lexer.Log() != null;
2248 if (writeToLog)
2249 {
2250 debugSpan = lexer.GetSpan();
2251 System.Lex.WriteBeginRuleToLog(lexer, u"ReturnType");
2252 }
2253 #endif
2254 UniquePtr<Node> type;
2255 Match match(false);
2256 Match* parentMatch0 = &match;
2257 {
2258 Match match(false);
2259 if (*lexer == COLON)
2260 {
2261 ++lexer;
2262 match.hit = true;
2263 }
2264 *parentMatch0 = match;
2265 }
2266 if (match.hit)
2267 {
2268 Match match(false);
2269 Match* parentMatch1 = &match;
2270 {
2271 Match match(false);
2272 Match* parentMatch2 = &match;
2273 {
2274 long pos = lexer.GetPos();
2275 Match match = ParTypeExprParser.TypeExpr(lexer, parsingContext);
2276 type.Reset(cast<Node*>(match.value));
2277 if (match.hit)
2278 {
2279 {
2280 #if (DEBUG)
2281 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ReturnType");
2282 #endif
2283 return Match(true, type.Release());
2284 }
2285 }
2286 *parentMatch2 = match;
2287 }
2288 *parentMatch1 = match;
2289 }
2290 *parentMatch0 = match;
2291 }
2292 #if (DEBUG)
2293 if (writeToLog)
2294 {
2295 if (match.hit)
2296 {
2297 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ReturnType");
2298 }
2299 else
2300 {
2301 System.Lex.WriteFailureToLog(lexer, u"ReturnType");
2302 }
2303 }
2304 #endif
2305 if (!match.hit)
2306 {
2307 match.value = null;
2308 }
2309 return match;
2310 }
2311 public static Match RuleBody(ParserFileLexer& lexer, ParsingContext* parsingContext)
2312 {
2313 #if (DEBUG)
2314 Span debugSpan;
2315 bool writeToLog = lexer.Log() != null;
2316 if (writeToLog)
2317 {
2318 debugSpan = lexer.GetSpan();
2319 System.Lex.WriteBeginRuleToLog(lexer, u"RuleBody");
2320 }
2321 #endif
2322 UniquePtr<soulcm.scm2html.Parser> alt;
2323 Match match(false);
2324 Match* parentMatch0 = &match;
2325 {
2326 long pos = lexer.GetPos();
2327 Match match = ParserFileParser.Alternative(lexer, parsingContext);
2328 alt.Reset(cast<soulcm.scm2html.Parser*>(match.value));
2329 if (match.hit)
2330 {
2331 {
2332 #if (DEBUG)
2333 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleBody");
2334 #endif
2335 return Match(true, alt.Release());
2336 }
2337 }
2338 *parentMatch0 = match;
2339 }
2340 #if (DEBUG)
2341 if (writeToLog)
2342 {
2343 if (match.hit)
2344 {
2345 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleBody");
2346 }
2347 else
2348 {
2349 System.Lex.WriteFailureToLog(lexer, u"RuleBody");
2350 }
2351 }
2352 #endif
2353 if (!match.hit)
2354 {
2355 match.value = null;
2356 }
2357 return match;
2358 }
2359 public static Match Alternative(ParserFileLexer& lexer, ParsingContext* parsingContext)
2360 {
2361 #if (DEBUG)
2362 Span debugSpan;
2363 bool writeToLog = lexer.Log() != null;
2364 if (writeToLog)
2365 {
2366 debugSpan = lexer.GetSpan();
2367 System.Lex.WriteBeginRuleToLog(lexer, u"Alternative");
2368 }
2369 #endif
2370 UniquePtr<soulcm.scm2html.Parser> value;
2371 UniquePtr<soulcm.scm2html.Parser> left;
2372 UniquePtr<soulcm.scm2html.Parser> right;
2373 Match match(false);
2374 Match* parentMatch0 = &match;
2375 {
2376 long pos = lexer.GetPos();
2377 Match match(false);
2378 Match* parentMatch1 = &match;
2379 {
2380 Match match(false);
2381 Match* parentMatch2 = &match;
2382 {
2383 Match match(false);
2384 Match* parentMatch3 = &match;
2385 {
2386 long pos = lexer.GetPos();
2387 Match match = ParserFileParser.Sequence(lexer, parsingContext);
2388 left.Reset(cast<soulcm.scm2html.Parser*>(match.value));
2389 if (match.hit)
2390 {
2391 value.Reset(left.Release());
2392 }
2393 *parentMatch3 = match;
2394 }
2395 *parentMatch2 = match;
2396 }
2397 if (match.hit)
2398 {
2399 Match match(false);
2400 Match* parentMatch4 = &match;
2401 {
2402 Match match(true);
2403 Match* parentMatch5 = &match;
2404 {
2405 while (true)
2406 {
2407 long save = lexer.GetPos();
2408 {
2409 Match match(false);
2410 Match* parentMatch6 = &match;
2411 {
2412 Match match(false);
2413 Match* parentMatch7 = &match;
2414 {
2415 Match match(false);
2416 if (*lexer == BITOR)
2417 {
2418 ++lexer;
2419 match.hit = true;
2420 }
2421 *parentMatch7 = match;
2422 }
2423 if (match.hit)
2424 {
2425 Match match(false);
2426 Match* parentMatch8 = &match;
2427 {
2428 Match match(false);
2429 Match* parentMatch9 = &match;
2430 {
2431 long pos = lexer.GetPos();
2432 Match match(true);
2433 Match* parentMatch10 = &match;
2434 {
2435 System.Lex.Span span = lexer.GetSpan();
2436 Match match = ParserFileParser.Sequence(lexer, parsingContext);
2437 right.Reset(cast<soulcm.scm2html.Parser*>(match.value));
2438 if (match.hit)
2439 {
2440 *parentMatch10 = match;
2441 }
2442 else
2443 {
2444 lexer.ThrowExpectationFailure(span, u"Sequence");
2445 }
2446 }
2447 if (match.hit)
2448 {
2449 value.Reset(new soulcm.scm2html.AlternativeParser(value.Release(), right.Release()));
2450 }
2451 *parentMatch9 = match;
2452 }
2453 *parentMatch8 = match;
2454 }
2455 *parentMatch7 = match;
2456 }
2457 *parentMatch6 = match;
2458 }
2459 if (match.hit)
2460 {
2461 *parentMatch5 = match;
2462 }
2463 else
2464 {
2465 lexer.SetPos(save);
2466 break;
2467 }
2468 }
2469 }
2470 }
2471 *parentMatch4 = match;
2472 }
2473 *parentMatch2 = match;
2474 }
2475 *parentMatch1 = match;
2476 }
2477 if (match.hit)
2478 {
2479 {
2480 #if (DEBUG)
2481 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Alternative");
2482 #endif
2483 return Match(true, value.Release());
2484 }
2485 }
2486 *parentMatch0 = match;
2487 }
2488 #if (DEBUG)
2489 if (writeToLog)
2490 {
2491 if (match.hit)
2492 {
2493 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Alternative");
2494 }
2495 else
2496 {
2497 System.Lex.WriteFailureToLog(lexer, u"Alternative");
2498 }
2499 }
2500 #endif
2501 if (!match.hit)
2502 {
2503 match.value = null;
2504 }
2505 return match;
2506 }
2507 public static Match Sequence(ParserFileLexer& lexer, ParsingContext* parsingContext)
2508 {
2509 #if (DEBUG)
2510 Span debugSpan;
2511 bool writeToLog = lexer.Log() != null;
2512 if (writeToLog)
2513 {
2514 debugSpan = lexer.GetSpan();
2515 System.Lex.WriteBeginRuleToLog(lexer, u"Sequence");
2516 }
2517 #endif
2518 UniquePtr<soulcm.scm2html.Parser> value;
2519 UniquePtr<soulcm.scm2html.Parser> left;
2520 UniquePtr<soulcm.scm2html.Parser> right;
2521 Match match(false);
2522 Match* parentMatch0 = &match;
2523 {
2524 long pos = lexer.GetPos();
2525 Match match(false);
2526 Match* parentMatch1 = &match;
2527 {
2528 Match match(false);
2529 Match* parentMatch2 = &match;
2530 {
2531 Match match(false);
2532 Match* parentMatch3 = &match;
2533 {
2534 long pos = lexer.GetPos();
2535 Match match = ParserFileParser.Difference(lexer, parsingContext);
2536 left.Reset(cast<soulcm.scm2html.Parser*>(match.value));
2537 if (match.hit)
2538 {
2539 value.Reset(left.Release());
2540 }
2541 *parentMatch3 = match;
2542 }
2543 *parentMatch2 = match;
2544 }
2545 if (match.hit)
2546 {
2547 Match match(false);
2548 Match* parentMatch4 = &match;
2549 {
2550 Match match(true);
2551 Match* parentMatch5 = &match;
2552 {
2553 while (true)
2554 {
2555 long save = lexer.GetPos();
2556 {
2557 Match match(false);
2558 Match* parentMatch6 = &match;
2559 {
2560 Match match(false);
2561 Match* parentMatch7 = &match;
2562 {
2563 long pos = lexer.GetPos();
2564 Match match = ParserFileParser.Difference(lexer, parsingContext);
2565 right.Reset(cast<soulcm.scm2html.Parser*>(match.value));
2566 if (match.hit)
2567 {
2568 value.Reset(new soulcm.scm2html.SequenceParser(value.Release(), right.Release()));
2569 }
2570 *parentMatch7 = match;
2571 }
2572 *parentMatch6 = match;
2573 }
2574 if (match.hit)
2575 {
2576 *parentMatch5 = match;
2577 }
2578 else
2579 {
2580 lexer.SetPos(save);
2581 break;
2582 }
2583 }
2584 }
2585 }
2586 *parentMatch4 = match;
2587 }
2588 *parentMatch2 = match;
2589 }
2590 *parentMatch1 = match;
2591 }
2592 if (match.hit)
2593 {
2594 {
2595 #if (DEBUG)
2596 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Sequence");
2597 #endif
2598 return Match(true, value.Release());
2599 }
2600 }
2601 *parentMatch0 = match;
2602 }
2603 #if (DEBUG)
2604 if (writeToLog)
2605 {
2606 if (match.hit)
2607 {
2608 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Sequence");
2609 }
2610 else
2611 {
2612 System.Lex.WriteFailureToLog(lexer, u"Sequence");
2613 }
2614 }
2615 #endif
2616 if (!match.hit)
2617 {
2618 match.value = null;
2619 }
2620 return match;
2621 }
2622 public static Match Difference(ParserFileLexer& lexer, ParsingContext* parsingContext)
2623 {
2624 #if (DEBUG)
2625 Span debugSpan;
2626 bool writeToLog = lexer.Log() != null;
2627 if (writeToLog)
2628 {
2629 debugSpan = lexer.GetSpan();
2630 System.Lex.WriteBeginRuleToLog(lexer, u"Difference");
2631 }
2632 #endif
2633 UniquePtr<soulcm.scm2html.Parser> value;
2634 UniquePtr<soulcm.scm2html.Parser> left;
2635 UniquePtr<soulcm.scm2html.Parser> right;
2636 Match match(false);
2637 Match* parentMatch0 = &match;
2638 {
2639 long pos = lexer.GetPos();
2640 Match match(false);
2641 Match* parentMatch1 = &match;
2642 {
2643 Match match(false);
2644 Match* parentMatch2 = &match;
2645 {
2646 Match match(false);
2647 Match* parentMatch3 = &match;
2648 {
2649 long pos = lexer.GetPos();
2650 Match match = ParserFileParser.List(lexer, parsingContext);
2651 left.Reset(cast<soulcm.scm2html.Parser*>(match.value));
2652 if (match.hit)
2653 {
2654 value.Reset(left.Release());
2655 }
2656 *parentMatch3 = match;
2657 }
2658 *parentMatch2 = match;
2659 }
2660 if (match.hit)
2661 {
2662 Match match(false);
2663 Match* parentMatch4 = &match;
2664 {
2665 Match match(true);
2666 Match* parentMatch5 = &match;
2667 {
2668 while (true)
2669 {
2670 long save = lexer.GetPos();
2671 {
2672 Match match(false);
2673 Match* parentMatch6 = &match;
2674 {
2675 Match match(false);
2676 Match* parentMatch7 = &match;
2677 {
2678 Match match(false);
2679 if (*lexer == MINUS)
2680 {
2681 ++lexer;
2682 match.hit = true;
2683 }
2684 *parentMatch7 = match;
2685 }
2686 if (match.hit)
2687 {
2688 Match match(false);
2689 Match* parentMatch8 = &match;
2690 {
2691 Match match(false);
2692 Match* parentMatch9 = &match;
2693 {
2694 long pos = lexer.GetPos();
2695 Match match(true);
2696 Match* parentMatch10 = &match;
2697 {
2698 System.Lex.Span span = lexer.GetSpan();
2699 Match match = ParserFileParser.List(lexer, parsingContext);
2700 right.Reset(cast<soulcm.scm2html.Parser*>(match.value));
2701 if (match.hit)
2702 {
2703 *parentMatch10 = match;
2704 }
2705 else
2706 {
2707 lexer.ThrowExpectationFailure(span, u"List");
2708 }
2709 }
2710 if (match.hit)
2711 {
2712 value.Reset(new soulcm.scm2html.DifferenceParser(value.Release(), right.Release()));
2713 }
2714 *parentMatch9 = match;
2715 }
2716 *parentMatch8 = match;
2717 }
2718 *parentMatch7 = match;
2719 }
2720 *parentMatch6 = match;
2721 }
2722 if (match.hit)
2723 {
2724 *parentMatch5 = match;
2725 }
2726 else
2727 {
2728 lexer.SetPos(save);
2729 break;
2730 }
2731 }
2732 }
2733 }
2734 *parentMatch4 = match;
2735 }
2736 *parentMatch2 = match;
2737 }
2738 *parentMatch1 = match;
2739 }
2740 if (match.hit)
2741 {
2742 {
2743 #if (DEBUG)
2744 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Difference");
2745 #endif
2746 return Match(true, value.Release());
2747 }
2748 }
2749 *parentMatch0 = match;
2750 }
2751 #if (DEBUG)
2752 if (writeToLog)
2753 {
2754 if (match.hit)
2755 {
2756 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Difference");
2757 }
2758 else
2759 {
2760 System.Lex.WriteFailureToLog(lexer, u"Difference");
2761 }
2762 }
2763 #endif
2764 if (!match.hit)
2765 {
2766 match.value = null;
2767 }
2768 return match;
2769 }
2770 public static Match List(ParserFileLexer& lexer, ParsingContext* parsingContext)
2771 {
2772 #if (DEBUG)
2773 Span debugSpan;
2774 bool writeToLog = lexer.Log() != null;
2775 if (writeToLog)
2776 {
2777 debugSpan = lexer.GetSpan();
2778 System.Lex.WriteBeginRuleToLog(lexer, u"List");
2779 }
2780 #endif
2781 UniquePtr<soulcm.scm2html.Parser> value;
2782 UniquePtr<soulcm.scm2html.Parser> left;
2783 UniquePtr<soulcm.scm2html.Parser> right;
2784 Match match(false);
2785 Match* parentMatch0 = &match;
2786 {
2787 long pos = lexer.GetPos();
2788 Match match(false);
2789 Match* parentMatch1 = &match;
2790 {
2791 Match match(false);
2792 Match* parentMatch2 = &match;
2793 {
2794 Match match(false);
2795 Match* parentMatch3 = &match;
2796 {
2797 long pos = lexer.GetPos();
2798 Match match = ParserFileParser.Postfix(lexer, parsingContext);
2799 left.Reset(cast<soulcm.scm2html.Parser*>(match.value));
2800 if (match.hit)
2801 {
2802 value.Reset(left.Release());
2803 }
2804 *parentMatch3 = match;
2805 }
2806 *parentMatch2 = match;
2807 }
2808 if (match.hit)
2809 {
2810 Match match(false);
2811 Match* parentMatch4 = &match;
2812 {
2813 Match match(true);
2814 long save = lexer.GetPos();
2815 Match* parentMatch5 = &match;
2816 {
2817 Match match(false);
2818 Match* parentMatch6 = &match;
2819 {
2820 Match match(false);
2821 Match* parentMatch7 = &match;
2822 {
2823 Match match(false);
2824 if (*lexer == REM)
2825 {
2826 ++lexer;
2827 match.hit = true;
2828 }
2829 *parentMatch7 = match;
2830 }
2831 if (match.hit)
2832 {
2833 Match match(false);
2834 Match* parentMatch8 = &match;
2835 {
2836 Match match(false);
2837 Match* parentMatch9 = &match;
2838 {
2839 long pos = lexer.GetPos();
2840 Match match(true);
2841 Match* parentMatch10 = &match;
2842 {
2843 System.Lex.Span span = lexer.GetSpan();
2844 Match match = ParserFileParser.Postfix(lexer, parsingContext);
2845 right.Reset(cast<soulcm.scm2html.Parser*>(match.value));
2846 if (match.hit)
2847 {
2848 *parentMatch10 = match;
2849 }
2850 else
2851 {
2852 lexer.ThrowExpectationFailure(span, u"Postfix");
2853 }
2854 }
2855 if (match.hit)
2856 {
2857 value.Reset(new soulcm.scm2html.ListParser(value.Release(), right.Release()));
2858 }
2859 *parentMatch9 = match;
2860 }
2861 *parentMatch8 = match;
2862 }
2863 *parentMatch7 = match;
2864 }
2865 *parentMatch6 = match;
2866 }
2867 if (match.hit)
2868 {
2869 *parentMatch5 = match;
2870 }
2871 else
2872 {
2873 lexer.SetPos(save);
2874 }
2875 }
2876 *parentMatch4 = match;
2877 }
2878 *parentMatch2 = match;
2879 }
2880 *parentMatch1 = match;
2881 }
2882 if (match.hit)
2883 {
2884 {
2885 #if (DEBUG)
2886 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"List");
2887 #endif
2888 return Match(true, value.Release());
2889 }
2890 }
2891 *parentMatch0 = match;
2892 }
2893 #if (DEBUG)
2894 if (writeToLog)
2895 {
2896 if (match.hit)
2897 {
2898 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"List");
2899 }
2900 else
2901 {
2902 System.Lex.WriteFailureToLog(lexer, u"List");
2903 }
2904 }
2905 #endif
2906 if (!match.hit)
2907 {
2908 match.value = null;
2909 }
2910 return match;
2911 }
2912 public static Match Postfix(ParserFileLexer& lexer, ParsingContext* parsingContext)
2913 {
2914 #if (DEBUG)
2915 Span debugSpan;
2916 bool writeToLog = lexer.Log() != null;
2917 if (writeToLog)
2918 {
2919 debugSpan = lexer.GetSpan();
2920 System.Lex.WriteBeginRuleToLog(lexer, u"Postfix");
2921 }
2922 #endif
2923 UniquePtr<soulcm.scm2html.Parser> value;
2924 UniquePtr<soulcm.scm2html.Parser> primary;
2925 Match match(false);
2926 Match* parentMatch0 = &match;
2927 {
2928 long pos = lexer.GetPos();
2929 Match match(false);
2930 Match* parentMatch1 = &match;
2931 {
2932 Match match(false);
2933 Match* parentMatch2 = &match;
2934 {
2935 Match match(false);
2936 Match* parentMatch3 = &match;
2937 {
2938 long pos = lexer.GetPos();
2939 Match match = ParserFileParser.Primary(lexer, parsingContext);
2940 primary.Reset(cast<soulcm.scm2html.Parser*>(match.value));
2941 if (match.hit)
2942 {
2943 value.Reset(primary.Release());
2944 }
2945 *parentMatch3 = match;
2946 }
2947 *parentMatch2 = match;
2948 }
2949 if (match.hit)
2950 {
2951 Match match(false);
2952 Match* parentMatch4 = &match;
2953 {
2954 Match match(true);
2955 long save = lexer.GetPos();
2956 Match* parentMatch5 = &match;
2957 {
2958 Match match(false);
2959 Match* parentMatch6 = &match;
2960 {
2961 Match match(false);
2962 Match* parentMatch7 = &match;
2963 {
2964 long save = lexer.GetPos();
2965 Match match(false);
2966 Match* parentMatch8 = &match;
2967 {
2968 long save = lexer.GetPos();
2969 Match match(false);
2970 Match* parentMatch9 = &match;
2971 {
2972 long pos = lexer.GetPos();
2973 Match match(false);
2974 if (*lexer == STAR)
2975 {
2976 ++lexer;
2977 match.hit = true;
2978 }
2979 if (match.hit)
2980 {
2981 value.Reset(new soulcm.scm2html.KleeneParser(value.Release()));
2982 }
2983 *parentMatch9 = match;
2984 }
2985 *parentMatch8 = match;
2986 if (!match.hit)
2987 {
2988 Match match(false);
2989 Match* parentMatch10 = &match;
2990 lexer.SetPos(save);
2991 {
2992 Match match(false);
2993 Match* parentMatch11 = &match;
2994 {
2995 long pos = lexer.GetPos();
2996 Match match(false);
2997 if (*lexer == PLUS)
2998 {
2999 ++lexer;
3000 match.hit = true;
3001 }
3002 if (match.hit)
3003 {
3004 value.Reset(new soulcm.scm2html.PositiveParser(value.Release()));
3005 }
3006 *parentMatch11 = match;
3007 }
3008 *parentMatch10 = match;
3009 }
3010 *parentMatch8 = match;
3011 }
3012 }
3013 *parentMatch7 = match;
3014 if (!match.hit)
3015 {
3016 Match match(false);
3017 Match* parentMatch12 = &match;
3018 lexer.SetPos(save);
3019 {
3020 Match match(false);
3021 Match* parentMatch13 = &match;
3022 {
3023 long pos = lexer.GetPos();
3024 Match match(false);
3025 if (*lexer == QUEST)
3026 {
3027 ++lexer;
3028 match.hit = true;
3029 }
3030 if (match.hit)
3031 {
3032 value.Reset(new soulcm.scm2html.OptionalParser(value.Release()));
3033 }
3034 *parentMatch13 = match;
3035 }
3036 *parentMatch12 = match;
3037 }
3038 *parentMatch7 = match;
3039 }
3040 }
3041 *parentMatch6 = match;
3042 }
3043 if (match.hit)
3044 {
3045 *parentMatch5 = match;
3046 }
3047 else
3048 {
3049 lexer.SetPos(save);
3050 }
3051 }
3052 *parentMatch4 = match;
3053 }
3054 *parentMatch2 = match;
3055 }
3056 *parentMatch1 = match;
3057 }
3058 if (match.hit)
3059 {
3060 {
3061 #if (DEBUG)
3062 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Postfix");
3063 #endif
3064 return Match(true, value.Release());
3065 }
3066 }
3067 *parentMatch0 = match;
3068 }
3069 #if (DEBUG)
3070 if (writeToLog)
3071 {
3072 if (match.hit)
3073 {
3074 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Postfix");
3075 }
3076 else
3077 {
3078 System.Lex.WriteFailureToLog(lexer, u"Postfix");
3079 }
3080 }
3081 #endif
3082 if (!match.hit)
3083 {
3084 match.value = null;
3085 }
3086 return match;
3087 }
3088 public static Match Primary(ParserFileLexer& lexer, ParsingContext* parsingContext)
3089 {
3090 #if (DEBUG)
3091 Span debugSpan;
3092 bool writeToLog = lexer.Log() != null;
3093 if (writeToLog)
3094 {
3095 debugSpan = lexer.GetSpan();
3096 System.Lex.WriteBeginRuleToLog(lexer, u"Primary");
3097 }
3098 #endif
3099 UniquePtr<soulcm.scm2html.Parser> value;
3100 UniquePtr<soulcm.scm2html.Parser> ruleCall;
3101 UniquePtr<soulcm.scm2html.Parser> primitive;
3102 UniquePtr<soulcm.scm2html.Parser> grouping;
3103 UniquePtr<CompoundStatementNode> successCode;
3104 UniquePtr<CompoundStatementNode> failureCode;
3105 Match match(false);
3106 Match* parentMatch0 = &match;
3107 {
3108 long pos = lexer.GetPos();
3109 Match match(false);
3110 Match* parentMatch1 = &match;
3111 {
3112 Match match(false);
3113 Match* parentMatch2 = &match;
3114 {
3115 Match match(false);
3116 Match* parentMatch3 = &match;
3117 {
3118 Match match(false);
3119 Match* parentMatch4 = &match;
3120 {
3121 Match match(false);
3122 Match* parentMatch5 = &match;
3123 {
3124 long save = lexer.GetPos();
3125 Match match(false);
3126 Match* parentMatch6 = &match;
3127 {
3128 long save = lexer.GetPos();
3129 Match match(false);
3130 Match* parentMatch7 = &match;
3131 {
3132 long pos = lexer.GetPos();
3133 Match match = ParserFileParser.RuleCall(lexer, parsingContext);
3134 ruleCall.Reset(cast<soulcm.scm2html.Parser*>(match.value));
3135 if (match.hit)
3136 {
3137 value.Reset(ruleCall.Release());
3138 }
3139 *parentMatch7 = match;
3140 }
3141 *parentMatch6 = match;
3142 if (!match.hit)
3143 {
3144 Match match(false);
3145 Match* parentMatch8 = &match;
3146 lexer.SetPos(save);
3147 {
3148 Match match(false);
3149 Match* parentMatch9 = &match;
3150 {
3151 long pos = lexer.GetPos();
3152 Match match = ParserFileParser.Primitive(lexer);
3153 primitive.Reset(cast<soulcm.scm2html.Parser*>(match.value));
3154 if (match.hit)
3155 {
3156 value.Reset(primitive.Release());
3157 }
3158 *parentMatch9 = match;
3159 }
3160 *parentMatch8 = match;
3161 }
3162 *parentMatch6 = match;
3163 }
3164 }
3165 *parentMatch5 = match;
3166 if (!match.hit)
3167 {
3168 Match match(false);
3169 Match* parentMatch10 = &match;
3170 lexer.SetPos(save);
3171 {
3172 Match match(false);
3173 Match* parentMatch11 = &match;
3174 {
3175 long pos = lexer.GetPos();
3176 Match match = ParserFileParser.Grouping(lexer, parsingContext);
3177 grouping.Reset(cast<soulcm.scm2html.Parser*>(match.value));
3178 if (match.hit)
3179 {
3180 value.Reset(grouping.Release());
3181 }
3182 *parentMatch11 = match;
3183 }
3184 *parentMatch10 = match;
3185 }
3186 *parentMatch5 = match;
3187 }
3188 }
3189 *parentMatch4 = match;
3190 }
3191 *parentMatch3 = match;
3192 }
3193 if (match.hit)
3194 {
3195 Match match(false);
3196 Match* parentMatch12 = &match;
3197 {
3198 Match match(true);
3199 long save = lexer.GetPos();
3200 Match* parentMatch13 = &match;
3201 {
3202 Match match(false);
3203 Match* parentMatch14 = &match;
3204 {
3205 Match match(false);
3206 Match* parentMatch15 = &match;
3207 {
3208 long pos = lexer.GetPos();
3209 Match match(false);
3210 if (*lexer == EXCLAMATION)
3211 {
3212 ++lexer;
3213 match.hit = true;
3214 }
3215 if (match.hit)
3216 {
3217 value.Reset(new soulcm.scm2html.ExpectationParser(value.Release()));
3218 }
3219 *parentMatch15 = match;
3220 }
3221 *parentMatch14 = match;
3222 }
3223 if (match.hit)
3224 {
3225 *parentMatch13 = match;
3226 }
3227 else
3228 {
3229 lexer.SetPos(save);
3230 }
3231 }
3232 *parentMatch12 = match;
3233 }
3234 *parentMatch3 = match;
3235 }
3236 *parentMatch2 = match;
3237 }
3238 if (match.hit)
3239 {
3240 Match match(false);
3241 Match* parentMatch16 = &match;
3242 {
3243 Match match(true);
3244 long save = lexer.GetPos();
3245 Match* parentMatch17 = &match;
3246 {
3247 Match match(false);
3248 Match* parentMatch18 = &match;
3249 {
3250 Match match(false);
3251 Match* parentMatch19 = &match;
3252 {
3253 Match match(false);
3254 Match* parentMatch20 = &match;
3255 {
3256 long pos = lexer.GetPos();
3257 Match match(false);
3258 Match* parentMatch21 = &match;
3259 {
3260 Match match(false);
3261 Match* parentMatch22 = &match;
3262 {
3263 Match match = ParStatementParser.CompoundStatement(lexer, parsingContext);
3264 successCode.Reset(cast<CompoundStatementNode*>(match.value));
3265 *parentMatch22 = match;
3266 }
3267 if (match.hit)
3268 {
3269 Match match(false);
3270 Match* parentMatch23 = &match;
3271 {
3272 Match match(true);
3273 long save = lexer.GetPos();
3274 Match* parentMatch24 = &match;
3275 {
3276 Match match(false);
3277 Match* parentMatch25 = &match;
3278 {
3279 Match match(false);
3280 Match* parentMatch26 = &match;
3281 {
3282 Match match(false);
3283 if (*lexer == DIV)
3284 {
3285 ++lexer;
3286 match.hit = true;
3287 }
3288 *parentMatch26 = match;
3289 }
3290 if (match.hit)
3291 {
3292 Match match(false);
3293 Match* parentMatch27 = &match;
3294 {
3295 Match match = ParStatementParser.CompoundStatement(lexer, parsingContext);
3296 failureCode.Reset(cast<CompoundStatementNode*>(match.value));
3297 *parentMatch27 = match;
3298 }
3299 *parentMatch26 = match;
3300 }
3301 *parentMatch25 = match;
3302 }
3303 if (match.hit)
3304 {
3305 *parentMatch24 = match;
3306 }
3307 else
3308 {
3309 lexer.SetPos(save);
3310 }
3311 }
3312 *parentMatch23 = match;
3313 }
3314 *parentMatch22 = match;
3315 }
3316 *parentMatch21 = match;
3317 }
3318 if (match.hit)
3319 {
3320 value.Reset(new soulcm.scm2html.ActionParser(value.Release()));
3321 }
3322 *parentMatch20 = match;
3323 }
3324 *parentMatch19 = match;
3325 }
3326 *parentMatch18 = match;
3327 }
3328 if (match.hit)
3329 {
3330 *parentMatch17 = match;
3331 }
3332 else
3333 {
3334 lexer.SetPos(save);
3335 }
3336 }
3337 *parentMatch16 = match;
3338 }
3339 *parentMatch2 = match;
3340 }
3341 *parentMatch1 = match;
3342 }
3343 if (match.hit)
3344 {
3345 {
3346 #if (DEBUG)
3347 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primary");
3348 #endif
3349 return Match(true, value.Release());
3350 }
3351 }
3352 *parentMatch0 = match;
3353 }
3354 #if (DEBUG)
3355 if (writeToLog)
3356 {
3357 if (match.hit)
3358 {
3359 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primary");
3360 }
3361 else
3362 {
3363 System.Lex.WriteFailureToLog(lexer, u"Primary");
3364 }
3365 }
3366 #endif
3367 if (!match.hit)
3368 {
3369 match.value = null;
3370 }
3371 return match;
3372 }
3373 public static Match RuleCall(ParserFileLexer& lexer, ParsingContext* parsingContext)
3374 {
3375 #if (DEBUG)
3376 Span debugSpan;
3377 bool writeToLog = lexer.Log() != null;
3378 if (writeToLog)
3379 {
3380 debugSpan = lexer.GetSpan();
3381 System.Lex.WriteBeginRuleToLog(lexer, u"RuleCall");
3382 }
3383 #endif
3384 ustring ruleName;
3385 UniquePtr<InvokeNode> invoke;
3386 long nonterminalPos;
3387 UniquePtr<Value<ustring>> nt;
3388 Match match(false);
3389 Match* parentMatch0 = &match;
3390 {
3391 Match match(false);
3392 Match* parentMatch1 = &match;
3393 {
3394 Match match(false);
3395 Match* parentMatch2 = &match;
3396 {
3397 Match match(false);
3398 Match* parentMatch3 = &match;
3399 {
3400 long pos = lexer.GetPos();
3401 Match match = ParserFileParser.Nonterminal(lexer);
3402 nt.Reset(cast<Value<ustring>*>(match.value));
3403 if (match.hit)
3404 {
3405 ruleName = nt->value;
3406 nonterminalPos = pos;
3407 invoke.Reset(new InvokeNode(Span(), parsingContext->ModuleId()));
3408 }
3409 *parentMatch3 = match;
3410 }
3411 *parentMatch2 = match;
3412 }
3413 if (match.hit)
3414 {
3415 Match match(false);
3416 Match* parentMatch4 = &match;
3417 {
3418 Match match(true);
3419 long save = lexer.GetPos();
3420 Match* parentMatch5 = &match;
3421 {
3422 Match match(false);
3423 Match* parentMatch6 = &match;
3424 {
3425 Match match(false);
3426 Match* parentMatch7 = &match;
3427 {
3428 Match match(false);
3429 Match* parentMatch8 = &match;
3430 {
3431 Match match(false);
3432 Match* parentMatch9 = &match;
3433 {
3434 long pos = lexer.GetPos();
3435 bool pass = true;
3436 Match match(false);
3437 if (*lexer == LPAREN)
3438 {
3439 ++lexer;
3440 match.hit = true;
3441 }
3442 if (match.hit)
3443 {
3444 pass = NoWhiteSpaceBetweenTokens(lexer.GetToken(nonterminalPos), lexer.GetToken(pos));
3445 }
3446 if (match.hit && !pass)
3447 {
3448 match = Match(false);
3449 }
3450 *parentMatch9 = match;
3451 }
3452 *parentMatch8 = match;
3453 }
3454 if (match.hit)
3455 {
3456 Match match(false);
3457 Match* parentMatch10 = &match;
3458 {
3459 Match match = ParExpressionParser.ExpressionList(lexer, parsingContext, invoke.Get());
3460 *parentMatch10 = match;
3461 }
3462 *parentMatch8 = match;
3463 }
3464 *parentMatch7 = match;
3465 }
3466 if (match.hit)
3467 {
3468 Match match(false);
3469 Match* parentMatch11 = &match;
3470 {
3471 Match match(false);
3472 if (*lexer == RPAREN)
3473 {
3474 ++lexer;
3475 match.hit = true;
3476 }
3477 *parentMatch11 = match;
3478 }
3479 *parentMatch7 = match;
3480 }
3481 *parentMatch6 = match;
3482 }
3483 if (match.hit)
3484 {
3485 *parentMatch5 = match;
3486 }
3487 else
3488 {
3489 lexer.SetPos(save);
3490 }
3491 }
3492 *parentMatch4 = match;
3493 }
3494 *parentMatch2 = match;
3495 }
3496 *parentMatch1 = match;
3497 }
3498 if (match.hit)
3499 {
3500 Match match(false);
3501 Match* parentMatch12 = &match;
3502 {
3503 Match match(false);
3504 if (*lexer == COLON)
3505 {
3506 ++lexer;
3507 match.hit = true;
3508 }
3509 *parentMatch12 = match;
3510 }
3511 *parentMatch1 = match;
3512 }
3513 *parentMatch0 = match;
3514 }
3515 if (match.hit)
3516 {
3517 Match match(false);
3518 Match* parentMatch13 = &match;
3519 {
3520 Match match(false);
3521 Match* parentMatch14 = &match;
3522 {
3523 long pos = lexer.GetPos();
3524 Span span = lexer.GetSpan();
3525 Match match(true);
3526 Match* parentMatch15 = &match;
3527 {
3528 System.Lex.Span span = lexer.GetSpan();
3529 Match match(false);
3530 if (*lexer == ID)
3531 {
3532 ++lexer;
3533 match.hit = true;
3534 }
3535 if (match.hit)
3536 {
3537 *parentMatch15 = match;
3538 }
3539 else
3540 {
3541 lexer.ThrowExpectationFailure(span, GetTokenName(ID));
3542 }
3543 }
3544 if (match.hit)
3545 {
3546 ustring name = lexer.GetMatch(span);
3547 soulcm.scm2html.NonterminalParser* nonterminalParser = new soulcm.scm2html.NonterminalParser(name, ruleName);
3548 nonterminalParser->SetArguments(invoke.Get());
3549 {
3550 #if (DEBUG)
3551 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleCall");
3552 #endif
3553 return Match(true, nonterminalParser);
3554 }
3555 }
3556 *parentMatch14 = match;
3557 }
3558 *parentMatch13 = match;
3559 }
3560 *parentMatch0 = match;
3561 }
3562 #if (DEBUG)
3563 if (writeToLog)
3564 {
3565 if (match.hit)
3566 {
3567 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RuleCall");
3568 }
3569 else
3570 {
3571 System.Lex.WriteFailureToLog(lexer, u"RuleCall");
3572 }
3573 }
3574 #endif
3575 if (!match.hit)
3576 {
3577 match.value = null;
3578 }
3579 return match;
3580 }
3581 public static Match Nonterminal(ParserFileLexer& lexer)
3582 {
3583 #if (DEBUG)
3584 Span debugSpan;
3585 bool writeToLog = lexer.Log() != null;
3586 if (writeToLog)
3587 {
3588 debugSpan = lexer.GetSpan();
3589 System.Lex.WriteBeginRuleToLog(lexer, u"Nonterminal");
3590 }
3591 #endif
3592 Match match(false);
3593 Match* parentMatch0 = &match;
3594 {
3595 long pos = lexer.GetPos();
3596 Span span = lexer.GetSpan();
3597 Match match(false);
3598 if (*lexer == ID)
3599 {
3600 ++lexer;
3601 match.hit = true;
3602 }
3603 if (match.hit)
3604 {
3605 {
3606 #if (DEBUG)
3607 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Nonterminal");
3608 #endif
3609 return Match(true, new Value<ustring>(lexer.GetMatch(span)));
3610 }
3611 }
3612 *parentMatch0 = match;
3613 }
3614 #if (DEBUG)
3615 if (writeToLog)
3616 {
3617 if (match.hit)
3618 {
3619 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Nonterminal");
3620 }
3621 else
3622 {
3623 System.Lex.WriteFailureToLog(lexer, u"Nonterminal");
3624 }
3625 }
3626 #endif
3627 if (!match.hit)
3628 {
3629 match.value = null;
3630 }
3631 return match;
3632 }
3633 public static Match Primitive(ParserFileLexer& lexer)
3634 {
3635 #if (DEBUG)
3636 Span debugSpan;
3637 bool writeToLog = lexer.Log() != null;
3638 if (writeToLog)
3639 {
3640 debugSpan = lexer.GetSpan();
3641 System.Lex.WriteBeginRuleToLog(lexer, u"Primitive");
3642 }
3643 #endif
3644 Match match(false);
3645 long pos = lexer.GetPos();
3646 Span span = lexer.GetSpan();
3647 switch (*lexer)
3648 {
3649 case EMPTY:
3650 {
3651 ++lexer;
3652 {
3653 #if (DEBUG)
3654 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
3655 #endif
3656 return Match(true, new soulcm.scm2html.EmptyParser());
3657 }
3658 break;
3659 }
3660 case ANY:
3661 {
3662 ++lexer;
3663 {
3664 #if (DEBUG)
3665 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
3666 #endif
3667 return Match(true, new soulcm.scm2html.AnyParser());
3668 }
3669 break;
3670 }
3671 case ID:
3672 {
3673 ++lexer;
3674 ustring tokenName = lexer.GetMatch(span);
3675 {
3676 #if (DEBUG)
3677 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
3678 #endif
3679 return Match(true, new soulcm.scm2html.TokenParser(tokenName));
3680 }
3681 break;
3682 }
3683 case CHARLIT:
3684 {
3685 ++lexer;
3686 uchar charLit = soulcm.scm2html.ParseCharLiteral(lexer.FileName(), lexer.GetToken(pos));
3687 {
3688 #if (DEBUG)
3689 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
3690 #endif
3691 return Match(true, new soulcm.scm2html.CharParser(charLit));
3692 }
3693 break;
3694 }
3695 case STRINGLIT:
3696 {
3697 ++lexer;
3698 ustring strLit = soulcm.scm2html.ParseStringLiteral(lexer.FileName(), lexer.GetToken(pos));
3699 if (strLit.Length() > 0 && strLit[0] == '[' && strLit[strLit.Length() - 1] == ']')
3700 {
3701 soulcm.scm2html.CharSet charSet = soulcm.scm2html.ParseCharSet(lexer.FileName(), lexer.GetToken(pos), strLit);
3702 {
3703 #if (DEBUG)
3704 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
3705 #endif
3706 return Match(true, new soulcm.scm2html.CharSetParser(charSet));
3707 }
3708 }
3709 else
3710 {
3711 {
3712 #if (DEBUG)
3713 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
3714 #endif
3715 return Match(true, new soulcm.scm2html.StringParser(strLit));
3716 }
3717 }
3718 break;
3719 }
3720 }
3721 #if (DEBUG)
3722 if (writeToLog)
3723 {
3724 if (match.hit)
3725 {
3726 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Primitive");
3727 }
3728 else
3729 {
3730 System.Lex.WriteFailureToLog(lexer, u"Primitive");
3731 }
3732 }
3733 #endif
3734 if (!match.hit)
3735 {
3736 match.value = null;
3737 }
3738 return match;
3739 }
3740 public static Match Grouping(ParserFileLexer& lexer, ParsingContext* parsingContext)
3741 {
3742 #if (DEBUG)
3743 Span debugSpan;
3744 bool writeToLog = lexer.Log() != null;
3745 if (writeToLog)
3746 {
3747 debugSpan = lexer.GetSpan();
3748 System.Lex.WriteBeginRuleToLog(lexer, u"Grouping");
3749 }
3750 #endif
3751 UniquePtr<soulcm.scm2html.Parser> alt;
3752 Match match(false);
3753 Match* parentMatch0 = &match;
3754 {
3755 long pos = lexer.GetPos();
3756 Match match(false);
3757 Match* parentMatch1 = &match;
3758 {
3759 Match match(false);
3760 Match* parentMatch2 = &match;
3761 {
3762 Match match(false);
3763 Match* parentMatch3 = &match;
3764 {
3765 Match match(false);
3766 if (*lexer == LPAREN)
3767 {
3768 ++lexer;
3769 match.hit = true;
3770 }
3771 *parentMatch3 = match;
3772 }
3773 if (match.hit)
3774 {
3775 Match match(false);
3776 Match* parentMatch4 = &match;
3777 {
3778 Match match = ParserFileParser.Alternative(lexer, parsingContext);
3779 alt.Reset(cast<soulcm.scm2html.Parser*>(match.value));
3780 *parentMatch4 = match;
3781 }
3782 *parentMatch3 = match;
3783 }
3784 *parentMatch2 = match;
3785 }
3786 if (match.hit)
3787 {
3788 Match match(false);
3789 Match* parentMatch5 = &match;
3790 {
3791 Match match(true);
3792 Match* parentMatch6 = &match;
3793 {
3794 System.Lex.Span span = lexer.GetSpan();
3795 Match match(false);
3796 if (*lexer == RPAREN)
3797 {
3798 ++lexer;
3799 match.hit = true;
3800 }
3801 if (match.hit)
3802 {
3803 *parentMatch6 = match;
3804 }
3805 else
3806 {
3807 lexer.ThrowExpectationFailure(span, GetTokenName(RPAREN));
3808 }
3809 }
3810 *parentMatch5 = match;
3811 }
3812 *parentMatch2 = match;
3813 }
3814 *parentMatch1 = match;
3815 }
3816 if (match.hit)
3817 {
3818 {
3819 #if (DEBUG)
3820 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Grouping");
3821 #endif
3822 return Match(true, new soulcm.scm2html.GroupingParser(alt.Release()));
3823 }
3824 }
3825 *parentMatch0 = match;
3826 }
3827 #if (DEBUG)
3828 if (writeToLog)
3829 {
3830 if (match.hit)
3831 {
3832 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Grouping");
3833 }
3834 else
3835 {
3836 System.Lex.WriteFailureToLog(lexer, u"Grouping");
3837 }
3838 }
3839 #endif
3840 if (!match.hit)
3841 {
3842 match.value = null;
3843 }
3844 return match;
3845 }
3846 }