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