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