1 #include "LexerDeclaratorParser.hpp"
2 #include <soulng/util/Unicode.hpp>
3 #include <sng2html/sng2html/LexerExpressionParser.hpp>
4 #include <sng2html/sng2html/LexerDeclarationParser.hpp>
5 #include <sng2html/sng2html/LexerFileLexer.hpp>
6 #include <sng2html/sng2html/LexerFileTokens.hpp>
7 #include <soulng/util/TextUtils.hpp>
8
9
10
11 using namespace soulng::unicode;
12 using namespace soulng::lexer;
13 using namespace LexerFileTokens;
14
15 soulng::parser::Match LexerDeclaratorParser::InitDeclaratorList(LexerFileLexer& lexer)
16 {
17 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
18
19
20
21
22
23
24
25 #endif // SOULNG_PARSER_DEBUG_SUPPORT
26 std::unique_ptr<soulng::cppcode::InitDeclaratorList> initDeclaratorList = std::unique_ptr<soulng::cppcode::InitDeclaratorList>();
27 std::unique_ptr<soulng::cppcode::InitDeclarator> initDeclarator;
28 soulng::parser::Match match(false);
29 soulng::parser::Match* parentMatch0 = &match;
30 {
31 int64_t pos = lexer.GetPos();
32 soulng::parser::Match match(false);
33 soulng::parser::Match* parentMatch1 = &match;
34 {
35 soulng::parser::Match match(false);
36 soulng::parser::Match* parentMatch2 = &match;
37 {
38 soulng::parser::Match match(false);
39 soulng::parser::Match* parentMatch3 = &match;
40 {
41 int64_t pos = lexer.GetPos();
42 soulng::parser::Match match(true);
43 if (match.hit)
44 {
45 initDeclaratorList.reset(new soulng::cppcode::InitDeclaratorList());
46 }
47 *parentMatch3 = match;
48 }
49 *parentMatch2 = match;
50 }
51 if (match.hit)
52 {
53 soulng::parser::Match match(false);
54 soulng::parser::Match* parentMatch4 = &match;
55 {
56 soulng::parser::Match match(false);
57 soulng::parser::Match* parentMatch5 = &match;
58 {
59 soulng::parser::Match match(false);
60 soulng::parser::Match* parentMatch6 = &match;
61 {
62 soulng::parser::Match match(false);
63 soulng::parser::Match* parentMatch7 = &match;
64 {
65 int64_t pos = lexer.GetPos();
66 soulng::parser::Match match = LexerDeclaratorParser::InitDeclarator(lexer);
67 initDeclarator.reset(static_cast<soulng::cppcode::InitDeclarator*>(match.value));
68 if (match.hit)
69 {
70 initDeclaratorList->Add(initDeclarator.release());
71 }
72 *parentMatch7 = match;
73 }
74 *parentMatch6 = match;
75 }
76 if (match.hit)
77 {
78 soulng::parser::Match match(false);
79 soulng::parser::Match* parentMatch8 = &match;
80 {
81 soulng::parser::Match match(true);
82 soulng::parser::Match* parentMatch9 = &match;
83 {
84 while (true)
85 {
86 int64_t save = lexer.GetPos();
87 {
88 soulng::parser::Match match(false);
89 soulng::parser::Match* parentMatch10 = &match;
90 {
91 soulng::parser::Match match(false);
92 if (*lexer == COMMA)
93 {
94 ++lexer;
95 match.hit = true;
96 }
97 *parentMatch10 = match;
98 }
99 if (match.hit)
100 {
101 soulng::parser::Match match(false);
102 soulng::parser::Match* parentMatch11 = &match;
103 {
104 soulng::parser::Match match(false);
105 soulng::parser::Match* parentMatch12 = &match;
106 {
107 int64_t pos = lexer.GetPos();
108 soulng::parser::Match match = LexerDeclaratorParser::InitDeclarator(lexer);
109 initDeclarator.reset(static_cast<soulng::cppcode::InitDeclarator*>(match.value));
110 if (match.hit)
111 {
112 initDeclaratorList->Add(initDeclarator.release());
113 }
114 *parentMatch12 = match;
115 }
116 *parentMatch11 = match;
117 }
118 *parentMatch10 = match;
119 }
120 if (match.hit)
121 {
122 *parentMatch9 = match;
123 }
124 else
125 {
126 lexer.SetPos(save);
127 break;
128 }
129 }
130 }
131 }
132 *parentMatch8 = match;
133 }
134 *parentMatch6 = match;
135 }
136 *parentMatch5 = match;
137 }
138 *parentMatch4 = match;
139 }
140 *parentMatch2 = match;
141 }
142 *parentMatch1 = match;
143 }
144 if (match.hit)
145 {
146 {
147 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
148
149 #endif // SOULNG_PARSER_DEBUG_SUPPORT
150 return soulng::parser::Match(true, initDeclaratorList.release());
151 }
152 }
153 *parentMatch0 = match;
154 }
155 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
156
157
158
159
160
161 #endif // SOULNG_PARSER_DEBUG_SUPPORT
162 if (!match.hit)
163 {
164 match.value = nullptr;
165 }
166 return match;
167 }
168
169 soulng::parser::Match LexerDeclaratorParser::InitDeclarator(LexerFileLexer& lexer)
170 {
171 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
172
173
174
175
176
177
178
179 #endif // SOULNG_PARSER_DEBUG_SUPPORT
180 std::unique_ptr<soulng::parser::soulng::parser::Value<std::u32string>>declarator;
181 std::unique_ptr<soulng::cppcode::Initializer> initializer;
182 soulng::parser::Match match(false);
183 soulng::parser::Match* parentMatch0 = &match;
184 {
185 int64_t pos = lexer.GetPos();
186 soulng::parser::Match match(false);
187 soulng::parser::Match* parentMatch1 = &match;
188 {
189 soulng::parser::Match match(false);
190 soulng::parser::Match* parentMatch2 = &match;
191 {
192 soulng::parser::Match match = LexerDeclaratorParser::Declarator(lexer);
193 declarator.reset(static_cast<soulng::parser::soulng::parser::Value<std::u32string>*>(match.value));
194 *parentMatch2 = match;
195 }
196 if (match.hit)
197 {
198 soulng::parser::Match match(false);
199 soulng::parser::Match* parentMatch3 = &match;
200 {
201 soulng::parser::Match match(true);
202 int64_t save = lexer.GetPos();
203 soulng::parser::Match* parentMatch4 = &match;
204 {
205 soulng::parser::Match match = LexerDeclaratorParser::Initializer(lexer);
206 initializer.reset(static_cast<soulng::cppcode::Initializer*>(match.value));
207 if (match.hit)
208 {
209 *parentMatch4 = match;
210 }
211 else
212 {
213 lexer.SetPos(save);
214 }
215 }
216 *parentMatch3 = match;
217 }
218 *parentMatch2 = match;
219 }
220 *parentMatch1 = match;
221 }
222 if (match.hit)
223 {
224 {
225 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
226
227 #endif // SOULNG_PARSER_DEBUG_SUPPORT
228 return soulng::parser::Match(true, new soulng::cppcode::InitDeclarator(declarator->value, initializer.release()));
229 }
230 }
231 *parentMatch0 = match;
232 }
233 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
234
235
236
237
238
239 #endif // SOULNG_PARSER_DEBUG_SUPPORT
240 if (!match.hit)
241 {
242 match.value = nullptr;
243 }
244 return match;
245 }
246
247 soulng::parser::Match LexerDeclaratorParser::Declarator(LexerFileLexer& lexer)
248 {
249 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
250
251
252
253
254
255
256
257 #endif // SOULNG_PARSER_DEBUG_SUPPORT
258 Span s = Span();
259 std::unique_ptr<soulng::parser::soulng::parser::Value<std::u32string>>declarator;
260 soulng::parser::Match match(false);
261 soulng::parser::Match* parentMatch0 = &match;
262 {
263 int64_t pos = lexer.GetPos();
264 soulng::parser::Match match(false);
265 soulng::parser::Match* parentMatch1 = &match;
266 {
267 soulng::parser::Match match(false);
268 soulng::parser::Match* parentMatch2 = &match;
269 {
270 int64_t save = lexer.GetPos();
271 soulng::parser::Match match(false);
272 soulng::parser::Match* parentMatch3 = &match;
273 {
274 int64_t pos = lexer.GetPos();
275 soulng::lexer::Span span = lexer.GetSpan();
276 soulng::parser::Match match = LexerDeclaratorParser::DirectDeclarator(lexer);
277 if (match.hit)
278 {
279 s = span;
280 }
281 *parentMatch3 = match;
282 }
283 *parentMatch2 = match;
284 if (!match.hit)
285 {
286 soulng::parser::Match match(false);
287 soulng::parser::Match* parentMatch4 = &match;
288 lexer.SetPos(save);
289 {
290 soulng::parser::Match match(false);
291 soulng::parser::Match* parentMatch5 = &match;
292 {
293 soulng::parser::Match match(false);
294 soulng::parser::Match* parentMatch6 = &match;
295 {
296 int64_t pos = lexer.GetPos();
297 soulng::lexer::Span span = lexer.GetSpan();
298 soulng::parser::Match match = LexerDeclaratorParser::PtrOperator(lexer);
299 if (match.hit)
300 {
301 s = span;
302 }
303 *parentMatch6 = match;
304 }
305 *parentMatch5 = match;
306 }
307 if (match.hit)
308 {
309 soulng::parser::Match match(false);
310 soulng::parser::Match* parentMatch7 = &match;
311 {
312 soulng::parser::Match match(false);
313 soulng::parser::Match* parentMatch8 = &match;
314 {
315 int64_t pos = lexer.GetPos();
316 soulng::lexer::Span span = lexer.GetSpan();
317 soulng::parser::Match match = LexerDeclaratorParser::Declarator(lexer);
318 declarator.reset(static_cast<soulng::parser::soulng::parser::Value<std::u32string>*>(match.value));
319 if (match.hit)
320 {
321 s.end = span.end;
322 }
323 *parentMatch8 = match;
324 }
325 *parentMatch7 = match;
326 }
327 *parentMatch5 = match;
328 }
329 *parentMatch4 = match;
330 }
331 *parentMatch2 = match;
332 }
333 }
334 *parentMatch1 = match;
335 }
336 if (match.hit)
337 {
338 {
339 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
340
341 #endif // SOULNG_PARSER_DEBUG_SUPPORT
342 return soulng::parser::Match(true, new soulng::parser::Value<std::u32string>(lexer.GetMatch(s)));
343 }
344 }
345 *parentMatch0 = match;
346 }
347 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
348
349
350
351
352
353 #endif // SOULNG_PARSER_DEBUG_SUPPORT
354 if (!match.hit)
355 {
356 match.value = nullptr;
357 }
358 return match;
359 }
360
361 soulng::parser::Match LexerDeclaratorParser::DirectDeclarator(LexerFileLexer& lexer)
362 {
363 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
364
365
366
367
368
369
370
371 #endif // SOULNG_PARSER_DEBUG_SUPPORT
372 std::unique_ptr<soulng::cppcode::CppObject> expr;
373 std::unique_ptr<soulng::parser::soulng::parser::Value<std::u32string>>declarator;
374 soulng::parser::Match match(false);
375 soulng::parser::Match* parentMatch0 = &match;
376 {
377 soulng::parser::Match match = LexerDeclaratorParser::DeclaratorId(lexer);
378 *parentMatch0 = match;
379 }
380 if (match.hit)
381 {
382 soulng::parser::Match match(false);
383 soulng::parser::Match* parentMatch1 = &match;
384 {
385 soulng::parser::Match match(true);
386 soulng::parser::Match* parentMatch2 = &match;
387 {
388 while (true)
389 {
390 int64_t save = lexer.GetPos();
391 {
392 soulng::parser::Match match(false);
393 soulng::parser::Match* parentMatch3 = &match;
394 {
395 soulng::parser::Match match(false);
396 soulng::parser::Match* parentMatch4 = &match;
397 {
398 int64_t save = lexer.GetPos();
399 soulng::parser::Match match(false);
400 soulng::parser::Match* parentMatch5 = &match;
401 {
402 soulng::parser::Match match(false);
403 soulng::parser::Match* parentMatch6 = &match;
404 {
405 soulng::parser::Match match(false);
406 if (*lexer == LBRACKET)
407 {
408 ++lexer;
409 match.hit = true;
410 }
411 *parentMatch6 = match;
412 }
413 if (match.hit)
414 {
415 soulng::parser::Match match(false);
416 soulng::parser::Match* parentMatch7 = &match;
417 {
418 soulng::parser::Match match(true);
419 int64_t save = lexer.GetPos();
420 soulng::parser::Match* parentMatch8 = &match;
421 {
422 soulng::parser::Match match = LexerExpressionParser::ConstantExpression(lexer);
423 expr.reset(static_cast<soulng::cppcode::CppObject*>(match.value));
424 if (match.hit)
425 {
426 *parentMatch8 = match;
427 }
428 else
429 {
430 lexer.SetPos(save);
431 }
432 }
433 *parentMatch7 = match;
434 }
435 *parentMatch6 = match;
436 }
437 *parentMatch5 = match;
438 }
439 if (match.hit)
440 {
441 soulng::parser::Match match(false);
442 soulng::parser::Match* parentMatch9 = &match;
443 {
444 soulng::parser::Match match(false);
445 if (*lexer == RBRACKET)
446 {
447 ++lexer;
448 match.hit = true;
449 }
450 *parentMatch9 = match;
451 }
452 *parentMatch5 = match;
453 }
454 *parentMatch4 = match;
455 if (!match.hit)
456 {
457 soulng::parser::Match match(false);
458 soulng::parser::Match* parentMatch10 = &match;
459 lexer.SetPos(save);
460 {
461 soulng::parser::Match match(false);
462 soulng::parser::Match* parentMatch11 = &match;
463 {
464 soulng::parser::Match match(false);
465 soulng::parser::Match* parentMatch12 = &match;
466 {
467 soulng::parser::Match match(false);
468 if (*lexer == LPAREN)
469 {
470 ++lexer;
471 match.hit = true;
472 }
473 *parentMatch12 = match;
474 }
475 if (match.hit)
476 {
477 soulng::parser::Match match(false);
478 soulng::parser::Match* parentMatch13 = &match;
479 {
480 soulng::parser::Match match = LexerDeclaratorParser::Declarator(lexer);
481 declarator.reset(static_cast<soulng::parser::soulng::parser::Value<std::u32string>*>(match.value));
482 *parentMatch13 = match;
483 }
484 *parentMatch12 = match;
485 }
486 *parentMatch11 = match;
487 }
488 if (match.hit)
489 {
490 soulng::parser::Match match(false);
491 soulng::parser::Match* parentMatch14 = &match;
492 {
493 soulng::parser::Match match(false);
494 if (*lexer == RPAREN)
495 {
496 ++lexer;
497 match.hit = true;
498 }
499 *parentMatch14 = match;
500 }
501 *parentMatch11 = match;
502 }
503 *parentMatch10 = match;
504 }
505 *parentMatch4 = match;
506 }
507 }
508 *parentMatch3 = match;
509 }
510 if (match.hit)
511 {
512 *parentMatch2 = match;
513 }
514 else
515 {
516 lexer.SetPos(save);
517 break;
518 }
519 }
520 }
521 }
522 *parentMatch1 = match;
523 }
524 *parentMatch0 = match;
525 }
526 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
527
528
529
530
531
532 #endif // SOULNG_PARSER_DEBUG_SUPPORT
533 if (!match.hit)
534 {
535 match.value = nullptr;
536 }
537 return match;
538 }
539
540 soulng::parser::Match LexerDeclaratorParser::DeclaratorId(LexerFileLexer& lexer)
541 {
542 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
543
544
545
546
547
548
549
550 #endif // SOULNG_PARSER_DEBUG_SUPPORT
551 std::unique_ptr<soulng::cppcode::IdExpr> idExpr;
552 std::unique_ptr<soulng::cppcode::TypeName> typeName;
553 soulng::parser::Match match(false);
554 soulng::parser::Match* parentMatch0 = &match;
555 {
556 int64_t save = lexer.GetPos();
557 soulng::parser::Match match = LexerExpressionParser::IdExpression(lexer);
558 idExpr.reset(static_cast<soulng::cppcode::IdExpr*>(match.value));
559 *parentMatch0 = match;
560 if (!match.hit)
561 {
562 soulng::parser::Match match(false);
563 soulng::parser::Match* parentMatch1 = &match;
564 lexer.SetPos(save);
565 {
566 soulng::parser::Match match = LexerDeclarationParser::TypeName(lexer);
567 typeName.reset(static_cast<soulng::cppcode::TypeName*>(match.value));
568 *parentMatch1 = match;
569 }
570 *parentMatch0 = match;
571 }
572 }
573 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
574
575
576
577
578
579 #endif // SOULNG_PARSER_DEBUG_SUPPORT
580 if (!match.hit)
581 {
582 match.value = nullptr;
583 }
584 return match;
585 }
586
587 soulng::parser::Match LexerDeclaratorParser::TypeId(LexerFileLexer& lexer)
588 {
589 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
590
591
592
593
594
595
596
597 #endif // SOULNG_PARSER_DEBUG_SUPPORT
598 std::unique_ptr<soulng::cppcode::TypeId> typeId = std::unique_ptr<soulng::cppcode::TypeId>();
599 std::unique_ptr<soulng::cppcode::TypeName> typeName;
600 std::unique_ptr<soulng::parser::soulng::parser::Value<std::u32string>>abstractDeclarator;
601 soulng::parser::Match match(false);
602 soulng::parser::Match* parentMatch0 = &match;
603 {
604 soulng::parser::Match match(false);
605 soulng::parser::Match* parentMatch1 = &match;
606 {
607 int64_t pos = lexer.GetPos();
608 soulng::parser::Match match(true);
609 if (match.hit)
610 {
611 typeId.reset(new soulng::cppcode::TypeId());
612 }
613 *parentMatch1 = match;
614 }
615 *parentMatch0 = match;
616 }
617 if (match.hit)
618 {
619 soulng::parser::Match match(false);
620 soulng::parser::Match* parentMatch2 = &match;
621 {
622 soulng::parser::Match match(false);
623 soulng::parser::Match* parentMatch3 = &match;
624 {
625 int64_t pos = lexer.GetPos();
626 soulng::parser::Match match(false);
627 soulng::parser::Match* parentMatch4 = &match;
628 {
629 soulng::parser::Match match(false);
630 soulng::parser::Match* parentMatch5 = &match;
631 {
632 soulng::parser::Match match(false);
633 soulng::parser::Match* parentMatch6 = &match;
634 {
635 soulng::parser::Match match(false);
636 soulng::parser::Match* parentMatch7 = &match;
637 {
638 int64_t save = lexer.GetPos();
639 soulng::parser::Match match = LexerDeclaratorParser::TypeSpecifierSeq(lexer, typeId.get());
640 *parentMatch7 = match;
641 if (!match.hit)
642 {
643 soulng::parser::Match match(false);
644 soulng::parser::Match* parentMatch8 = &match;
645 lexer.SetPos(save);
646 {
647 soulng::parser::Match match(false);
648 soulng::parser::Match* parentMatch9 = &match;
649 {
650 int64_t pos = lexer.GetPos();
651 soulng::parser::Match match = LexerDeclarationParser::TypeName(lexer);
652 typeName.reset(static_cast<soulng::cppcode::TypeName*>(match.value));
653 if (match.hit)
654 {
655 typeId->Add(typeName.release());
656 }
657 *parentMatch9 = match;
658 }
659 *parentMatch8 = match;
660 }
661 *parentMatch7 = match;
662 }
663 }
664 *parentMatch6 = match;
665 }
666 *parentMatch5 = match;
667 }
668 if (match.hit)
669 {
670 soulng::parser::Match match(false);
671 soulng::parser::Match* parentMatch10 = &match;
672 {
673 soulng::parser::Match match(true);
674 int64_t save = lexer.GetPos();
675 soulng::parser::Match* parentMatch11 = &match;
676 {
677 soulng::parser::Match match(false);
678 soulng::parser::Match* parentMatch12 = &match;
679 {
680 soulng::parser::Match match(false);
681 soulng::parser::Match* parentMatch13 = &match;
682 {
683 int64_t pos = lexer.GetPos();
684 soulng::parser::Match match = LexerDeclaratorParser::AbstractDeclarator(lexer);
685 abstractDeclarator.reset(static_cast<soulng::parser::soulng::parser::Value<std::u32string>*>(match.value));
686 if (match.hit)
687 {
688 typeId->Declarator() = abstractDeclarator->value;
689 }
690 *parentMatch13 = match;
691 }
692 *parentMatch12 = match;
693 }
694 if (match.hit)
695 {
696 *parentMatch11 = match;
697 }
698 else
699 {
700 lexer.SetPos(save);
701 }
702 }
703 *parentMatch10 = match;
704 }
705 *parentMatch5 = match;
706 }
707 *parentMatch4 = match;
708 }
709 if (match.hit)
710 {
711 {
712 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
713
714 #endif // SOULNG_PARSER_DEBUG_SUPPORT
715 return soulng::parser::Match(true, typeId.release());
716 }
717 }
718 *parentMatch3 = match;
719 }
720 *parentMatch2 = match;
721 }
722 *parentMatch0 = match;
723 }
724 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
725
726
727
728
729
730 #endif // SOULNG_PARSER_DEBUG_SUPPORT
731 if (!match.hit)
732 {
733 match.value = nullptr;
734 }
735 return match;
736 }
737
738 soulng::parser::Match LexerDeclaratorParser::Type(LexerFileLexer& lexer)
739 {
740 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
741
742
743
744
745
746
747
748 #endif // SOULNG_PARSER_DEBUG_SUPPORT
749 std::unique_ptr<soulng::cppcode::Type> type = std::unique_ptr<soulng::cppcode::Type>();
750 std::unique_ptr<soulng::cppcode::TypeSpecifier> typeSpecifier;
751 std::unique_ptr<soulng::cppcode::TypeName> typeName;
752 soulng::parser::Match match(false);
753 soulng::parser::Match* parentMatch0 = &match;
754 {
755 soulng::parser::Match match(false);
756 soulng::parser::Match* parentMatch1 = &match;
757 {
758 int64_t pos = lexer.GetPos();
759 soulng::parser::Match match(true);
760 if (match.hit)
761 {
762 type.reset(new soulng::cppcode::Type());
763 }
764 *parentMatch1 = match;
765 }
766 *parentMatch0 = match;
767 }
768 if (match.hit)
769 {
770 soulng::parser::Match match(false);
771 soulng::parser::Match* parentMatch2 = &match;
772 {
773 soulng::parser::Match match(false);
774 soulng::parser::Match* parentMatch3 = &match;
775 {
776 int64_t pos = lexer.GetPos();
777 soulng::parser::Match match(false);
778 soulng::parser::Match* parentMatch4 = &match;
779 {
780 soulng::parser::Match match(false);
781 soulng::parser::Match* parentMatch5 = &match;
782 {
783 int64_t save = lexer.GetPos();
784 soulng::parser::Match match(false);
785 soulng::parser::Match* parentMatch6 = &match;
786 {
787 soulng::parser::Match match(false);
788 soulng::parser::Match* parentMatch7 = &match;
789 {
790 soulng::parser::Match match(false);
791 soulng::parser::Match* parentMatch8 = &match;
792 {
793 int64_t pos = lexer.GetPos();
794 soulng::parser::Match match = LexerDeclarationParser::TypeSpecifier(lexer);
795 typeSpecifier.reset(static_cast<soulng::cppcode::TypeSpecifier*>(match.value));
796 if (match.hit)
797 {
798 type->Add(typeSpecifier.release());
799 }
800 *parentMatch8 = match;
801 }
802 *parentMatch7 = match;
803 }
804 *parentMatch6 = match;
805 }
806 if (match.hit)
807 {
808 soulng::parser::Match match(true);
809 soulng::parser::Match* parentMatch9 = &match;
810 while (true)
811 {
812 int64_t save = lexer.GetPos();
813 {
814 soulng::parser::Match match(false);
815 soulng::parser::Match* parentMatch10 = &match;
816 {
817 soulng::parser::Match match(false);
818 soulng::parser::Match* parentMatch11 = &match;
819 {
820 int64_t pos = lexer.GetPos();
821 soulng::parser::Match match = LexerDeclarationParser::TypeSpecifier(lexer);
822 typeSpecifier.reset(static_cast<soulng::cppcode::TypeSpecifier*>(match.value));
823 if (match.hit)
824 {
825 type->Add(typeSpecifier.release());
826 }
827 *parentMatch11 = match;
828 }
829 *parentMatch10 = match;
830 }
831 if (match.hit)
832 {
833 *parentMatch9 = match;
834 }
835 else
836 {
837 lexer.SetPos(save);
838 break;
839 }
840 }
841 }
842 }
843 *parentMatch5 = match;
844 if (!match.hit)
845 {
846 soulng::parser::Match match(false);
847 soulng::parser::Match* parentMatch12 = &match;
848 lexer.SetPos(save);
849 {
850 soulng::parser::Match match(false);
851 soulng::parser::Match* parentMatch13 = &match;
852 {
853 int64_t pos = lexer.GetPos();
854 soulng::parser::Match match = LexerDeclarationParser::TypeName(lexer);
855 typeName.reset(static_cast<soulng::cppcode::TypeName*>(match.value));
856 if (match.hit)
857 {
858 type->Add(typeName.release());
859 }
860 *parentMatch13 = match;
861 }
862 *parentMatch12 = match;
863 }
864 *parentMatch5 = match;
865 }
866 }
867 *parentMatch4 = match;
868 }
869 if (match.hit)
870 {
871 {
872 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
873
874 #endif // SOULNG_PARSER_DEBUG_SUPPORT
875 return soulng::parser::Match(true, type.release());
876 }
877 }
878 *parentMatch3 = match;
879 }
880 *parentMatch2 = match;
881 }
882 *parentMatch0 = match;
883 }
884 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
885
886
887
888
889
890 #endif // SOULNG_PARSER_DEBUG_SUPPORT
891 if (!match.hit)
892 {
893 match.value = nullptr;
894 }
895 return match;
896 }
897
898 soulng::parser::Match LexerDeclaratorParser::TypeSpecifierSeq(LexerFileLexer& lexer, soulng::cppcode::TypeId* typeId)
899 {
900 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
901
902
903
904
905
906
907
908 #endif // SOULNG_PARSER_DEBUG_SUPPORT
909 std::unique_ptr<soulng::cppcode::TypeSpecifier> typeSpecifier;
910 soulng::parser::Match match(false);
911 soulng::parser::Match* parentMatch0 = &match;
912 {
913 soulng::parser::Match match(false);
914 soulng::parser::Match* parentMatch1 = &match;
915 {
916 soulng::parser::Match match(false);
917 soulng::parser::Match* parentMatch2 = &match;
918 {
919 int64_t pos = lexer.GetPos();
920 soulng::parser::Match match = LexerDeclarationParser::TypeSpecifier(lexer);
921 typeSpecifier.reset(static_cast<soulng::cppcode::TypeSpecifier*>(match.value));
922 if (match.hit)
923 {
924 typeId->Add(typeSpecifier.release());
925 }
926 *parentMatch2 = match;
927 }
928 *parentMatch1 = match;
929 }
930 *parentMatch0 = match;
931 }
932 if (match.hit)
933 {
934 soulng::parser::Match match(true);
935 soulng::parser::Match* parentMatch3 = &match;
936 while (true)
937 {
938 int64_t save = lexer.GetPos();
939 {
940 soulng::parser::Match match(false);
941 soulng::parser::Match* parentMatch4 = &match;
942 {
943 soulng::parser::Match match(false);
944 soulng::parser::Match* parentMatch5 = &match;
945 {
946 int64_t pos = lexer.GetPos();
947 soulng::parser::Match match = LexerDeclarationParser::TypeSpecifier(lexer);
948 typeSpecifier.reset(static_cast<soulng::cppcode::TypeSpecifier*>(match.value));
949 if (match.hit)
950 {
951 typeId->Add(typeSpecifier.release());
952 }
953 *parentMatch5 = match;
954 }
955 *parentMatch4 = match;
956 }
957 if (match.hit)
958 {
959 *parentMatch3 = match;
960 }
961 else
962 {
963 lexer.SetPos(save);
964 break;
965 }
966 }
967 }
968 }
969 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
970
971
972
973
974
975 #endif // SOULNG_PARSER_DEBUG_SUPPORT
976 if (!match.hit)
977 {
978 match.value = nullptr;
979 }
980 return match;
981 }
982
983 soulng::parser::Match LexerDeclaratorParser::AbstractDeclarator(LexerFileLexer& lexer)
984 {
985 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
986
987
988
989
990
991
992
993 #endif // SOULNG_PARSER_DEBUG_SUPPORT
994 Span s = Span();
995 std::unique_ptr<soulng::parser::soulng::parser::Value<std::u32string>>abstractDeclarator;
996 soulng::parser::Match match(false);
997 soulng::parser::Match* parentMatch0 = &match;
998 {
999 int64_t pos = lexer.GetPos();
1000 soulng::parser::Match match(false);
1001 soulng::parser::Match* parentMatch1 = &match;
1002 {
1003 soulng::parser::Match match(false);
1004 soulng::parser::Match* parentMatch2 = &match;
1005 {
1006 int64_t save = lexer.GetPos();
1007 soulng::parser::Match match(false);
1008 soulng::parser::Match* parentMatch3 = &match;
1009 {
1010 soulng::parser::Match match(false);
1011 soulng::parser::Match* parentMatch4 = &match;
1012 {
1013 int64_t pos = lexer.GetPos();
1014 soulng::lexer::Span span = lexer.GetSpan();
1015 soulng::parser::Match match = LexerDeclaratorParser::PtrOperator(lexer);
1016 if (match.hit)
1017 {
1018 s = span;
1019 }
1020 *parentMatch4 = match;
1021 }
1022 *parentMatch3 = match;
1023 }
1024 if (match.hit)
1025 {
1026 soulng::parser::Match match(false);
1027 soulng::parser::Match* parentMatch5 = &match;
1028 {
1029 soulng::parser::Match match(true);
1030 int64_t save = lexer.GetPos();
1031 soulng::parser::Match* parentMatch6 = &match;
1032 {
1033 soulng::parser::Match match(false);
1034 soulng::parser::Match* parentMatch7 = &match;
1035 {
1036 soulng::parser::Match match(false);
1037 soulng::parser::Match* parentMatch8 = &match;
1038 {
1039 int64_t pos = lexer.GetPos();
1040 soulng::lexer::Span span = lexer.GetSpan();
1041 soulng::parser::Match match = LexerDeclaratorParser::AbstractDeclarator(lexer);
1042 abstractDeclarator.reset(static_cast<soulng::parser::soulng::parser::Value<std::u32string>*>(match.value));
1043 if (match.hit)
1044 {
1045 s.end = span.end;
1046 }
1047 *parentMatch8 = match;
1048 }
1049 *parentMatch7 = match;
1050 }
1051 if (match.hit)
1052 {
1053 *parentMatch6 = match;
1054 }
1055 else
1056 {
1057 lexer.SetPos(save);
1058 }
1059 }
1060 *parentMatch5 = match;
1061 }
1062 *parentMatch3 = match;
1063 }
1064 *parentMatch2 = match;
1065 if (!match.hit)
1066 {
1067 soulng::parser::Match match(false);
1068 soulng::parser::Match* parentMatch9 = &match;
1069 lexer.SetPos(save);
1070 {
1071 soulng::parser::Match match(false);
1072 soulng::parser::Match* parentMatch10 = &match;
1073 {
1074 int64_t pos = lexer.GetPos();
1075 soulng::lexer::Span span = lexer.GetSpan();
1076 soulng::parser::Match match = LexerDeclaratorParser::DirectAbstractDeclarator(lexer);
1077 if (match.hit)
1078 {
1079 s = span;
1080 }
1081 *parentMatch10 = match;
1082 }
1083 *parentMatch9 = match;
1084 }
1085 *parentMatch2 = match;
1086 }
1087 }
1088 *parentMatch1 = match;
1089 }
1090 if (match.hit)
1091 {
1092 {
1093 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1094
1095 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1096 return soulng::parser::Match(true, new soulng::parser::Value<std::u32string>(soulng::util::Trim(lexer.GetMatch(s))));
1097 }
1098 }
1099 *parentMatch0 = match;
1100 }
1101 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1102
1103
1104
1105
1106
1107 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1108 if (!match.hit)
1109 {
1110 match.value = nullptr;
1111 }
1112 return match;
1113 }
1114
1115 soulng::parser::Match LexerDeclaratorParser::DirectAbstractDeclarator(LexerFileLexer& lexer)
1116 {
1117 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1118
1119
1120
1121
1122
1123
1124
1125 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1126 std::unique_ptr<soulng::cppcode::CppObject> expr;
1127 std::unique_ptr<soulng::parser::soulng::parser::Value<std::u32string>>abstractDeclarator;
1128 soulng::parser::Match match(false);
1129 soulng::parser::Match* parentMatch0 = &match;
1130 {
1131 soulng::parser::Match match(false);
1132 soulng::parser::Match* parentMatch1 = &match;
1133 {
1134 soulng::parser::Match match(false);
1135 soulng::parser::Match* parentMatch2 = &match;
1136 {
1137 int64_t save = lexer.GetPos();
1138 soulng::parser::Match match(false);
1139 soulng::parser::Match* parentMatch3 = &match;
1140 {
1141 soulng::parser::Match match(false);
1142 soulng::parser::Match* parentMatch4 = &match;
1143 {
1144 soulng::parser::Match match(false);
1145 if (*lexer == LBRACKET)
1146 {
1147 ++lexer;
1148 match.hit = true;
1149 }
1150 *parentMatch4 = match;
1151 }
1152 if (match.hit)
1153 {
1154 soulng::parser::Match match(false);
1155 soulng::parser::Match* parentMatch5 = &match;
1156 {
1157 soulng::parser::Match match(true);
1158 int64_t save = lexer.GetPos();
1159 soulng::parser::Match* parentMatch6 = &match;
1160 {
1161 soulng::parser::Match match = LexerExpressionParser::ConstantExpression(lexer);
1162 expr.reset(static_cast<soulng::cppcode::CppObject*>(match.value));
1163 if (match.hit)
1164 {
1165 *parentMatch6 = match;
1166 }
1167 else
1168 {
1169 lexer.SetPos(save);
1170 }
1171 }
1172 *parentMatch5 = match;
1173 }
1174 *parentMatch4 = match;
1175 }
1176 *parentMatch3 = match;
1177 }
1178 if (match.hit)
1179 {
1180 soulng::parser::Match match(false);
1181 soulng::parser::Match* parentMatch7 = &match;
1182 {
1183 soulng::parser::Match match(false);
1184 if (*lexer == RBRACKET)
1185 {
1186 ++lexer;
1187 match.hit = true;
1188 }
1189 *parentMatch7 = match;
1190 }
1191 *parentMatch3 = match;
1192 }
1193 *parentMatch2 = match;
1194 if (!match.hit)
1195 {
1196 soulng::parser::Match match(false);
1197 soulng::parser::Match* parentMatch8 = &match;
1198 lexer.SetPos(save);
1199 {
1200 soulng::parser::Match match(false);
1201 soulng::parser::Match* parentMatch9 = &match;
1202 {
1203 soulng::parser::Match match(false);
1204 soulng::parser::Match* parentMatch10 = &match;
1205 {
1206 soulng::parser::Match match(false);
1207 if (*lexer == LPAREN)
1208 {
1209 ++lexer;
1210 match.hit = true;
1211 }
1212 *parentMatch10 = match;
1213 }
1214 if (match.hit)
1215 {
1216 soulng::parser::Match match(false);
1217 soulng::parser::Match* parentMatch11 = &match;
1218 {
1219 soulng::parser::Match match = LexerDeclaratorParser::AbstractDeclarator(lexer);
1220 abstractDeclarator.reset(static_cast<soulng::parser::soulng::parser::Value<std::u32string>*>(match.value));
1221 *parentMatch11 = match;
1222 }
1223 *parentMatch10 = match;
1224 }
1225 *parentMatch9 = match;
1226 }
1227 if (match.hit)
1228 {
1229 soulng::parser::Match match(false);
1230 soulng::parser::Match* parentMatch12 = &match;
1231 {
1232 soulng::parser::Match match(false);
1233 if (*lexer == RPAREN)
1234 {
1235 ++lexer;
1236 match.hit = true;
1237 }
1238 *parentMatch12 = match;
1239 }
1240 *parentMatch9 = match;
1241 }
1242 *parentMatch8 = match;
1243 }
1244 *parentMatch2 = match;
1245 }
1246 }
1247 *parentMatch1 = match;
1248 }
1249 *parentMatch0 = match;
1250 }
1251 if (match.hit)
1252 {
1253 soulng::parser::Match match(true);
1254 soulng::parser::Match* parentMatch13 = &match;
1255 while (true)
1256 {
1257 int64_t save = lexer.GetPos();
1258 {
1259 soulng::parser::Match match(false);
1260 soulng::parser::Match* parentMatch14 = &match;
1261 {
1262 soulng::parser::Match match(false);
1263 soulng::parser::Match* parentMatch15 = &match;
1264 {
1265 int64_t save = lexer.GetPos();
1266 soulng::parser::Match match(false);
1267 soulng::parser::Match* parentMatch16 = &match;
1268 {
1269 soulng::parser::Match match(false);
1270 soulng::parser::Match* parentMatch17 = &match;
1271 {
1272 soulng::parser::Match match(false);
1273 if (*lexer == LBRACKET)
1274 {
1275 ++lexer;
1276 match.hit = true;
1277 }
1278 *parentMatch17 = match;
1279 }
1280 if (match.hit)
1281 {
1282 soulng::parser::Match match(false);
1283 soulng::parser::Match* parentMatch18 = &match;
1284 {
1285 soulng::parser::Match match(true);
1286 int64_t save = lexer.GetPos();
1287 soulng::parser::Match* parentMatch19 = &match;
1288 {
1289 soulng::parser::Match match = LexerExpressionParser::ConstantExpression(lexer);
1290 expr.reset(static_cast<soulng::cppcode::CppObject*>(match.value));
1291 if (match.hit)
1292 {
1293 *parentMatch19 = match;
1294 }
1295 else
1296 {
1297 lexer.SetPos(save);
1298 }
1299 }
1300 *parentMatch18 = match;
1301 }
1302 *parentMatch17 = match;
1303 }
1304 *parentMatch16 = match;
1305 }
1306 if (match.hit)
1307 {
1308 soulng::parser::Match match(false);
1309 soulng::parser::Match* parentMatch20 = &match;
1310 {
1311 soulng::parser::Match match(false);
1312 if (*lexer == RBRACKET)
1313 {
1314 ++lexer;
1315 match.hit = true;
1316 }
1317 *parentMatch20 = match;
1318 }
1319 *parentMatch16 = match;
1320 }
1321 *parentMatch15 = match;
1322 if (!match.hit)
1323 {
1324 soulng::parser::Match match(false);
1325 soulng::parser::Match* parentMatch21 = &match;
1326 lexer.SetPos(save);
1327 {
1328 soulng::parser::Match match(false);
1329 soulng::parser::Match* parentMatch22 = &match;
1330 {
1331 soulng::parser::Match match(false);
1332 soulng::parser::Match* parentMatch23 = &match;
1333 {
1334 soulng::parser::Match match(false);
1335 if (*lexer == LPAREN)
1336 {
1337 ++lexer;
1338 match.hit = true;
1339 }
1340 *parentMatch23 = match;
1341 }
1342 if (match.hit)
1343 {
1344 soulng::parser::Match match(false);
1345 soulng::parser::Match* parentMatch24 = &match;
1346 {
1347 soulng::parser::Match match = LexerDeclaratorParser::AbstractDeclarator(lexer);
1348 abstractDeclarator.reset(static_cast<soulng::parser::soulng::parser::Value<std::u32string>*>(match.value));
1349 *parentMatch24 = match;
1350 }
1351 *parentMatch23 = match;
1352 }
1353 *parentMatch22 = match;
1354 }
1355 if (match.hit)
1356 {
1357 soulng::parser::Match match(false);
1358 soulng::parser::Match* parentMatch25 = &match;
1359 {
1360 soulng::parser::Match match(false);
1361 if (*lexer == RPAREN)
1362 {
1363 ++lexer;
1364 match.hit = true;
1365 }
1366 *parentMatch25 = match;
1367 }
1368 *parentMatch22 = match;
1369 }
1370 *parentMatch21 = match;
1371 }
1372 *parentMatch15 = match;
1373 }
1374 }
1375 *parentMatch14 = match;
1376 }
1377 if (match.hit)
1378 {
1379 *parentMatch13 = match;
1380 }
1381 else
1382 {
1383 lexer.SetPos(save);
1384 break;
1385 }
1386 }
1387 }
1388 }
1389 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1390
1391
1392
1393
1394
1395 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1396 if (!match.hit)
1397 {
1398 match.value = nullptr;
1399 }
1400 return match;
1401 }
1402
1403 soulng::parser::Match LexerDeclaratorParser::PtrOperator(LexerFileLexer& lexer)
1404 {
1405 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1406
1407
1408
1409
1410
1411
1412
1413 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1414 soulng::parser::Match match(false);
1415 soulng::parser::Match* parentMatch0 = &match;
1416 {
1417 int64_t save = lexer.GetPos();
1418 soulng::parser::Match match(false);
1419 soulng::parser::Match* parentMatch1 = &match;
1420 {
1421 soulng::parser::Match match(false);
1422 if (*lexer == STAR)
1423 {
1424 ++lexer;
1425 match.hit = true;
1426 }
1427 *parentMatch1 = match;
1428 }
1429 if (match.hit)
1430 {
1431 soulng::parser::Match match(false);
1432 soulng::parser::Match* parentMatch2 = &match;
1433 {
1434 soulng::parser::Match match(true);
1435 int64_t save = lexer.GetPos();
1436 soulng::parser::Match* parentMatch3 = &match;
1437 {
1438 soulng::parser::Match match = LexerDeclaratorParser::CVQualifierSeq(lexer);
1439 if (match.hit)
1440 {
1441 *parentMatch3 = match;
1442 }
1443 else
1444 {
1445 lexer.SetPos(save);
1446 }
1447 }
1448 *parentMatch2 = match;
1449 }
1450 *parentMatch1 = match;
1451 }
1452 *parentMatch0 = match;
1453 if (!match.hit)
1454 {
1455 soulng::parser::Match match(false);
1456 soulng::parser::Match* parentMatch4 = &match;
1457 lexer.SetPos(save);
1458 {
1459 soulng::parser::Match match(false);
1460 if (*lexer == AMP)
1461 {
1462 ++lexer;
1463 match.hit = true;
1464 }
1465 *parentMatch4 = match;
1466 }
1467 *parentMatch0 = match;
1468 }
1469 }
1470 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1471
1472
1473
1474
1475
1476 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1477 if (!match.hit)
1478 {
1479 match.value = nullptr;
1480 }
1481 return match;
1482 }
1483
1484 soulng::parser::Match LexerDeclaratorParser::CVQualifierSeq(LexerFileLexer& lexer)
1485 {
1486 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1487
1488
1489
1490
1491
1492
1493
1494 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1495 std::unique_ptr<soulng::cppcode::TypeSpecifier> cvQualifier;
1496 soulng::parser::Match match(false);
1497 soulng::parser::Match* parentMatch0 = &match;
1498 {
1499 soulng::parser::Match match = LexerDeclarationParser::CVQualifier(lexer);
1500 cvQualifier.reset(static_cast<soulng::cppcode::TypeSpecifier*>(match.value));
1501 *parentMatch0 = match;
1502 }
1503 if (match.hit)
1504 {
1505 soulng::parser::Match match(true);
1506 soulng::parser::Match* parentMatch1 = &match;
1507 while (true)
1508 {
1509 int64_t save = lexer.GetPos();
1510 {
1511 soulng::parser::Match match = LexerDeclarationParser::CVQualifier(lexer);
1512 cvQualifier.reset(static_cast<soulng::cppcode::TypeSpecifier*>(match.value));
1513 if (match.hit)
1514 {
1515 *parentMatch1 = match;
1516 }
1517 else
1518 {
1519 lexer.SetPos(save);
1520 break;
1521 }
1522 }
1523 }
1524 }
1525 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1526
1527
1528
1529
1530
1531 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1532 if (!match.hit)
1533 {
1534 match.value = nullptr;
1535 }
1536 return match;
1537 }
1538
1539 soulng::parser::Match LexerDeclaratorParser::Initializer(LexerFileLexer& lexer)
1540 {
1541 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1542
1543
1544
1545
1546
1547
1548
1549 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1550 std::unique_ptr<soulng::cppcode::Initializer> initializer = std::unique_ptr<soulng::cppcode::Initializer>();
1551 std::unique_ptr<soulng::cppcode::AssignInit> initializerClause;
1552 soulng::parser::Match match(false);
1553 soulng::parser::Match* parentMatch0 = &match;
1554 {
1555 int64_t pos = lexer.GetPos();
1556 soulng::parser::Match match(false);
1557 soulng::parser::Match* parentMatch1 = &match;
1558 {
1559 soulng::parser::Match match(false);
1560 soulng::parser::Match* parentMatch2 = &match;
1561 {
1562 int64_t save = lexer.GetPos();
1563 soulng::parser::Match match(false);
1564 soulng::parser::Match* parentMatch3 = &match;
1565 {
1566 soulng::parser::Match match(false);
1567 if (*lexer == ASSIGN)
1568 {
1569 ++lexer;
1570 match.hit = true;
1571 }
1572 *parentMatch3 = match;
1573 }
1574 if (match.hit)
1575 {
1576 soulng::parser::Match match(false);
1577 soulng::parser::Match* parentMatch4 = &match;
1578 {
1579 soulng::parser::Match match(false);
1580 soulng::parser::Match* parentMatch5 = &match;
1581 {
1582 int64_t pos = lexer.GetPos();
1583 soulng::parser::Match match = LexerDeclaratorParser::InitializerClause(lexer);
1584 initializerClause.reset(static_cast<soulng::cppcode::AssignInit*>(match.value));
1585 if (match.hit)
1586 {
1587 initializer.reset(new soulng::cppcode::Initializer(initializerClause.release()));
1588 }
1589 *parentMatch5 = match;
1590 }
1591 *parentMatch4 = match;
1592 }
1593 *parentMatch3 = match;
1594 }
1595 *parentMatch2 = match;
1596 if (!match.hit)
1597 {
1598 soulng::parser::Match match(false);
1599 soulng::parser::Match* parentMatch6 = &match;
1600 lexer.SetPos(save);
1601 {
1602 soulng::parser::Match match(false);
1603 soulng::parser::Match* parentMatch7 = &match;
1604 {
1605 soulng::parser::Match match(false);
1606 soulng::parser::Match* parentMatch8 = &match;
1607 {
1608 soulng::parser::Match match(false);
1609 soulng::parser::Match* parentMatch9 = &match;
1610 {
1611 int64_t pos = lexer.GetPos();
1612 soulng::parser::Match match(false);
1613 if (*lexer == LPAREN)
1614 {
1615 ++lexer;
1616 match.hit = true;
1617 }
1618 if (match.hit)
1619 {
1620 initializer.reset(new soulng::cppcode::Initializer(nullptr));
1621 }
1622 *parentMatch9 = match;
1623 }
1624 *parentMatch8 = match;
1625 }
1626 if (match.hit)
1627 {
1628 soulng::parser::Match match(false);
1629 soulng::parser::Match* parentMatch10 = &match;
1630 {
1631 soulng::parser::Match match = LexerExpressionParser::ExpressionList(lexer, initializer.get());
1632 *parentMatch10 = match;
1633 }
1634 *parentMatch8 = match;
1635 }
1636 *parentMatch7 = match;
1637 }
1638 if (match.hit)
1639 {
1640 soulng::parser::Match match(false);
1641 soulng::parser::Match* parentMatch11 = &match;
1642 {
1643 soulng::parser::Match match(false);
1644 if (*lexer == RPAREN)
1645 {
1646 ++lexer;
1647 match.hit = true;
1648 }
1649 *parentMatch11 = match;
1650 }
1651 *parentMatch7 = match;
1652 }
1653 *parentMatch6 = match;
1654 }
1655 *parentMatch2 = match;
1656 }
1657 }
1658 *parentMatch1 = match;
1659 }
1660 if (match.hit)
1661 {
1662 {
1663 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1664
1665 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1666 return soulng::parser::Match(true, initializer.release());
1667 }
1668 }
1669 *parentMatch0 = match;
1670 }
1671 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1672
1673
1674
1675
1676
1677 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1678 if (!match.hit)
1679 {
1680 match.value = nullptr;
1681 }
1682 return match;
1683 }
1684
1685 soulng::parser::Match LexerDeclaratorParser::InitializerClause(LexerFileLexer& lexer)
1686 {
1687 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1688
1689
1690
1691
1692
1693
1694
1695 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1696 std::unique_ptr<soulng::cppcode::AssignInit> assignInit = std::unique_ptr<soulng::cppcode::AssignInit>();
1697 std::unique_ptr<soulng::cppcode::CppObject> expr;
1698 soulng::parser::Match match(false);
1699 soulng::parser::Match* parentMatch0 = &match;
1700 {
1701 int64_t pos = lexer.GetPos();
1702 soulng::parser::Match match(false);
1703 soulng::parser::Match* parentMatch1 = &match;
1704 {
1705 soulng::parser::Match match(false);
1706 soulng::parser::Match* parentMatch2 = &match;
1707 {
1708 int64_t save = lexer.GetPos();
1709 soulng::parser::Match match(false);
1710 soulng::parser::Match* parentMatch3 = &match;
1711 {
1712 int64_t save = lexer.GetPos();
1713 soulng::parser::Match match(false);
1714 soulng::parser::Match* parentMatch4 = &match;
1715 {
1716 int64_t pos = lexer.GetPos();
1717 soulng::parser::Match match = LexerExpressionParser::AssignmentExpression(lexer);
1718 expr.reset(static_cast<soulng::cppcode::CppObject*>(match.value));
1719 if (match.hit)
1720 {
1721 assignInit.reset(new soulng::cppcode::AssignInit(expr.release()));
1722 }
1723 *parentMatch4 = match;
1724 }
1725 *parentMatch3 = match;
1726 if (!match.hit)
1727 {
1728 soulng::parser::Match match(false);
1729 soulng::parser::Match* parentMatch5 = &match;
1730 lexer.SetPos(save);
1731 {
1732 soulng::parser::Match match(false);
1733 soulng::parser::Match* parentMatch6 = &match;
1734 {
1735 soulng::parser::Match match(false);
1736 soulng::parser::Match* parentMatch7 = &match;
1737 {
1738 soulng::parser::Match match(false);
1739 soulng::parser::Match* parentMatch8 = &match;
1740 {
1741 int64_t pos = lexer.GetPos();
1742 soulng::parser::Match match(false);
1743 if (*lexer == LBRACE)
1744 {
1745 ++lexer;
1746 match.hit = true;
1747 }
1748 if (match.hit)
1749 {
1750 assignInit.reset(new soulng::cppcode::AssignInit(nullptr));
1751 }
1752 *parentMatch8 = match;
1753 }
1754 *parentMatch7 = match;
1755 }
1756 if (match.hit)
1757 {
1758 soulng::parser::Match match(false);
1759 soulng::parser::Match* parentMatch9 = &match;
1760 {
1761 soulng::parser::Match match = LexerDeclaratorParser::InitializerList(lexer, assignInit.get());
1762 *parentMatch9 = match;
1763 }
1764 *parentMatch7 = match;
1765 }
1766 *parentMatch6 = match;
1767 }
1768 if (match.hit)
1769 {
1770 soulng::parser::Match match(false);
1771 soulng::parser::Match* parentMatch10 = &match;
1772 {
1773 soulng::parser::Match match(false);
1774 if (*lexer == RBRACE)
1775 {
1776 ++lexer;
1777 match.hit = true;
1778 }
1779 *parentMatch10 = match;
1780 }
1781 *parentMatch6 = match;
1782 }
1783 *parentMatch5 = match;
1784 }
1785 *parentMatch3 = match;
1786 }
1787 }
1788 *parentMatch2 = match;
1789 if (!match.hit)
1790 {
1791 soulng::parser::Match match(false);
1792 soulng::parser::Match* parentMatch11 = &match;
1793 lexer.SetPos(save);
1794 {
1795 soulng::parser::Match match(false);
1796 soulng::parser::Match* parentMatch12 = &match;
1797 {
1798 soulng::parser::Match match(false);
1799 if (*lexer == LBRACE)
1800 {
1801 ++lexer;
1802 match.hit = true;
1803 }
1804 *parentMatch12 = match;
1805 }
1806 if (match.hit)
1807 {
1808 soulng::parser::Match match(false);
1809 soulng::parser::Match* parentMatch13 = &match;
1810 {
1811 soulng::parser::Match match(false);
1812 soulng::parser::Match* parentMatch14 = &match;
1813 {
1814 int64_t pos = lexer.GetPos();
1815 soulng::parser::Match match(false);
1816 if (*lexer == RBRACE)
1817 {
1818 ++lexer;
1819 match.hit = true;
1820 }
1821 if (match.hit)
1822 {
1823 assignInit.reset(new soulng::cppcode::AssignInit(nullptr));
1824 }
1825 *parentMatch14 = match;
1826 }
1827 *parentMatch13 = match;
1828 }
1829 *parentMatch12 = match;
1830 }
1831 *parentMatch11 = match;
1832 }
1833 *parentMatch2 = match;
1834 }
1835 }
1836 *parentMatch1 = match;
1837 }
1838 if (match.hit)
1839 {
1840 {
1841 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1842
1843 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1844 return soulng::parser::Match(true, assignInit.release());
1845 }
1846 }
1847 *parentMatch0 = match;
1848 }
1849 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1850
1851
1852
1853
1854
1855 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1856 if (!match.hit)
1857 {
1858 match.value = nullptr;
1859 }
1860 return match;
1861 }
1862
1863 soulng::parser::Match LexerDeclaratorParser::InitializerList(LexerFileLexer& lexer, soulng::cppcode::AssignInit* init)
1864 {
1865 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1866
1867
1868
1869
1870
1871
1872
1873 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1874 std::unique_ptr<soulng::cppcode::AssignInit> initializerClause;
1875 soulng::parser::Match match(false);
1876 soulng::parser::Match* parentMatch0 = &match;
1877 {
1878 soulng::parser::Match match(false);
1879 soulng::parser::Match* parentMatch1 = &match;
1880 {
1881 int64_t pos = lexer.GetPos();
1882 soulng::parser::Match match = LexerDeclaratorParser::InitializerClause(lexer);
1883 initializerClause.reset(static_cast<soulng::cppcode::AssignInit*>(match.value));
1884 if (match.hit)
1885 {
1886 init->Add(initializerClause.release());
1887 }
1888 *parentMatch1 = match;
1889 }
1890 *parentMatch0 = match;
1891 }
1892 if (match.hit)
1893 {
1894 soulng::parser::Match match(false);
1895 soulng::parser::Match* parentMatch2 = &match;
1896 {
1897 soulng::parser::Match match(true);
1898 soulng::parser::Match* parentMatch3 = &match;
1899 {
1900 while (true)
1901 {
1902 int64_t save = lexer.GetPos();
1903 {
1904 soulng::parser::Match match(false);
1905 soulng::parser::Match* parentMatch4 = &match;
1906 {
1907 soulng::parser::Match match(false);
1908 if (*lexer == COMMA)
1909 {
1910 ++lexer;
1911 match.hit = true;
1912 }
1913 *parentMatch4 = match;
1914 }
1915 if (match.hit)
1916 {
1917 soulng::parser::Match match(false);
1918 soulng::parser::Match* parentMatch5 = &match;
1919 {
1920 soulng::parser::Match match(false);
1921 soulng::parser::Match* parentMatch6 = &match;
1922 {
1923 int64_t pos = lexer.GetPos();
1924 soulng::parser::Match match = LexerDeclaratorParser::InitializerClause(lexer);
1925 initializerClause.reset(static_cast<soulng::cppcode::AssignInit*>(match.value));
1926 if (match.hit)
1927 {
1928 init->Add(initializerClause.release());
1929 }
1930 *parentMatch6 = match;
1931 }
1932 *parentMatch5 = match;
1933 }
1934 *parentMatch4 = match;
1935 }
1936 if (match.hit)
1937 {
1938 *parentMatch3 = match;
1939 }
1940 else
1941 {
1942 lexer.SetPos(save);
1943 break;
1944 }
1945 }
1946 }
1947 }
1948 *parentMatch2 = match;
1949 }
1950 *parentMatch0 = match;
1951 }
1952 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1953
1954
1955
1956
1957
1958 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1959 if (!match.hit)
1960 {
1961 match.value = nullptr;
1962 }
1963 return match;
1964 }