1 #include "ProjectFile.hpp"
2 #include <soulng/util/Unicode.hpp>
3 #include <sngcm/cmlexer/ContainerFileLexer.hpp>
4 #include <sngcm/cmlexer/ContainerFileTokens.hpp>
5
6
7
8 using namespace soulng::unicode;
9 using namespace sngcm::ast;
10 using namespace ContainerFileTokens;
11
12 std::std::unique_ptr<sngcm::ast::Project>ProjectFileParser::Parse(ContainerFileLexer&lexer, std::stringconfig, sngcm::ast::BackEndbackend, std::stringtoolChain, sngcm::ast::SystemDirKind systemDirKind)
13 {
14 std::unique_ptr<sngcm::ast::Project> value;
15 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
16
17
18
19
20
21 #endif // SOULNG_PARSER_DEBUG_SUPPORT
22 ++lexer;
23 soulng::lexer::Span span = lexer.GetSpan();
24 soulng::parser::Match match = ProjectFileParser::ProjectFile(lexer, config, backend, toolChain, systemDirKind);
25 value.reset(static_cast<sngcm::ast::Project*>(match.value));
26 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
27
28
29
30
31
32 #endif // SOULNG_PARSER_DEBUG_SUPPORT
33 if (match.hit)
34 {
35 if (*lexer == soulng::lexer::END_TOKEN)
36 {
37 return value;
38 }
39 else
40 {
41 lexer.ThrowExpectationFailure(lexer.GetSpan(), ToUtf32(soulng::lexer::GetEndTokenInfo()));
42 }
43 }
44 else
45 {
46 lexer.ThrowExpectationFailure(span, U"project file");
47 }
48 return value;
49 }
50
51 soulng::parser::Match ProjectFileParser::ProjectFile(ContainerFileLexer& lexer, std::string config, sngcm::ast::BackEnd backend, std::string toolChain, sngcm::ast::SystemDirKind systemDirKind)
52 {
53 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
54
55
56
57
58
59
60
61 #endif // SOULNG_PARSER_DEBUG_SUPPORT
62 std::unique_ptr<Project> project = std::unique_ptr<Project>();
63 std::unique_ptr<soulng::parser::soulng::parser::Value<std::u32string>>name;
64 std::unique_ptr<ProjectDeclaration> declaration;
65 soulng::parser::Match match(false);
66 soulng::parser::Match* parentMatch0 = &match;
67 {
68 int64_t pos = lexer.GetPos();
69 soulng::parser::Match match(false);
70 soulng::parser::Match* parentMatch1 = &match;
71 {
72 soulng::parser::Match match(false);
73 soulng::parser::Match* parentMatch2 = &match;
74 {
75 soulng::parser::Match match(false);
76 soulng::parser::Match* parentMatch3 = &match;
77 {
78 soulng::parser::Match match(false);
79 soulng::parser::Match* parentMatch4 = &match;
80 {
81 soulng::parser::Match match(false);
82 if (*lexer == PROJECT)
83 {
84 ++lexer;
85 match.hit = true;
86 }
87 *parentMatch4 = match;
88 }
89 if (match.hit)
90 {
91 soulng::parser::Match match(false);
92 soulng::parser::Match* parentMatch5 = &match;
93 {
94 soulng::parser::Match match(true);
95 soulng::parser::Match* parentMatch6 = &match;
96 {
97 soulng::lexer::Span span = lexer.GetSpan();
98 soulng::parser::Match match = ProjectFileParser::QualifiedId(lexer);
99 name.reset(static_cast<soulng::parser::soulng::parser::Value<std::u32string>*>(match.value));
100 if (match.hit)
101 {
102 *parentMatch6 = match;
103 }
104 else
105 {
106 lexer.ThrowExpectationFailure(span, U"identifier");
107 }
108 }
109 *parentMatch5 = match;
110 }
111 *parentMatch4 = match;
112 }
113 *parentMatch3 = match;
114 }
115 if (match.hit)
116 {
117 soulng::parser::Match match(false);
118 soulng::parser::Match* parentMatch7 = &match;
119 {
120 soulng::parser::Match match(false);
121 soulng::parser::Match* parentMatch8 = &match;
122 {
123 int64_t pos = lexer.GetPos();
124 soulng::parser::Match match(true);
125 soulng::parser::Match* parentMatch9 = &match;
126 {
127 soulng::lexer::Span span = lexer.GetSpan();
128 soulng::parser::Match match(false);
129 if (*lexer == SEMICOLON)
130 {
131 ++lexer;
132 match.hit = true;
133 }
134 if (match.hit)
135 {
136 *parentMatch9 = match;
137 }
138 else
139 {
140 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
141 }
142 }
143 if (match.hit)
144 {
145 project.reset(new Project(name->value, lexer.FileName(), config, backend, toolChain, systemDirKind));
146 }
147 *parentMatch8 = match;
148 }
149 *parentMatch7 = match;
150 }
151 *parentMatch3 = match;
152 }
153 *parentMatch2 = match;
154 }
155 if (match.hit)
156 {
157 soulng::parser::Match match(false);
158 soulng::parser::Match* parentMatch10 = &match;
159 {
160 soulng::parser::Match match(true);
161 soulng::parser::Match* parentMatch11 = &match;
162 {
163 while (true)
164 {
165 int64_t save = lexer.GetPos();
166 {
167 soulng::parser::Match match(false);
168 soulng::parser::Match* parentMatch12 = &match;
169 {
170 soulng::parser::Match match(false);
171 soulng::parser::Match* parentMatch13 = &match;
172 {
173 int64_t pos = lexer.GetPos();
174 soulng::parser::Match match = ProjectFileParser::Declaration(lexer);
175 declaration.reset(static_cast<ProjectDeclaration*>(match.value));
176 if (match.hit)
177 {
178 project->AddDeclaration(declaration.release());
179 }
180 *parentMatch13 = match;
181 }
182 *parentMatch12 = match;
183 }
184 if (match.hit)
185 {
186 *parentMatch11 = match;
187 }
188 else
189 {
190 lexer.SetPos(save);
191 break;
192 }
193 }
194 }
195 }
196 *parentMatch10 = match;
197 }
198 *parentMatch2 = match;
199 }
200 *parentMatch1 = match;
201 }
202 if (match.hit)
203 {
204 {
205 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
206
207 #endif // SOULNG_PARSER_DEBUG_SUPPORT
208 return soulng::parser::Match(true, project.release());
209 }
210 }
211 *parentMatch0 = match;
212 }
213 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
214
215
216
217
218
219 #endif // SOULNG_PARSER_DEBUG_SUPPORT
220 if (!match.hit)
221 {
222 match.value = nullptr;
223 }
224 return match;
225 }
226
227 soulng::parser::Match ProjectFileParser::QualifiedId(ContainerFileLexer& lexer)
228 {
229 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
230
231
232
233
234
235
236
237 #endif // SOULNG_PARSER_DEBUG_SUPPORT
238 Span s = Span();
239 soulng::parser::Match match(false);
240 soulng::parser::Match* parentMatch0 = &match;
241 {
242 int64_t pos = lexer.GetPos();
243 soulng::parser::Match match(false);
244 soulng::parser::Match* parentMatch1 = &match;
245 {
246 soulng::parser::Match match(false);
247 soulng::parser::Match* parentMatch2 = &match;
248 {
249 soulng::parser::Match match(false);
250 soulng::parser::Match* parentMatch3 = &match;
251 {
252 int64_t pos = lexer.GetPos();
253 soulng::lexer::Span span = lexer.GetSpan();
254 soulng::parser::Match match(false);
255 if (*lexer == ID)
256 {
257 ++lexer;
258 match.hit = true;
259 }
260 if (match.hit)
261 {
262 s = span;
263 }
264 *parentMatch3 = match;
265 }
266 *parentMatch2 = match;
267 }
268 if (match.hit)
269 {
270 soulng::parser::Match match(false);
271 soulng::parser::Match* parentMatch4 = &match;
272 {
273 soulng::parser::Match match(true);
274 soulng::parser::Match* parentMatch5 = &match;
275 {
276 while (true)
277 {
278 int64_t save = lexer.GetPos();
279 {
280 soulng::parser::Match match(false);
281 soulng::parser::Match* parentMatch6 = &match;
282 {
283 soulng::parser::Match match(false);
284 soulng::parser::Match* parentMatch7 = &match;
285 {
286 soulng::parser::Match match(false);
287 if (*lexer == DOT)
288 {
289 ++lexer;
290 match.hit = true;
291 }
292 *parentMatch7 = match;
293 }
294 if (match.hit)
295 {
296 soulng::parser::Match match(false);
297 soulng::parser::Match* parentMatch8 = &match;
298 {
299 soulng::parser::Match match(false);
300 soulng::parser::Match* parentMatch9 = &match;
301 {
302 int64_t pos = lexer.GetPos();
303 soulng::lexer::Span span = lexer.GetSpan();
304 soulng::parser::Match match(false);
305 if (*lexer == ID)
306 {
307 ++lexer;
308 match.hit = true;
309 }
310 if (match.hit)
311 {
312 s.end = span.end;
313 }
314 *parentMatch9 = match;
315 }
316 *parentMatch8 = match;
317 }
318 *parentMatch7 = match;
319 }
320 *parentMatch6 = match;
321 }
322 if (match.hit)
323 {
324 *parentMatch5 = match;
325 }
326 else
327 {
328 lexer.SetPos(save);
329 break;
330 }
331 }
332 }
333 }
334 *parentMatch4 = match;
335 }
336 *parentMatch2 = match;
337 }
338 *parentMatch1 = match;
339 }
340 if (match.hit)
341 {
342 {
343 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
344
345 #endif // SOULNG_PARSER_DEBUG_SUPPORT
346 return soulng::parser::Match(true, new soulng::parser::Value<std::u32string>(lexer.GetMatch(s)));
347 }
348 }
349 *parentMatch0 = match;
350 }
351 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
352
353
354
355
356
357 #endif // SOULNG_PARSER_DEBUG_SUPPORT
358 if (!match.hit)
359 {
360 match.value = nullptr;
361 }
362 return match;
363 }
364
365 soulng::parser::Match ProjectFileParser::Declaration(ContainerFileLexer& lexer)
366 {
367 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
368
369
370
371
372
373
374
375 #endif // SOULNG_PARSER_DEBUG_SUPPORT
376 std::unique_ptr<ProjectDeclaration> referenceDeclaration;
377 std::unique_ptr<ProjectDeclaration> sourceFileDeclaration;
378 std::unique_ptr<ProjectDeclaration> resourceFileDeclaration;
379 std::unique_ptr<ProjectDeclaration> textFileDeclaration;
380 std::unique_ptr<ProjectDeclaration> targetDeclaration;
381 soulng::parser::Match match(false);
382 soulng::parser::Match* parentMatch0 = &match;
383 {
384 int64_t save = lexer.GetPos();
385 soulng::parser::Match match(false);
386 soulng::parser::Match* parentMatch1 = &match;
387 {
388 int64_t save = lexer.GetPos();
389 soulng::parser::Match match(false);
390 soulng::parser::Match* parentMatch2 = &match;
391 {
392 int64_t save = lexer.GetPos();
393 soulng::parser::Match match(false);
394 soulng::parser::Match* parentMatch3 = &match;
395 {
396 int64_t save = lexer.GetPos();
397 soulng::parser::Match match(false);
398 soulng::parser::Match* parentMatch4 = &match;
399 {
400 int64_t pos = lexer.GetPos();
401 soulng::parser::Match match = ProjectFileParser::ReferenceDeclaration(lexer);
402 referenceDeclaration.reset(static_cast<ProjectDeclaration*>(match.value));
403 if (match.hit)
404 {
405 {
406 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
407
408 #endif // SOULNG_PARSER_DEBUG_SUPPORT
409 return soulng::parser::Match(true, referenceDeclaration.release());
410 }
411 }
412 *parentMatch4 = match;
413 }
414 *parentMatch3 = match;
415 if (!match.hit)
416 {
417 soulng::parser::Match match(false);
418 soulng::parser::Match* parentMatch5 = &match;
419 lexer.SetPos(save);
420 {
421 soulng::parser::Match match(false);
422 soulng::parser::Match* parentMatch6 = &match;
423 {
424 int64_t pos = lexer.GetPos();
425 soulng::parser::Match match = ProjectFileParser::SourceFileDeclaration(lexer);
426 sourceFileDeclaration.reset(static_cast<ProjectDeclaration*>(match.value));
427 if (match.hit)
428 {
429 {
430 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
431
432 #endif // SOULNG_PARSER_DEBUG_SUPPORT
433 return soulng::parser::Match(true, sourceFileDeclaration.release());
434 }
435 }
436 *parentMatch6 = match;
437 }
438 *parentMatch5 = match;
439 }
440 *parentMatch3 = match;
441 }
442 }
443 *parentMatch2 = match;
444 if (!match.hit)
445 {
446 soulng::parser::Match match(false);
447 soulng::parser::Match* parentMatch7 = &match;
448 lexer.SetPos(save);
449 {
450 soulng::parser::Match match(false);
451 soulng::parser::Match* parentMatch8 = &match;
452 {
453 int64_t pos = lexer.GetPos();
454 soulng::parser::Match match = ProjectFileParser::ResourceFileDeclaration(lexer);
455 resourceFileDeclaration.reset(static_cast<ProjectDeclaration*>(match.value));
456 if (match.hit)
457 {
458 {
459 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
460
461 #endif // SOULNG_PARSER_DEBUG_SUPPORT
462 return soulng::parser::Match(true, resourceFileDeclaration.release());
463 }
464 }
465 *parentMatch8 = match;
466 }
467 *parentMatch7 = match;
468 }
469 *parentMatch2 = match;
470 }
471 }
472 *parentMatch1 = match;
473 if (!match.hit)
474 {
475 soulng::parser::Match match(false);
476 soulng::parser::Match* parentMatch9 = &match;
477 lexer.SetPos(save);
478 {
479 soulng::parser::Match match(false);
480 soulng::parser::Match* parentMatch10 = &match;
481 {
482 int64_t pos = lexer.GetPos();
483 soulng::parser::Match match = ProjectFileParser::TextFileDeclaration(lexer);
484 textFileDeclaration.reset(static_cast<ProjectDeclaration*>(match.value));
485 if (match.hit)
486 {
487 {
488 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
489
490 #endif // SOULNG_PARSER_DEBUG_SUPPORT
491 return soulng::parser::Match(true, textFileDeclaration.release());
492 }
493 }
494 *parentMatch10 = match;
495 }
496 *parentMatch9 = match;
497 }
498 *parentMatch1 = match;
499 }
500 }
501 *parentMatch0 = match;
502 if (!match.hit)
503 {
504 soulng::parser::Match match(false);
505 soulng::parser::Match* parentMatch11 = &match;
506 lexer.SetPos(save);
507 {
508 soulng::parser::Match match(false);
509 soulng::parser::Match* parentMatch12 = &match;
510 {
511 int64_t pos = lexer.GetPos();
512 soulng::parser::Match match = ProjectFileParser::TargetDeclaration(lexer);
513 targetDeclaration.reset(static_cast<ProjectDeclaration*>(match.value));
514 if (match.hit)
515 {
516 {
517 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
518
519 #endif // SOULNG_PARSER_DEBUG_SUPPORT
520 return soulng::parser::Match(true, targetDeclaration.release());
521 }
522 }
523 *parentMatch12 = match;
524 }
525 *parentMatch11 = match;
526 }
527 *parentMatch0 = match;
528 }
529 }
530 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
531
532
533
534
535
536 #endif // SOULNG_PARSER_DEBUG_SUPPORT
537 if (!match.hit)
538 {
539 match.value = nullptr;
540 }
541 return match;
542 }
543
544 soulng::parser::Match ProjectFileParser::ReferenceDeclaration(ContainerFileLexer& lexer)
545 {
546 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
547
548
549
550
551
552
553
554 #endif // SOULNG_PARSER_DEBUG_SUPPORT
555 std::string filePath = std::string();
556 soulng::parser::Match match(false);
557 soulng::parser::Match* parentMatch0 = &match;
558 {
559 soulng::parser::Match match(false);
560 soulng::parser::Match* parentMatch1 = &match;
561 {
562 soulng::parser::Match match(false);
563 if (*lexer == REFERENCE)
564 {
565 ++lexer;
566 match.hit = true;
567 }
568 *parentMatch1 = match;
569 }
570 if (match.hit)
571 {
572 soulng::parser::Match match(false);
573 soulng::parser::Match* parentMatch2 = &match;
574 {
575 soulng::parser::Match match(false);
576 soulng::parser::Match* parentMatch3 = &match;
577 {
578 int64_t pos = lexer.GetPos();
579 soulng::parser::Match match(true);
580 soulng::parser::Match* parentMatch4 = &match;
581 {
582 soulng::lexer::Span span = lexer.GetSpan();
583 soulng::parser::Match match(false);
584 if (*lexer == FILEPATH)
585 {
586 ++lexer;
587 match.hit = true;
588 }
589 if (match.hit)
590 {
591 *parentMatch4 = match;
592 }
593 else
594 {
595 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(FILEPATH)));
596 }
597 }
598 if (match.hit)
599 {
600 filePath = lexer.filePath;
601 }
602 *parentMatch3 = match;
603 }
604 *parentMatch2 = match;
605 }
606 *parentMatch1 = match;
607 }
608 *parentMatch0 = match;
609 }
610 if (match.hit)
611 {
612 soulng::parser::Match match(false);
613 soulng::parser::Match* parentMatch5 = &match;
614 {
615 soulng::parser::Match match(false);
616 soulng::parser::Match* parentMatch6 = &match;
617 {
618 int64_t pos = lexer.GetPos();
619 soulng::parser::Match match(true);
620 soulng::parser::Match* parentMatch7 = &match;
621 {
622 soulng::lexer::Span span = lexer.GetSpan();
623 soulng::parser::Match match(false);
624 if (*lexer == SEMICOLON)
625 {
626 ++lexer;
627 match.hit = true;
628 }
629 if (match.hit)
630 {
631 *parentMatch7 = match;
632 }
633 else
634 {
635 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
636 }
637 }
638 if (match.hit)
639 {
640 {
641 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
642
643 #endif // SOULNG_PARSER_DEBUG_SUPPORT
644 return soulng::parser::Match(true, new sngcm::ast::ReferenceDeclaration(filePath));
645 }
646 }
647 *parentMatch6 = match;
648 }
649 *parentMatch5 = match;
650 }
651 *parentMatch0 = match;
652 }
653 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
654
655
656
657
658
659 #endif // SOULNG_PARSER_DEBUG_SUPPORT
660 if (!match.hit)
661 {
662 match.value = nullptr;
663 }
664 return match;
665 }
666
667 soulng::parser::Match ProjectFileParser::SourceFileDeclaration(ContainerFileLexer& lexer)
668 {
669 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
670
671
672
673
674
675
676
677 #endif // SOULNG_PARSER_DEBUG_SUPPORT
678 std::string filePath = std::string();
679 soulng::parser::Match match(false);
680 soulng::parser::Match* parentMatch0 = &match;
681 {
682 soulng::parser::Match match(false);
683 soulng::parser::Match* parentMatch1 = &match;
684 {
685 soulng::parser::Match match(false);
686 if (*lexer == SOURCE)
687 {
688 ++lexer;
689 match.hit = true;
690 }
691 *parentMatch1 = match;
692 }
693 if (match.hit)
694 {
695 soulng::parser::Match match(false);
696 soulng::parser::Match* parentMatch2 = &match;
697 {
698 soulng::parser::Match match(false);
699 soulng::parser::Match* parentMatch3 = &match;
700 {
701 int64_t pos = lexer.GetPos();
702 soulng::parser::Match match(true);
703 soulng::parser::Match* parentMatch4 = &match;
704 {
705 soulng::lexer::Span span = lexer.GetSpan();
706 soulng::parser::Match match(false);
707 if (*lexer == FILEPATH)
708 {
709 ++lexer;
710 match.hit = true;
711 }
712 if (match.hit)
713 {
714 *parentMatch4 = match;
715 }
716 else
717 {
718 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(FILEPATH)));
719 }
720 }
721 if (match.hit)
722 {
723 filePath = lexer.filePath;
724 }
725 *parentMatch3 = match;
726 }
727 *parentMatch2 = match;
728 }
729 *parentMatch1 = match;
730 }
731 *parentMatch0 = match;
732 }
733 if (match.hit)
734 {
735 soulng::parser::Match match(false);
736 soulng::parser::Match* parentMatch5 = &match;
737 {
738 soulng::parser::Match match(false);
739 soulng::parser::Match* parentMatch6 = &match;
740 {
741 int64_t pos = lexer.GetPos();
742 soulng::parser::Match match(true);
743 soulng::parser::Match* parentMatch7 = &match;
744 {
745 soulng::lexer::Span span = lexer.GetSpan();
746 soulng::parser::Match match(false);
747 if (*lexer == SEMICOLON)
748 {
749 ++lexer;
750 match.hit = true;
751 }
752 if (match.hit)
753 {
754 *parentMatch7 = match;
755 }
756 else
757 {
758 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
759 }
760 }
761 if (match.hit)
762 {
763 {
764 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
765
766 #endif // SOULNG_PARSER_DEBUG_SUPPORT
767 return soulng::parser::Match(true, new sngcm::ast::SourceFileDeclaration(filePath));
768 }
769 }
770 *parentMatch6 = match;
771 }
772 *parentMatch5 = match;
773 }
774 *parentMatch0 = match;
775 }
776 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
777
778
779
780
781
782 #endif // SOULNG_PARSER_DEBUG_SUPPORT
783 if (!match.hit)
784 {
785 match.value = nullptr;
786 }
787 return match;
788 }
789
790 soulng::parser::Match ProjectFileParser::ResourceFileDeclaration(ContainerFileLexer& lexer)
791 {
792 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
793
794
795
796
797
798
799
800 #endif // SOULNG_PARSER_DEBUG_SUPPORT
801 std::string filePath = std::string();
802 soulng::parser::Match match(false);
803 soulng::parser::Match* parentMatch0 = &match;
804 {
805 soulng::parser::Match match(false);
806 soulng::parser::Match* parentMatch1 = &match;
807 {
808 soulng::parser::Match match(false);
809 if (*lexer == RESOURCE)
810 {
811 ++lexer;
812 match.hit = true;
813 }
814 *parentMatch1 = match;
815 }
816 if (match.hit)
817 {
818 soulng::parser::Match match(false);
819 soulng::parser::Match* parentMatch2 = &match;
820 {
821 soulng::parser::Match match(false);
822 soulng::parser::Match* parentMatch3 = &match;
823 {
824 int64_t pos = lexer.GetPos();
825 soulng::parser::Match match(true);
826 soulng::parser::Match* parentMatch4 = &match;
827 {
828 soulng::lexer::Span span = lexer.GetSpan();
829 soulng::parser::Match match(false);
830 if (*lexer == FILEPATH)
831 {
832 ++lexer;
833 match.hit = true;
834 }
835 if (match.hit)
836 {
837 *parentMatch4 = match;
838 }
839 else
840 {
841 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(FILEPATH)));
842 }
843 }
844 if (match.hit)
845 {
846 filePath = lexer.filePath;
847 }
848 *parentMatch3 = match;
849 }
850 *parentMatch2 = match;
851 }
852 *parentMatch1 = match;
853 }
854 *parentMatch0 = match;
855 }
856 if (match.hit)
857 {
858 soulng::parser::Match match(false);
859 soulng::parser::Match* parentMatch5 = &match;
860 {
861 soulng::parser::Match match(false);
862 soulng::parser::Match* parentMatch6 = &match;
863 {
864 int64_t pos = lexer.GetPos();
865 soulng::parser::Match match(true);
866 soulng::parser::Match* parentMatch7 = &match;
867 {
868 soulng::lexer::Span span = lexer.GetSpan();
869 soulng::parser::Match match(false);
870 if (*lexer == SEMICOLON)
871 {
872 ++lexer;
873 match.hit = true;
874 }
875 if (match.hit)
876 {
877 *parentMatch7 = match;
878 }
879 else
880 {
881 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
882 }
883 }
884 if (match.hit)
885 {
886 {
887 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
888
889 #endif // SOULNG_PARSER_DEBUG_SUPPORT
890 return soulng::parser::Match(true, new sngcm::ast::ResourceFileDeclaration(filePath));
891 }
892 }
893 *parentMatch6 = match;
894 }
895 *parentMatch5 = match;
896 }
897 *parentMatch0 = match;
898 }
899 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
900
901
902
903
904
905 #endif // SOULNG_PARSER_DEBUG_SUPPORT
906 if (!match.hit)
907 {
908 match.value = nullptr;
909 }
910 return match;
911 }
912
913 soulng::parser::Match ProjectFileParser::TextFileDeclaration(ContainerFileLexer& lexer)
914 {
915 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
916
917
918
919
920
921
922
923 #endif // SOULNG_PARSER_DEBUG_SUPPORT
924 std::string filePath = std::string();
925 soulng::parser::Match match(false);
926 soulng::parser::Match* parentMatch0 = &match;
927 {
928 soulng::parser::Match match(false);
929 soulng::parser::Match* parentMatch1 = &match;
930 {
931 soulng::parser::Match match(false);
932 if (*lexer == TEXT)
933 {
934 ++lexer;
935 match.hit = true;
936 }
937 *parentMatch1 = match;
938 }
939 if (match.hit)
940 {
941 soulng::parser::Match match(false);
942 soulng::parser::Match* parentMatch2 = &match;
943 {
944 soulng::parser::Match match(false);
945 soulng::parser::Match* parentMatch3 = &match;
946 {
947 int64_t pos = lexer.GetPos();
948 soulng::parser::Match match(true);
949 soulng::parser::Match* parentMatch4 = &match;
950 {
951 soulng::lexer::Span span = lexer.GetSpan();
952 soulng::parser::Match match(false);
953 if (*lexer == FILEPATH)
954 {
955 ++lexer;
956 match.hit = true;
957 }
958 if (match.hit)
959 {
960 *parentMatch4 = match;
961 }
962 else
963 {
964 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(FILEPATH)));
965 }
966 }
967 if (match.hit)
968 {
969 filePath = lexer.filePath;
970 }
971 *parentMatch3 = match;
972 }
973 *parentMatch2 = match;
974 }
975 *parentMatch1 = match;
976 }
977 *parentMatch0 = match;
978 }
979 if (match.hit)
980 {
981 soulng::parser::Match match(false);
982 soulng::parser::Match* parentMatch5 = &match;
983 {
984 soulng::parser::Match match(false);
985 soulng::parser::Match* parentMatch6 = &match;
986 {
987 int64_t pos = lexer.GetPos();
988 soulng::parser::Match match(true);
989 soulng::parser::Match* parentMatch7 = &match;
990 {
991 soulng::lexer::Span span = lexer.GetSpan();
992 soulng::parser::Match match(false);
993 if (*lexer == SEMICOLON)
994 {
995 ++lexer;
996 match.hit = true;
997 }
998 if (match.hit)
999 {
1000 *parentMatch7 = match;
1001 }
1002 else
1003 {
1004 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
1005 }
1006 }
1007 if (match.hit)
1008 {
1009 {
1010 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1011
1012 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1013 return soulng::parser::Match(true, new sngcm::ast::TextFileDeclaration(filePath));
1014 }
1015 }
1016 *parentMatch6 = match;
1017 }
1018 *parentMatch5 = match;
1019 }
1020 *parentMatch0 = match;
1021 }
1022 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1023
1024
1025
1026
1027
1028 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1029 if (!match.hit)
1030 {
1031 match.value = nullptr;
1032 }
1033 return match;
1034 }
1035
1036 soulng::parser::Match ProjectFileParser::TargetDeclaration(ContainerFileLexer& lexer)
1037 {
1038 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1039
1040
1041
1042
1043
1044
1045
1046 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1047 std::unique_ptr<soulng::parser::soulng::parser::Value<sngcm::ast::Target>>target;
1048 soulng::parser::Match match(false);
1049 soulng::parser::Match* parentMatch0 = &match;
1050 {
1051 soulng::parser::Match match(false);
1052 soulng::parser::Match* parentMatch1 = &match;
1053 {
1054 soulng::parser::Match match(false);
1055 soulng::parser::Match* parentMatch2 = &match;
1056 {
1057 soulng::parser::Match match(false);
1058 if (*lexer == TARGET)
1059 {
1060 ++lexer;
1061 match.hit = true;
1062 }
1063 *parentMatch2 = match;
1064 }
1065 if (match.hit)
1066 {
1067 soulng::parser::Match match(false);
1068 soulng::parser::Match* parentMatch3 = &match;
1069 {
1070 soulng::parser::Match match(true);
1071 soulng::parser::Match* parentMatch4 = &match;
1072 {
1073 soulng::lexer::Span span = lexer.GetSpan();
1074 soulng::parser::Match match(false);
1075 if (*lexer == ASSIGN)
1076 {
1077 ++lexer;
1078 match.hit = true;
1079 }
1080 if (match.hit)
1081 {
1082 *parentMatch4 = match;
1083 }
1084 else
1085 {
1086 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(ASSIGN)));
1087 }
1088 }
1089 *parentMatch3 = match;
1090 }
1091 *parentMatch2 = match;
1092 }
1093 *parentMatch1 = match;
1094 }
1095 if (match.hit)
1096 {
1097 soulng::parser::Match match(false);
1098 soulng::parser::Match* parentMatch5 = &match;
1099 {
1100 soulng::parser::Match match(true);
1101 soulng::parser::Match* parentMatch6 = &match;
1102 {
1103 soulng::lexer::Span span = lexer.GetSpan();
1104 soulng::parser::Match match = ProjectFileParser::Target(lexer);
1105 target.reset(static_cast<soulng::parser::soulng::parser::Value<sngcm::ast::Target>*>(match.value));
1106 if (match.hit)
1107 {
1108 *parentMatch6 = match;
1109 }
1110 else
1111 {
1112 lexer.ThrowExpectationFailure(span, U"target");
1113 }
1114 }
1115 *parentMatch5 = match;
1116 }
1117 *parentMatch1 = match;
1118 }
1119 *parentMatch0 = match;
1120 }
1121 if (match.hit)
1122 {
1123 soulng::parser::Match match(false);
1124 soulng::parser::Match* parentMatch7 = &match;
1125 {
1126 soulng::parser::Match match(false);
1127 soulng::parser::Match* parentMatch8 = &match;
1128 {
1129 int64_t pos = lexer.GetPos();
1130 soulng::parser::Match match(true);
1131 soulng::parser::Match* parentMatch9 = &match;
1132 {
1133 soulng::lexer::Span span = lexer.GetSpan();
1134 soulng::parser::Match match(false);
1135 if (*lexer == SEMICOLON)
1136 {
1137 ++lexer;
1138 match.hit = true;
1139 }
1140 if (match.hit)
1141 {
1142 *parentMatch9 = match;
1143 }
1144 else
1145 {
1146 lexer.ThrowExpectationFailure(span, ToUtf32(GetTokenInfo(SEMICOLON)));
1147 }
1148 }
1149 if (match.hit)
1150 {
1151 {
1152 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1153
1154 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1155 return soulng::parser::Match(true, new sngcm::ast::TargetDeclaration(target->value));
1156 }
1157 }
1158 *parentMatch8 = match;
1159 }
1160 *parentMatch7 = match;
1161 }
1162 *parentMatch0 = match;
1163 }
1164 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1165
1166
1167
1168
1169
1170 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1171 if (!match.hit)
1172 {
1173 match.value = nullptr;
1174 }
1175 return match;
1176 }
1177
1178 soulng::parser::Match ProjectFileParser::Target(ContainerFileLexer& lexer)
1179 {
1180 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1181
1182
1183
1184
1185
1186
1187
1188 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1189 soulng::parser::Match match(false);
1190 int64_t pos = lexer.GetPos();
1191 soulng::lexer::Span span = lexer.GetSpan();
1192 switch (*lexer)
1193 {
1194 case PROGRAM:
1195 {
1196 ++lexer;
1197 {
1198 {
1199 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1200
1201 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1202 return soulng::parser::Match(true, new soulng::parser::Value<sngcm::ast::Target>(sngcm::ast::Target::program));
1203 }
1204 }
1205 break;
1206 }
1207 case WINGUIAPP:
1208 {
1209 ++lexer;
1210 {
1211 {
1212 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1213
1214 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1215 return soulng::parser::Match(true, new soulng::parser::Value<sngcm::ast::Target>(sngcm::ast::Target::winguiapp));
1216 }
1217 }
1218 break;
1219 }
1220 case WINAPP:
1221 {
1222 ++lexer;
1223 {
1224 {
1225 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1226
1227 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1228 return soulng::parser::Match(true, new soulng::parser::Value<sngcm::ast::Target>(sngcm::ast::Target::winapp));
1229 }
1230 }
1231 break;
1232 }
1233 case LIBRARY:
1234 {
1235 ++lexer;
1236 {
1237 {
1238 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1239
1240 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1241 return soulng::parser::Match(true, new soulng::parser::Value<sngcm::ast::Target>(sngcm::ast::Target::library));
1242 }
1243 }
1244 break;
1245 }
1246 case WINLIB:
1247 {
1248 ++lexer;
1249 {
1250 {
1251 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1252
1253 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1254 return soulng::parser::Match(true, new soulng::parser::Value<sngcm::ast::Target>(sngcm::ast::Target::winlib));
1255 }
1256 }
1257 break;
1258 }
1259 case UNITTEST:
1260 {
1261 ++lexer;
1262 {
1263 {
1264 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1265
1266 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1267 return soulng::parser::Match(true, new soulng::parser::Value<sngcm::ast::Target>(sngcm::ast::Target::unitTest));
1268 }
1269 }
1270 break;
1271 }
1272 }
1273 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
1274
1275
1276
1277
1278
1279 #endif // SOULNG_PARSER_DEBUG_SUPPORT
1280 if (!match.hit)
1281 {
1282 match.value = nullptr;
1283 }
1284 return match;
1285 }