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