1 using System;
2 using System.Collections;
3 using System.Lex;
4 using System.Parsing;
5 using IntermediateCodeTokens;
6
7
8
9 public static class IntermediateCodeFileParser
10 {
11 public static void Parse(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
12 {
13 #if (DEBUG)
14 if (lexer.Log() != null)
15 {
16 lexer.Log()->WriteBeginRule(u"parse");
17 lexer.Log()->IncIndent();
18 }
19 #endif
20 ++lexer;
21 System.Lex.Span span = lexer.GetSpan();
22 Match match = IntermediateCodeFile(lexer, context);
23 if (match.hit)
24 {
25 if (*lexer == System.Lex.END_TOKEN)
26 {
27 return;
28 }
29 else
30 {
31 lexer.ThrowExpectationFailure(lexer.GetSpan(), GetEndTokenInfo());
32 }
33 }
34 else
35 {
36 lexer.ThrowExpectationFailure(span, u"IntermediateCodeFile");
37 }
38 return;
39 }
40 public static Match IntermediateCodeFile(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
41 {
42 #if (DEBUG)
43 Span debugSpan;
44 bool writeToLog = lexer.Log() != null;
45 if (writeToLog)
46 {
47 debugSpan = lexer.GetSpan();
48 System.Lex.WriteBeginRuleToLog(lexer, u"IntermediateCodeFile");
49 }
50 #endif
51 Match match(false);
52 Match* parentMatch0 = &match;
53 {
54 Match match(false);
55 Match* parentMatch1 = &match;
56 {
57 Match match(false);
58 Match* parentMatch2 = &match;
59 {
60 Match match(false);
61 Match* parentMatch3 = &match;
62 {
63 Match match(false);
64 Match* parentMatch4 = &match;
65 {
66 Match match(false);
67 Match* parentMatch5 = &match;
68 {
69 long pos = lexer.GetPos();
70 Match match(true);
71 if (match.hit)
72 {
73 context->SetFileName(lexer.FileName());
74 }
75 *parentMatch5 = match;
76 }
77 *parentMatch4 = match;
78 }
79 if (match.hit)
80 {
81 Match match(false);
82 Match* parentMatch6 = &match;
83 {
84 Match match = IntermediateCodeFileParser.CompileUnitHeader(lexer, context);
85 *parentMatch6 = match;
86 }
87 *parentMatch4 = match;
88 }
89 *parentMatch3 = match;
90 }
91 if (match.hit)
92 {
93 Match match(false);
94 Match* parentMatch7 = &match;
95 {
96 Match match(true);
97 long save = lexer.GetPos();
98 Match* parentMatch8 = &match;
99 {
100 Match match = IntermediateCodeFileParser.TypeDeclarations(lexer, context);
101 if (match.hit)
102 {
103 *parentMatch8 = match;
104 }
105 else
106 {
107 lexer.SetPos(save);
108 }
109 }
110 *parentMatch7 = match;
111 }
112 *parentMatch3 = match;
113 }
114 *parentMatch2 = match;
115 }
116 if (match.hit)
117 {
118 Match match(false);
119 Match* parentMatch9 = &match;
120 {
121 Match match(true);
122 long save = lexer.GetPos();
123 Match* parentMatch10 = &match;
124 {
125 Match match = IntermediateCodeFileParser.DataDefinitions(lexer, context);
126 if (match.hit)
127 {
128 *parentMatch10 = match;
129 }
130 else
131 {
132 lexer.SetPos(save);
133 }
134 }
135 *parentMatch9 = match;
136 }
137 *parentMatch2 = match;
138 }
139 *parentMatch1 = match;
140 }
141 if (match.hit)
142 {
143 Match match(false);
144 Match* parentMatch11 = &match;
145 {
146 Match match(true);
147 long save = lexer.GetPos();
148 Match* parentMatch12 = &match;
149 {
150 Match match = IntermediateCodeFileParser.Functions(lexer, context);
151 if (match.hit)
152 {
153 *parentMatch12 = match;
154 }
155 else
156 {
157 lexer.SetPos(save);
158 }
159 }
160 *parentMatch11 = match;
161 }
162 *parentMatch1 = match;
163 }
164 *parentMatch0 = match;
165 }
166 if (match.hit)
167 {
168 Match match(false);
169 Match* parentMatch13 = &match;
170 {
171 Match match(true);
172 long save = lexer.GetPos();
173 Match* parentMatch14 = &match;
174 {
175 Match match = IntermediateCodeFileParser.Metadata(lexer, context);
176 if (match.hit)
177 {
178 *parentMatch14 = match;
179 }
180 else
181 {
182 lexer.SetPos(save);
183 }
184 }
185 *parentMatch13 = match;
186 }
187 *parentMatch0 = match;
188 }
189 #if (DEBUG)
190 if (writeToLog)
191 {
192 if (match.hit)
193 {
194 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"IntermediateCodeFile");
195 }
196 else
197 {
198 System.Lex.WriteFailureToLog(lexer, u"IntermediateCodeFile");
199 }
200 }
201 #endif
202 if (!match.hit)
203 {
204 match.value = null;
205 }
206 return match;
207 }
208 public static Match CompileUnitHeader(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
209 {
210 #if (DEBUG)
211 Span debugSpan;
212 bool writeToLog = lexer.Log() != null;
213 if (writeToLog)
214 {
215 debugSpan = lexer.GetSpan();
216 System.Lex.WriteBeginRuleToLog(lexer, u"CompileUnitHeader");
217 }
218 #endif
219 UniquePtr<Value<string>> cuid;
220 UniquePtr<cmsx.intermediate.MDStructRef> mdRef;
221 Match match(false);
222 Match* parentMatch0 = &match;
223 {
224 Match match(false);
225 Match* parentMatch1 = &match;
226 {
227 Match match(false);
228 Match* parentMatch2 = &match;
229 {
230 Match match(false);
231 Match* parentMatch3 = &match;
232 {
233 Match match(false);
234 Match* parentMatch4 = &match;
235 {
236 Match match(false);
237 if (*lexer == CU)
238 {
239 ++lexer;
240 match.hit = true;
241 }
242 *parentMatch4 = match;
243 }
244 if (match.hit)
245 {
246 Match match(false);
247 Match* parentMatch5 = &match;
248 {
249 Match match(true);
250 Match* parentMatch6 = &match;
251 {
252 System.Lex.Span span = lexer.GetSpan();
253 Match match(false);
254 if (*lexer == LPAREN)
255 {
256 ++lexer;
257 match.hit = true;
258 }
259 if (match.hit)
260 {
261 *parentMatch6 = match;
262 }
263 else
264 {
265 lexer.ThrowExpectationFailure(span, GetTokenName(LPAREN));
266 }
267 }
268 *parentMatch5 = match;
269 }
270 *parentMatch4 = match;
271 }
272 *parentMatch3 = match;
273 }
274 if (match.hit)
275 {
276 Match match(false);
277 Match* parentMatch7 = &match;
278 {
279 Match match(true);
280 Match* parentMatch8 = &match;
281 {
282 System.Lex.Span span = lexer.GetSpan();
283 Match match = IntermediateCodeFileParser.CompileUnitId(lexer);
284 cuid.Reset(cast<Value<string>*>(match.value));
285 if (match.hit)
286 {
287 *parentMatch8 = match;
288 }
289 else
290 {
291 lexer.ThrowExpectationFailure(span, u"CompileUnitId");
292 }
293 }
294 *parentMatch7 = match;
295 }
296 *parentMatch3 = match;
297 }
298 *parentMatch2 = match;
299 }
300 if (match.hit)
301 {
302 Match match(false);
303 Match* parentMatch9 = &match;
304 {
305 Match match(true);
306 Match* parentMatch10 = &match;
307 {
308 System.Lex.Span span = lexer.GetSpan();
309 Match match(false);
310 if (*lexer == COMMA)
311 {
312 ++lexer;
313 match.hit = true;
314 }
315 if (match.hit)
316 {
317 *parentMatch10 = match;
318 }
319 else
320 {
321 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
322 }
323 }
324 *parentMatch9 = match;
325 }
326 *parentMatch2 = match;
327 }
328 *parentMatch1 = match;
329 }
330 if (match.hit)
331 {
332 Match match(false);
333 Match* parentMatch11 = &match;
334 {
335 Match match(true);
336 Match* parentMatch12 = &match;
337 {
338 System.Lex.Span span = lexer.GetSpan();
339 Match match = IntermediateCodeFileParser.MDStructRef(lexer, context);
340 mdRef.Reset(cast<cmsx.intermediate.MDStructRef*>(match.value));
341 if (match.hit)
342 {
343 *parentMatch12 = match;
344 }
345 else
346 {
347 lexer.ThrowExpectationFailure(span, u"MDStructRef");
348 }
349 }
350 *parentMatch11 = match;
351 }
352 *parentMatch1 = match;
353 }
354 *parentMatch0 = match;
355 }
356 if (match.hit)
357 {
358 Match match(false);
359 Match* parentMatch13 = &match;
360 {
361 Match match(false);
362 Match* parentMatch14 = &match;
363 {
364 long pos = lexer.GetPos();
365 Match match(true);
366 Match* parentMatch15 = &match;
367 {
368 System.Lex.Span span = lexer.GetSpan();
369 Match match(false);
370 if (*lexer == RPAREN)
371 {
372 ++lexer;
373 match.hit = true;
374 }
375 if (match.hit)
376 {
377 *parentMatch15 = match;
378 }
379 else
380 {
381 lexer.ThrowExpectationFailure(span, GetTokenName(RPAREN));
382 }
383 }
384 if (match.hit)
385 {
386 context->SetCompileUnitInfo(cuid->value, mdRef.Release());
387 }
388 *parentMatch14 = match;
389 }
390 *parentMatch13 = match;
391 }
392 *parentMatch0 = match;
393 }
394 #if (DEBUG)
395 if (writeToLog)
396 {
397 if (match.hit)
398 {
399 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"CompileUnitHeader");
400 }
401 else
402 {
403 System.Lex.WriteFailureToLog(lexer, u"CompileUnitHeader");
404 }
405 }
406 #endif
407 if (!match.hit)
408 {
409 match.value = null;
410 }
411 return match;
412 }
413 public static Match CompileUnitId(IntermediateCodeLexer& lexer)
414 {
415 #if (DEBUG)
416 Span debugSpan;
417 bool writeToLog = lexer.Log() != null;
418 if (writeToLog)
419 {
420 debugSpan = lexer.GetSpan();
421 System.Lex.WriteBeginRuleToLog(lexer, u"CompileUnitId");
422 }
423 #endif
424 Match match(false);
425 long pos = lexer.GetPos();
426 Span span = lexer.GetSpan();
427 switch (*lexer)
428 {
429 case HEXNUM:
430 {
431 ++lexer;
432 {
433 #if (DEBUG)
434 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"CompileUnitId");
435 #endif
436 return Match(true, new Value<string>(ToUtf8(lexer.GetToken(pos).match.ToString())));
437 }
438 break;
439 }
440 case NUMBER:
441 {
442 ++lexer;
443 {
444 #if (DEBUG)
445 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"CompileUnitId");
446 #endif
447 return Match(true, new Value<string>(ToUtf8(lexer.GetToken(pos).match.ToString())));
448 }
449 break;
450 }
451 case ID:
452 {
453 ++lexer;
454 {
455 #if (DEBUG)
456 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"CompileUnitId");
457 #endif
458 return Match(true, new Value<string>(ToUtf8(lexer.GetToken(pos).match.ToString())));
459 }
460 break;
461 }
462 }
463 #if (DEBUG)
464 if (writeToLog)
465 {
466 if (match.hit)
467 {
468 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"CompileUnitId");
469 }
470 else
471 {
472 System.Lex.WriteFailureToLog(lexer, u"CompileUnitId");
473 }
474 }
475 #endif
476 if (!match.hit)
477 {
478 match.value = null;
479 }
480 return match;
481 }
482 public static Match TypeDeclarations(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
483 {
484 #if (DEBUG)
485 Span debugSpan;
486 bool writeToLog = lexer.Log() != null;
487 if (writeToLog)
488 {
489 debugSpan = lexer.GetSpan();
490 System.Lex.WriteBeginRuleToLog(lexer, u"TypeDeclarations");
491 }
492 #endif
493 Match match(false);
494 Match* parentMatch0 = &match;
495 {
496 Match match(false);
497 Match* parentMatch1 = &match;
498 {
499 Match match(false);
500 Match* parentMatch2 = &match;
501 {
502 Match match(false);
503 if (*lexer == TYPES)
504 {
505 ++lexer;
506 match.hit = true;
507 }
508 *parentMatch2 = match;
509 }
510 if (match.hit)
511 {
512 Match match(false);
513 Match* parentMatch3 = &match;
514 {
515 Match match(true);
516 Match* parentMatch4 = &match;
517 {
518 System.Lex.Span span = lexer.GetSpan();
519 Match match(false);
520 if (*lexer == LBRACE)
521 {
522 ++lexer;
523 match.hit = true;
524 }
525 if (match.hit)
526 {
527 *parentMatch4 = match;
528 }
529 else
530 {
531 lexer.ThrowExpectationFailure(span, GetTokenName(LBRACE));
532 }
533 }
534 *parentMatch3 = match;
535 }
536 *parentMatch2 = match;
537 }
538 *parentMatch1 = match;
539 }
540 if (match.hit)
541 {
542 Match match(false);
543 Match* parentMatch5 = &match;
544 {
545 Match match(true);
546 Match* parentMatch6 = &match;
547 {
548 while (true)
549 {
550 long save = lexer.GetPos();
551 {
552 Match match = IntermediateCodeFileParser.TypeDeclaration(lexer, context);
553 if (match.hit)
554 {
555 *parentMatch6 = match;
556 }
557 else
558 {
559 lexer.SetPos(save);
560 break;
561 }
562 }
563 }
564 }
565 *parentMatch5 = match;
566 }
567 *parentMatch1 = match;
568 }
569 *parentMatch0 = match;
570 }
571 if (match.hit)
572 {
573 Match match(false);
574 Match* parentMatch7 = &match;
575 {
576 Match match(false);
577 Match* parentMatch8 = &match;
578 {
579 long pos = lexer.GetPos();
580 Match match(true);
581 Match* parentMatch9 = &match;
582 {
583 System.Lex.Span span = lexer.GetSpan();
584 Match match(false);
585 if (*lexer == RBRACE)
586 {
587 ++lexer;
588 match.hit = true;
589 }
590 if (match.hit)
591 {
592 *parentMatch9 = match;
593 }
594 else
595 {
596 lexer.ThrowExpectationFailure(span, GetTokenName(RBRACE));
597 }
598 }
599 if (match.hit)
600 {
601 context->ResolveTypes();
602 }
603 *parentMatch8 = match;
604 }
605 *parentMatch7 = match;
606 }
607 *parentMatch0 = match;
608 }
609 #if (DEBUG)
610 if (writeToLog)
611 {
612 if (match.hit)
613 {
614 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TypeDeclarations");
615 }
616 else
617 {
618 System.Lex.WriteFailureToLog(lexer, u"TypeDeclarations");
619 }
620 }
621 #endif
622 if (!match.hit)
623 {
624 match.value = null;
625 }
626 return match;
627 }
628 public static Match TypeDeclaration(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
629 {
630 #if (DEBUG)
631 Span debugSpan;
632 bool writeToLog = lexer.Log() != null;
633 if (writeToLog)
634 {
635 debugSpan = lexer.GetSpan();
636 System.Lex.WriteBeginRuleToLog(lexer, u"TypeDeclaration");
637 }
638 #endif
639 string typeId;
640 UniquePtr<Value<string>> tid;
641 Match match(false);
642 Match* parentMatch0 = &match;
643 {
644 Match match(false);
645 Match* parentMatch1 = &match;
646 {
647 Match match(false);
648 Match* parentMatch2 = &match;
649 {
650 Match match(false);
651 Match* parentMatch3 = &match;
652 {
653 long pos = lexer.GetPos();
654 Match match = IntermediateCodeFileParser.StrTypeId(lexer, context);
655 tid.Reset(cast<Value<string>*>(match.value));
656 if (match.hit)
657 {
658 typeId = tid->value;
659 }
660 *parentMatch3 = match;
661 }
662 *parentMatch2 = match;
663 }
664 if (match.hit)
665 {
666 Match match(false);
667 Match* parentMatch4 = &match;
668 {
669 Match match(true);
670 Match* parentMatch5 = &match;
671 {
672 System.Lex.Span span = lexer.GetSpan();
673 Match match(false);
674 if (*lexer == ASSIGN)
675 {
676 ++lexer;
677 match.hit = true;
678 }
679 if (match.hit)
680 {
681 *parentMatch5 = match;
682 }
683 else
684 {
685 lexer.ThrowExpectationFailure(span, GetTokenName(ASSIGN));
686 }
687 }
688 *parentMatch4 = match;
689 }
690 *parentMatch2 = match;
691 }
692 *parentMatch1 = match;
693 }
694 if (match.hit)
695 {
696 Match match(false);
697 Match* parentMatch6 = &match;
698 {
699 Match match(true);
700 Match* parentMatch7 = &match;
701 {
702 System.Lex.Span span = lexer.GetSpan();
703 Match match(false);
704 if (*lexer == TYPE)
705 {
706 ++lexer;
707 match.hit = true;
708 }
709 if (match.hit)
710 {
711 *parentMatch7 = match;
712 }
713 else
714 {
715 lexer.ThrowExpectationFailure(span, GetTokenName(TYPE));
716 }
717 }
718 *parentMatch6 = match;
719 }
720 *parentMatch1 = match;
721 }
722 *parentMatch0 = match;
723 }
724 if (match.hit)
725 {
726 Match match(false);
727 Match* parentMatch8 = &match;
728 {
729 Match match(false);
730 Match* parentMatch9 = &match;
731 {
732 Match match(false);
733 Match* parentMatch10 = &match;
734 {
735 long save = lexer.GetPos();
736 Match match(false);
737 Match* parentMatch11 = &match;
738 {
739 long save = lexer.GetPos();
740 Match match = IntermediateCodeFileParser.StructureType(lexer, typeId, context);
741 *parentMatch11 = match;
742 if (!match.hit)
743 {
744 Match match(false);
745 Match* parentMatch12 = &match;
746 lexer.SetPos(save);
747 {
748 Match match = IntermediateCodeFileParser.ArrayType(lexer, typeId, context);
749 *parentMatch12 = match;
750 }
751 *parentMatch11 = match;
752 }
753 }
754 *parentMatch10 = match;
755 if (!match.hit)
756 {
757 Match match(false);
758 Match* parentMatch13 = &match;
759 lexer.SetPos(save);
760 {
761 Match match = IntermediateCodeFileParser.FunctionType(lexer, typeId, context);
762 *parentMatch13 = match;
763 }
764 *parentMatch10 = match;
765 }
766 }
767 *parentMatch9 = match;
768 }
769 *parentMatch8 = match;
770 }
771 *parentMatch0 = match;
772 }
773 #if (DEBUG)
774 if (writeToLog)
775 {
776 if (match.hit)
777 {
778 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TypeDeclaration");
779 }
780 else
781 {
782 System.Lex.WriteFailureToLog(lexer, u"TypeDeclaration");
783 }
784 }
785 #endif
786 if (!match.hit)
787 {
788 match.value = null;
789 }
790 return match;
791 }
792 public static Match StrTypeId(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
793 {
794 #if (DEBUG)
795 Span debugSpan;
796 bool writeToLog = lexer.Log() != null;
797 if (writeToLog)
798 {
799 debugSpan = lexer.GetSpan();
800 System.Lex.WriteBeginRuleToLog(lexer, u"StrTypeId");
801 }
802 #endif
803 string str;
804 UniquePtr<Value<string>> primitiveTypeName;
805 Match match(false);
806 Match* parentMatch0 = &match;
807 {
808 long pos = lexer.GetPos();
809 Match match(false);
810 Match* parentMatch1 = &match;
811 {
812 Match match(false);
813 Match* parentMatch2 = &match;
814 {
815 Match match(false);
816 Match* parentMatch3 = &match;
817 {
818 Match match(false);
819 Match* parentMatch4 = &match;
820 {
821 long save = lexer.GetPos();
822 Match match(false);
823 Match* parentMatch5 = &match;
824 {
825 long pos = lexer.GetPos();
826 Match match(false);
827 if (*lexer == TYPEID)
828 {
829 ++lexer;
830 match.hit = true;
831 }
832 if (match.hit)
833 {
834 str = ToUtf8(lexer.GetToken(pos).match.ToString());
835 }
836 *parentMatch5 = match;
837 }
838 *parentMatch4 = match;
839 if (!match.hit)
840 {
841 Match match(false);
842 Match* parentMatch6 = &match;
843 lexer.SetPos(save);
844 {
845 Match match(false);
846 Match* parentMatch7 = &match;
847 {
848 long pos = lexer.GetPos();
849 Match match = IntermediateCodeFileParser.PrimitiveTypeName(lexer);
850 primitiveTypeName.Reset(cast<Value<string>*>(match.value));
851 if (match.hit)
852 {
853 str = primitiveTypeName->value;
854 }
855 *parentMatch7 = match;
856 }
857 *parentMatch6 = match;
858 }
859 *parentMatch4 = match;
860 }
861 }
862 *parentMatch3 = match;
863 }
864 *parentMatch2 = match;
865 }
866 if (match.hit)
867 {
868 Match match(false);
869 Match* parentMatch8 = &match;
870 {
871 Match match(true);
872 Match* parentMatch9 = &match;
873 {
874 while (true)
875 {
876 long save = lexer.GetPos();
877 {
878 Match match(false);
879 Match* parentMatch10 = &match;
880 {
881 Match match(false);
882 Match* parentMatch11 = &match;
883 {
884 long pos = lexer.GetPos();
885 Span span = lexer.GetSpan();
886 Match match(false);
887 if (*lexer == AST)
888 {
889 ++lexer;
890 match.hit = true;
891 }
892 if (match.hit)
893 {
894 str.Append('*');
895 context->AddPtrType(str, span.line);
896 }
897 *parentMatch11 = match;
898 }
899 *parentMatch10 = match;
900 }
901 if (match.hit)
902 {
903 *parentMatch9 = match;
904 }
905 else
906 {
907 lexer.SetPos(save);
908 break;
909 }
910 }
911 }
912 }
913 *parentMatch8 = match;
914 }
915 *parentMatch2 = match;
916 }
917 *parentMatch1 = match;
918 }
919 if (match.hit)
920 {
921 {
922 #if (DEBUG)
923 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StrTypeId");
924 #endif
925 return Match(true, new Value<string>(str));
926 }
927 }
928 *parentMatch0 = match;
929 }
930 #if (DEBUG)
931 if (writeToLog)
932 {
933 if (match.hit)
934 {
935 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StrTypeId");
936 }
937 else
938 {
939 System.Lex.WriteFailureToLog(lexer, u"StrTypeId");
940 }
941 }
942 #endif
943 if (!match.hit)
944 {
945 match.value = null;
946 }
947 return match;
948 }
949 public static Match StructureType(IntermediateCodeLexer& lexer, string typeId, cmsx.intermediate.Context* context)
950 {
951 #if (DEBUG)
952 Span debugSpan;
953 bool writeToLog = lexer.Log() != null;
954 if (writeToLog)
955 {
956 debugSpan = lexer.GetSpan();
957 System.Lex.WriteBeginRuleToLog(lexer, u"StructureType");
958 }
959 #endif
960 List<string> memberTypeIds;
961 UniquePtr<Value<string>> tid;
962 Match match(false);
963 Match* parentMatch0 = &match;
964 {
965 Match match(false);
966 Match* parentMatch1 = &match;
967 {
968 long pos = lexer.GetPos();
969 Match match(false);
970 Match* parentMatch2 = &match;
971 {
972 Match match(false);
973 Match* parentMatch3 = &match;
974 {
975 Match match(false);
976 Match* parentMatch4 = &match;
977 {
978 Match match(false);
979 if (*lexer == LBRACE)
980 {
981 ++lexer;
982 match.hit = true;
983 }
984 *parentMatch4 = match;
985 }
986 if (match.hit)
987 {
988 Match match(false);
989 Match* parentMatch5 = &match;
990 {
991 Match match(false);
992 Match* parentMatch6 = &match;
993 {
994 Match match(false);
995 Match* parentMatch7 = &match;
996 {
997 Match match(false);
998 Match* parentMatch8 = &match;
999 {
1000 Match match(false);
1001 Match* parentMatch9 = &match;
1002 {
1003 Match match(false);
1004 Match* parentMatch10 = &match;
1005 {
1006 long pos = lexer.GetPos();
1007 Match match(true);
1008 Match* parentMatch11 = &match;
1009 {
1010 System.Lex.Span span = lexer.GetSpan();
1011 Match match = IntermediateCodeFileParser.StrTypeId(lexer, context);
1012 tid.Reset(cast<Value<string>*>(match.value));
1013 if (match.hit)
1014 {
1015 *parentMatch11 = match;
1016 }
1017 else
1018 {
1019 lexer.ThrowExpectationFailure(span, u"StrTypeId");
1020 }
1021 }
1022 if (match.hit)
1023 {
1024 memberTypeIds.Add(tid->value);
1025 }
1026 *parentMatch10 = match;
1027 }
1028 *parentMatch9 = match;
1029 }
1030 if (match.hit)
1031 {
1032 Match match(false);
1033 Match* parentMatch12 = &match;
1034 {
1035 Match match(true);
1036 long save = lexer.GetPos();
1037 Match* parentMatch13 = &match;
1038 {
1039 Match match(false);
1040 Match* parentMatch14 = &match;
1041 {
1042 Match match(false);
1043 Match* parentMatch15 = &match;
1044 {
1045 Match match(false);
1046 Match* parentMatch16 = &match;
1047 {
1048 Match match(false);
1049 Match* parentMatch17 = &match;
1050 {
1051 Match match(false);
1052 if (*lexer == COLON)
1053 {
1054 ++lexer;
1055 match.hit = true;
1056 }
1057 *parentMatch17 = match;
1058 }
1059 if (match.hit)
1060 {
1061 Match match(false);
1062 Match* parentMatch18 = &match;
1063 {
1064 Match match(false);
1065 if (*lexer == OFFSET)
1066 {
1067 ++lexer;
1068 match.hit = true;
1069 }
1070 *parentMatch18 = match;
1071 }
1072 *parentMatch17 = match;
1073 }
1074 *parentMatch16 = match;
1075 }
1076 if (match.hit)
1077 {
1078 Match match(false);
1079 Match* parentMatch19 = &match;
1080 {
1081 Match match(false);
1082 if (*lexer == ASSIGN)
1083 {
1084 ++lexer;
1085 match.hit = true;
1086 }
1087 *parentMatch19 = match;
1088 }
1089 *parentMatch16 = match;
1090 }
1091 *parentMatch15 = match;
1092 }
1093 if (match.hit)
1094 {
1095 Match match(false);
1096 Match* parentMatch20 = &match;
1097 {
1098 Match match(false);
1099 if (*lexer == NUMBER)
1100 {
1101 ++lexer;
1102 match.hit = true;
1103 }
1104 *parentMatch20 = match;
1105 }
1106 *parentMatch15 = match;
1107 }
1108 *parentMatch14 = match;
1109 }
1110 if (match.hit)
1111 {
1112 *parentMatch13 = match;
1113 }
1114 else
1115 {
1116 lexer.SetPos(save);
1117 }
1118 }
1119 *parentMatch12 = match;
1120 }
1121 *parentMatch9 = match;
1122 }
1123 *parentMatch8 = match;
1124 }
1125 *parentMatch7 = match;
1126 }
1127 if (match.hit)
1128 {
1129 Match match(false);
1130 Match* parentMatch21 = &match;
1131 {
1132 Match match(true);
1133 Match* parentMatch22 = &match;
1134 {
1135 while (true)
1136 {
1137 long save = lexer.GetPos();
1138 {
1139 Match match(false);
1140 Match* parentMatch23 = &match;
1141 {
1142 Match match(false);
1143 if (*lexer == COMMA)
1144 {
1145 ++lexer;
1146 match.hit = true;
1147 }
1148 *parentMatch23 = match;
1149 }
1150 if (match.hit)
1151 {
1152 Match match(false);
1153 Match* parentMatch24 = &match;
1154 {
1155 Match match(false);
1156 Match* parentMatch25 = &match;
1157 {
1158 Match match(false);
1159 Match* parentMatch26 = &match;
1160 {
1161 Match match(false);
1162 Match* parentMatch27 = &match;
1163 {
1164 long pos = lexer.GetPos();
1165 Match match(true);
1166 Match* parentMatch28 = &match;
1167 {
1168 System.Lex.Span span = lexer.GetSpan();
1169 Match match = IntermediateCodeFileParser.StrTypeId(lexer, context);
1170 tid.Reset(cast<Value<string>*>(match.value));
1171 if (match.hit)
1172 {
1173 *parentMatch28 = match;
1174 }
1175 else
1176 {
1177 lexer.ThrowExpectationFailure(span, u"StrTypeId");
1178 }
1179 }
1180 if (match.hit)
1181 {
1182 memberTypeIds.Add(tid->value);
1183 }
1184 *parentMatch27 = match;
1185 }
1186 *parentMatch26 = match;
1187 }
1188 if (match.hit)
1189 {
1190 Match match(false);
1191 Match* parentMatch29 = &match;
1192 {
1193 Match match(true);
1194 long save = lexer.GetPos();
1195 Match* parentMatch30 = &match;
1196 {
1197 Match match(false);
1198 Match* parentMatch31 = &match;
1199 {
1200 Match match(false);
1201 Match* parentMatch32 = &match;
1202 {
1203 Match match(false);
1204 Match* parentMatch33 = &match;
1205 {
1206 Match match(false);
1207 Match* parentMatch34 = &match;
1208 {
1209 Match match(false);
1210 if (*lexer == COLON)
1211 {
1212 ++lexer;
1213 match.hit = true;
1214 }
1215 *parentMatch34 = match;
1216 }
1217 if (match.hit)
1218 {
1219 Match match(false);
1220 Match* parentMatch35 = &match;
1221 {
1222 Match match(false);
1223 if (*lexer == OFFSET)
1224 {
1225 ++lexer;
1226 match.hit = true;
1227 }
1228 *parentMatch35 = match;
1229 }
1230 *parentMatch34 = match;
1231 }
1232 *parentMatch33 = match;
1233 }
1234 if (match.hit)
1235 {
1236 Match match(false);
1237 Match* parentMatch36 = &match;
1238 {
1239 Match match(false);
1240 if (*lexer == ASSIGN)
1241 {
1242 ++lexer;
1243 match.hit = true;
1244 }
1245 *parentMatch36 = match;
1246 }
1247 *parentMatch33 = match;
1248 }
1249 *parentMatch32 = match;
1250 }
1251 if (match.hit)
1252 {
1253 Match match(false);
1254 Match* parentMatch37 = &match;
1255 {
1256 Match match(false);
1257 if (*lexer == NUMBER)
1258 {
1259 ++lexer;
1260 match.hit = true;
1261 }
1262 *parentMatch37 = match;
1263 }
1264 *parentMatch32 = match;
1265 }
1266 *parentMatch31 = match;
1267 }
1268 if (match.hit)
1269 {
1270 *parentMatch30 = match;
1271 }
1272 else
1273 {
1274 lexer.SetPos(save);
1275 }
1276 }
1277 *parentMatch29 = match;
1278 }
1279 *parentMatch26 = match;
1280 }
1281 *parentMatch25 = match;
1282 }
1283 *parentMatch24 = match;
1284 }
1285 *parentMatch23 = match;
1286 }
1287 if (match.hit)
1288 {
1289 *parentMatch22 = match;
1290 }
1291 else
1292 {
1293 lexer.SetPos(save);
1294 break;
1295 }
1296 }
1297 }
1298 }
1299 *parentMatch21 = match;
1300 }
1301 *parentMatch7 = match;
1302 }
1303 *parentMatch6 = match;
1304 }
1305 *parentMatch5 = match;
1306 }
1307 *parentMatch4 = match;
1308 }
1309 *parentMatch3 = match;
1310 }
1311 if (match.hit)
1312 {
1313 Match match(false);
1314 Match* parentMatch38 = &match;
1315 {
1316 Match match(true);
1317 Match* parentMatch39 = &match;
1318 {
1319 System.Lex.Span span = lexer.GetSpan();
1320 Match match(false);
1321 if (*lexer == RBRACE)
1322 {
1323 ++lexer;
1324 match.hit = true;
1325 }
1326 if (match.hit)
1327 {
1328 *parentMatch39 = match;
1329 }
1330 else
1331 {
1332 lexer.ThrowExpectationFailure(span, GetTokenName(RBRACE));
1333 }
1334 }
1335 *parentMatch38 = match;
1336 }
1337 *parentMatch3 = match;
1338 }
1339 *parentMatch2 = match;
1340 }
1341 if (match.hit)
1342 {
1343 context->AddStructureType(typeId, memberTypeIds);
1344 }
1345 *parentMatch1 = match;
1346 }
1347 *parentMatch0 = match;
1348 }
1349 if (match.hit)
1350 {
1351 Match match(false);
1352 Match* parentMatch40 = &match;
1353 {
1354 Match match(true);
1355 long save = lexer.GetPos();
1356 Match* parentMatch41 = &match;
1357 {
1358 Match match(false);
1359 Match* parentMatch42 = &match;
1360 {
1361 Match match(false);
1362 Match* parentMatch43 = &match;
1363 {
1364 Match match(false);
1365 Match* parentMatch44 = &match;
1366 {
1367 Match match(false);
1368 Match* parentMatch45 = &match;
1369 {
1370 Match match(false);
1371 Match* parentMatch46 = &match;
1372 {
1373 Match match(false);
1374 Match* parentMatch47 = &match;
1375 {
1376 Match match(false);
1377 Match* parentMatch48 = &match;
1378 {
1379 Match match(false);
1380 if (*lexer == SIZE)
1381 {
1382 ++lexer;
1383 match.hit = true;
1384 }
1385 *parentMatch48 = match;
1386 }
1387 if (match.hit)
1388 {
1389 Match match(false);
1390 Match* parentMatch49 = &match;
1391 {
1392 Match match(false);
1393 if (*lexer == ASSIGN)
1394 {
1395 ++lexer;
1396 match.hit = true;
1397 }
1398 *parentMatch49 = match;
1399 }
1400 *parentMatch48 = match;
1401 }
1402 *parentMatch47 = match;
1403 }
1404 if (match.hit)
1405 {
1406 Match match(false);
1407 Match* parentMatch50 = &match;
1408 {
1409 Match match(false);
1410 if (*lexer == NUMBER)
1411 {
1412 ++lexer;
1413 match.hit = true;
1414 }
1415 *parentMatch50 = match;
1416 }
1417 *parentMatch47 = match;
1418 }
1419 *parentMatch46 = match;
1420 }
1421 if (match.hit)
1422 {
1423 Match match(false);
1424 Match* parentMatch51 = &match;
1425 {
1426 Match match(false);
1427 if (*lexer == COMMA)
1428 {
1429 ++lexer;
1430 match.hit = true;
1431 }
1432 *parentMatch51 = match;
1433 }
1434 *parentMatch46 = match;
1435 }
1436 *parentMatch45 = match;
1437 }
1438 if (match.hit)
1439 {
1440 Match match(false);
1441 Match* parentMatch52 = &match;
1442 {
1443 Match match(false);
1444 if (*lexer == ALIGNMENT)
1445 {
1446 ++lexer;
1447 match.hit = true;
1448 }
1449 *parentMatch52 = match;
1450 }
1451 *parentMatch45 = match;
1452 }
1453 *parentMatch44 = match;
1454 }
1455 if (match.hit)
1456 {
1457 Match match(false);
1458 Match* parentMatch53 = &match;
1459 {
1460 Match match(false);
1461 if (*lexer == ASSIGN)
1462 {
1463 ++lexer;
1464 match.hit = true;
1465 }
1466 *parentMatch53 = match;
1467 }
1468 *parentMatch44 = match;
1469 }
1470 *parentMatch43 = match;
1471 }
1472 if (match.hit)
1473 {
1474 Match match(false);
1475 Match* parentMatch54 = &match;
1476 {
1477 Match match(false);
1478 if (*lexer == NUMBER)
1479 {
1480 ++lexer;
1481 match.hit = true;
1482 }
1483 *parentMatch54 = match;
1484 }
1485 *parentMatch43 = match;
1486 }
1487 *parentMatch42 = match;
1488 }
1489 if (match.hit)
1490 {
1491 *parentMatch41 = match;
1492 }
1493 else
1494 {
1495 lexer.SetPos(save);
1496 }
1497 }
1498 *parentMatch40 = match;
1499 }
1500 *parentMatch0 = match;
1501 }
1502 #if (DEBUG)
1503 if (writeToLog)
1504 {
1505 if (match.hit)
1506 {
1507 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StructureType");
1508 }
1509 else
1510 {
1511 System.Lex.WriteFailureToLog(lexer, u"StructureType");
1512 }
1513 }
1514 #endif
1515 if (!match.hit)
1516 {
1517 match.value = null;
1518 }
1519 return match;
1520 }
1521 public static Match ArrayType(IntermediateCodeLexer& lexer, string typeId, cmsx.intermediate.Context* context)
1522 {
1523 #if (DEBUG)
1524 Span debugSpan;
1525 bool writeToLog = lexer.Log() != null;
1526 if (writeToLog)
1527 {
1528 debugSpan = lexer.GetSpan();
1529 System.Lex.WriteBeginRuleToLog(lexer, u"ArrayType");
1530 }
1531 #endif
1532 long size;
1533 UniquePtr<Value<string>> elementTypeId;
1534 Match match(false);
1535 Match* parentMatch0 = &match;
1536 {
1537 Match match(false);
1538 Match* parentMatch1 = &match;
1539 {
1540 long pos = lexer.GetPos();
1541 Match match(false);
1542 Match* parentMatch2 = &match;
1543 {
1544 Match match(false);
1545 Match* parentMatch3 = &match;
1546 {
1547 Match match(false);
1548 Match* parentMatch4 = &match;
1549 {
1550 Match match(false);
1551 Match* parentMatch5 = &match;
1552 {
1553 Match match(false);
1554 Match* parentMatch6 = &match;
1555 {
1556 Match match(false);
1557 if (*lexer == LBRACKET)
1558 {
1559 ++lexer;
1560 match.hit = true;
1561 }
1562 *parentMatch6 = match;
1563 }
1564 if (match.hit)
1565 {
1566 Match match(false);
1567 Match* parentMatch7 = &match;
1568 {
1569 Match match(false);
1570 Match* parentMatch8 = &match;
1571 {
1572 long pos = lexer.GetPos();
1573 Match match(true);
1574 Match* parentMatch9 = &match;
1575 {
1576 System.Lex.Span span = lexer.GetSpan();
1577 Match match(false);
1578 if (*lexer == NUMBER)
1579 {
1580 ++lexer;
1581 match.hit = true;
1582 }
1583 if (match.hit)
1584 {
1585 *parentMatch9 = match;
1586 }
1587 else
1588 {
1589 lexer.ThrowExpectationFailure(span, GetTokenName(NUMBER));
1590 }
1591 }
1592 if (match.hit)
1593 {
1594 size = ParseLong(ToUtf8(lexer.GetToken(pos).match.ToString()));
1595 }
1596 *parentMatch8 = match;
1597 }
1598 *parentMatch7 = match;
1599 }
1600 *parentMatch6 = match;
1601 }
1602 *parentMatch5 = match;
1603 }
1604 if (match.hit)
1605 {
1606 Match match(false);
1607 Match* parentMatch10 = &match;
1608 {
1609 Match match(false);
1610 Match* parentMatch11 = &match;
1611 {
1612 long pos = lexer.GetPos();
1613 bool pass = true;
1614 Match match(false);
1615 if (*lexer == ID)
1616 {
1617 ++lexer;
1618 match.hit = true;
1619 }
1620 if (match.hit)
1621 {
1622 pass = lexer.GetToken(pos).match.ToString() == u"x";
1623 }
1624 if (match.hit && !pass)
1625 {
1626 match = Match(false);
1627 }
1628 *parentMatch11 = match;
1629 }
1630 *parentMatch10 = match;
1631 }
1632 *parentMatch5 = match;
1633 }
1634 *parentMatch4 = match;
1635 }
1636 if (match.hit)
1637 {
1638 Match match(false);
1639 Match* parentMatch12 = &match;
1640 {
1641 Match match(true);
1642 Match* parentMatch13 = &match;
1643 {
1644 System.Lex.Span span = lexer.GetSpan();
1645 Match match = IntermediateCodeFileParser.StrTypeId(lexer, context);
1646 elementTypeId.Reset(cast<Value<string>*>(match.value));
1647 if (match.hit)
1648 {
1649 *parentMatch13 = match;
1650 }
1651 else
1652 {
1653 lexer.ThrowExpectationFailure(span, u"StrTypeId");
1654 }
1655 }
1656 *parentMatch12 = match;
1657 }
1658 *parentMatch4 = match;
1659 }
1660 *parentMatch3 = match;
1661 }
1662 if (match.hit)
1663 {
1664 Match match(false);
1665 Match* parentMatch14 = &match;
1666 {
1667 Match match(true);
1668 Match* parentMatch15 = &match;
1669 {
1670 System.Lex.Span span = lexer.GetSpan();
1671 Match match(false);
1672 if (*lexer == RBRACKET)
1673 {
1674 ++lexer;
1675 match.hit = true;
1676 }
1677 if (match.hit)
1678 {
1679 *parentMatch15 = match;
1680 }
1681 else
1682 {
1683 lexer.ThrowExpectationFailure(span, GetTokenName(RBRACKET));
1684 }
1685 }
1686 *parentMatch14 = match;
1687 }
1688 *parentMatch3 = match;
1689 }
1690 *parentMatch2 = match;
1691 }
1692 if (match.hit)
1693 {
1694 context->AddArrayType(typeId, elementTypeId->value, size);
1695 }
1696 *parentMatch1 = match;
1697 }
1698 *parentMatch0 = match;
1699 }
1700 if (match.hit)
1701 {
1702 Match match(false);
1703 Match* parentMatch16 = &match;
1704 {
1705 Match match(true);
1706 long save = lexer.GetPos();
1707 Match* parentMatch17 = &match;
1708 {
1709 Match match(false);
1710 Match* parentMatch18 = &match;
1711 {
1712 Match match(false);
1713 Match* parentMatch19 = &match;
1714 {
1715 Match match(false);
1716 Match* parentMatch20 = &match;
1717 {
1718 Match match(false);
1719 Match* parentMatch21 = &match;
1720 {
1721 Match match(false);
1722 Match* parentMatch22 = &match;
1723 {
1724 Match match(false);
1725 Match* parentMatch23 = &match;
1726 {
1727 Match match(false);
1728 Match* parentMatch24 = &match;
1729 {
1730 Match match(false);
1731 if (*lexer == SIZE)
1732 {
1733 ++lexer;
1734 match.hit = true;
1735 }
1736 *parentMatch24 = match;
1737 }
1738 if (match.hit)
1739 {
1740 Match match(false);
1741 Match* parentMatch25 = &match;
1742 {
1743 Match match(false);
1744 if (*lexer == ASSIGN)
1745 {
1746 ++lexer;
1747 match.hit = true;
1748 }
1749 *parentMatch25 = match;
1750 }
1751 *parentMatch24 = match;
1752 }
1753 *parentMatch23 = match;
1754 }
1755 if (match.hit)
1756 {
1757 Match match(false);
1758 Match* parentMatch26 = &match;
1759 {
1760 Match match(false);
1761 if (*lexer == NUMBER)
1762 {
1763 ++lexer;
1764 match.hit = true;
1765 }
1766 *parentMatch26 = match;
1767 }
1768 *parentMatch23 = match;
1769 }
1770 *parentMatch22 = match;
1771 }
1772 if (match.hit)
1773 {
1774 Match match(false);
1775 Match* parentMatch27 = &match;
1776 {
1777 Match match(false);
1778 if (*lexer == COMMA)
1779 {
1780 ++lexer;
1781 match.hit = true;
1782 }
1783 *parentMatch27 = match;
1784 }
1785 *parentMatch22 = match;
1786 }
1787 *parentMatch21 = match;
1788 }
1789 if (match.hit)
1790 {
1791 Match match(false);
1792 Match* parentMatch28 = &match;
1793 {
1794 Match match(false);
1795 if (*lexer == ALIGNMENT)
1796 {
1797 ++lexer;
1798 match.hit = true;
1799 }
1800 *parentMatch28 = match;
1801 }
1802 *parentMatch21 = match;
1803 }
1804 *parentMatch20 = match;
1805 }
1806 if (match.hit)
1807 {
1808 Match match(false);
1809 Match* parentMatch29 = &match;
1810 {
1811 Match match(false);
1812 if (*lexer == ASSIGN)
1813 {
1814 ++lexer;
1815 match.hit = true;
1816 }
1817 *parentMatch29 = match;
1818 }
1819 *parentMatch20 = match;
1820 }
1821 *parentMatch19 = match;
1822 }
1823 if (match.hit)
1824 {
1825 Match match(false);
1826 Match* parentMatch30 = &match;
1827 {
1828 Match match(false);
1829 if (*lexer == NUMBER)
1830 {
1831 ++lexer;
1832 match.hit = true;
1833 }
1834 *parentMatch30 = match;
1835 }
1836 *parentMatch19 = match;
1837 }
1838 *parentMatch18 = match;
1839 }
1840 if (match.hit)
1841 {
1842 *parentMatch17 = match;
1843 }
1844 else
1845 {
1846 lexer.SetPos(save);
1847 }
1848 }
1849 *parentMatch16 = match;
1850 }
1851 *parentMatch0 = match;
1852 }
1853 #if (DEBUG)
1854 if (writeToLog)
1855 {
1856 if (match.hit)
1857 {
1858 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ArrayType");
1859 }
1860 else
1861 {
1862 System.Lex.WriteFailureToLog(lexer, u"ArrayType");
1863 }
1864 }
1865 #endif
1866 if (!match.hit)
1867 {
1868 match.value = null;
1869 }
1870 return match;
1871 }
1872 public static Match FunctionType(IntermediateCodeLexer& lexer, string typeId, cmsx.intermediate.Context* context)
1873 {
1874 #if (DEBUG)
1875 Span debugSpan;
1876 bool writeToLog = lexer.Log() != null;
1877 if (writeToLog)
1878 {
1879 debugSpan = lexer.GetSpan();
1880 System.Lex.WriteBeginRuleToLog(lexer, u"FunctionType");
1881 }
1882 #endif
1883 List<string> paramTypeIds;
1884 UniquePtr<Value<string>> returnTypeId;
1885 UniquePtr<Value<string>> paramType;
1886 Match match(false);
1887 Match* parentMatch0 = &match;
1888 {
1889 long pos = lexer.GetPos();
1890 Match match(false);
1891 Match* parentMatch1 = &match;
1892 {
1893 Match match(false);
1894 Match* parentMatch2 = &match;
1895 {
1896 Match match(false);
1897 Match* parentMatch3 = &match;
1898 {
1899 Match match(false);
1900 Match* parentMatch4 = &match;
1901 {
1902 Match match(false);
1903 Match* parentMatch5 = &match;
1904 {
1905 Match match(false);
1906 if (*lexer == FUNCTION)
1907 {
1908 ++lexer;
1909 match.hit = true;
1910 }
1911 *parentMatch5 = match;
1912 }
1913 if (match.hit)
1914 {
1915 Match match(false);
1916 Match* parentMatch6 = &match;
1917 {
1918 Match match(true);
1919 Match* parentMatch7 = &match;
1920 {
1921 System.Lex.Span span = lexer.GetSpan();
1922 Match match = IntermediateCodeFileParser.StrTypeId(lexer, context);
1923 returnTypeId.Reset(cast<Value<string>*>(match.value));
1924 if (match.hit)
1925 {
1926 *parentMatch7 = match;
1927 }
1928 else
1929 {
1930 lexer.ThrowExpectationFailure(span, u"StrTypeId");
1931 }
1932 }
1933 *parentMatch6 = match;
1934 }
1935 *parentMatch5 = match;
1936 }
1937 *parentMatch4 = match;
1938 }
1939 if (match.hit)
1940 {
1941 Match match(false);
1942 Match* parentMatch8 = &match;
1943 {
1944 Match match(true);
1945 Match* parentMatch9 = &match;
1946 {
1947 System.Lex.Span span = lexer.GetSpan();
1948 Match match(false);
1949 if (*lexer == LPAREN)
1950 {
1951 ++lexer;
1952 match.hit = true;
1953 }
1954 if (match.hit)
1955 {
1956 *parentMatch9 = match;
1957 }
1958 else
1959 {
1960 lexer.ThrowExpectationFailure(span, GetTokenName(LPAREN));
1961 }
1962 }
1963 *parentMatch8 = match;
1964 }
1965 *parentMatch4 = match;
1966 }
1967 *parentMatch3 = match;
1968 }
1969 if (match.hit)
1970 {
1971 Match match(false);
1972 Match* parentMatch10 = &match;
1973 {
1974 Match match(true);
1975 long save = lexer.GetPos();
1976 Match* parentMatch11 = &match;
1977 {
1978 Match match(false);
1979 Match* parentMatch12 = &match;
1980 {
1981 Match match(false);
1982 Match* parentMatch13 = &match;
1983 {
1984 Match match(false);
1985 Match* parentMatch14 = &match;
1986 {
1987 long pos = lexer.GetPos();
1988 Match match = IntermediateCodeFileParser.StrTypeId(lexer, context);
1989 paramType.Reset(cast<Value<string>*>(match.value));
1990 if (match.hit)
1991 {
1992 paramTypeIds.Add(paramType->value);
1993 }
1994 *parentMatch14 = match;
1995 }
1996 *parentMatch13 = match;
1997 }
1998 if (match.hit)
1999 {
2000 Match match(false);
2001 Match* parentMatch15 = &match;
2002 {
2003 Match match(true);
2004 Match* parentMatch16 = &match;
2005 {
2006 while (true)
2007 {
2008 long save = lexer.GetPos();
2009 {
2010 Match match(false);
2011 Match* parentMatch17 = &match;
2012 {
2013 Match match(false);
2014 if (*lexer == COMMA)
2015 {
2016 ++lexer;
2017 match.hit = true;
2018 }
2019 *parentMatch17 = match;
2020 }
2021 if (match.hit)
2022 {
2023 Match match(false);
2024 Match* parentMatch18 = &match;
2025 {
2026 Match match(false);
2027 Match* parentMatch19 = &match;
2028 {
2029 long pos = lexer.GetPos();
2030 Match match = IntermediateCodeFileParser.StrTypeId(lexer, context);
2031 paramType.Reset(cast<Value<string>*>(match.value));
2032 if (match.hit)
2033 {
2034 paramTypeIds.Add(paramType->value);
2035 }
2036 *parentMatch19 = match;
2037 }
2038 *parentMatch18 = match;
2039 }
2040 *parentMatch17 = match;
2041 }
2042 if (match.hit)
2043 {
2044 *parentMatch16 = match;
2045 }
2046 else
2047 {
2048 lexer.SetPos(save);
2049 break;
2050 }
2051 }
2052 }
2053 }
2054 *parentMatch15 = match;
2055 }
2056 *parentMatch13 = match;
2057 }
2058 *parentMatch12 = match;
2059 }
2060 if (match.hit)
2061 {
2062 *parentMatch11 = match;
2063 }
2064 else
2065 {
2066 lexer.SetPos(save);
2067 }
2068 }
2069 *parentMatch10 = match;
2070 }
2071 *parentMatch3 = match;
2072 }
2073 *parentMatch2 = match;
2074 }
2075 if (match.hit)
2076 {
2077 Match match(false);
2078 Match* parentMatch20 = &match;
2079 {
2080 Match match(true);
2081 Match* parentMatch21 = &match;
2082 {
2083 System.Lex.Span span = lexer.GetSpan();
2084 Match match(false);
2085 if (*lexer == RPAREN)
2086 {
2087 ++lexer;
2088 match.hit = true;
2089 }
2090 if (match.hit)
2091 {
2092 *parentMatch21 = match;
2093 }
2094 else
2095 {
2096 lexer.ThrowExpectationFailure(span, GetTokenName(RPAREN));
2097 }
2098 }
2099 *parentMatch20 = match;
2100 }
2101 *parentMatch2 = match;
2102 }
2103 *parentMatch1 = match;
2104 }
2105 if (match.hit)
2106 {
2107 context->AddFunctionType(typeId, returnTypeId->value, paramTypeIds);
2108 }
2109 *parentMatch0 = match;
2110 }
2111 #if (DEBUG)
2112 if (writeToLog)
2113 {
2114 if (match.hit)
2115 {
2116 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FunctionType");
2117 }
2118 else
2119 {
2120 System.Lex.WriteFailureToLog(lexer, u"FunctionType");
2121 }
2122 }
2123 #endif
2124 if (!match.hit)
2125 {
2126 match.value = null;
2127 }
2128 return match;
2129 }
2130 public static Match DataDefinitions(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
2131 {
2132 #if (DEBUG)
2133 Span debugSpan;
2134 bool writeToLog = lexer.Log() != null;
2135 if (writeToLog)
2136 {
2137 debugSpan = lexer.GetSpan();
2138 System.Lex.WriteBeginRuleToLog(lexer, u"DataDefinitions");
2139 }
2140 #endif
2141 Match match(false);
2142 Match* parentMatch0 = &match;
2143 {
2144 long pos = lexer.GetPos();
2145 Match match(false);
2146 Match* parentMatch1 = &match;
2147 {
2148 Match match(false);
2149 Match* parentMatch2 = &match;
2150 {
2151 Match match(false);
2152 Match* parentMatch3 = &match;
2153 {
2154 Match match(false);
2155 Match* parentMatch4 = &match;
2156 {
2157 Match match(false);
2158 if (*lexer == DATA)
2159 {
2160 ++lexer;
2161 match.hit = true;
2162 }
2163 *parentMatch4 = match;
2164 }
2165 if (match.hit)
2166 {
2167 Match match(false);
2168 Match* parentMatch5 = &match;
2169 {
2170 Match match(true);
2171 Match* parentMatch6 = &match;
2172 {
2173 System.Lex.Span span = lexer.GetSpan();
2174 Match match(false);
2175 if (*lexer == LBRACE)
2176 {
2177 ++lexer;
2178 match.hit = true;
2179 }
2180 if (match.hit)
2181 {
2182 *parentMatch6 = match;
2183 }
2184 else
2185 {
2186 lexer.ThrowExpectationFailure(span, GetTokenName(LBRACE));
2187 }
2188 }
2189 *parentMatch5 = match;
2190 }
2191 *parentMatch4 = match;
2192 }
2193 *parentMatch3 = match;
2194 }
2195 if (match.hit)
2196 {
2197 Match match(false);
2198 Match* parentMatch7 = &match;
2199 {
2200 Match match(true);
2201 Match* parentMatch8 = &match;
2202 {
2203 while (true)
2204 {
2205 long save = lexer.GetPos();
2206 {
2207 Match match = IntermediateCodeFileParser.DataDefinition(lexer, context);
2208 if (match.hit)
2209 {
2210 *parentMatch8 = match;
2211 }
2212 else
2213 {
2214 lexer.SetPos(save);
2215 break;
2216 }
2217 }
2218 }
2219 }
2220 *parentMatch7 = match;
2221 }
2222 *parentMatch3 = match;
2223 }
2224 *parentMatch2 = match;
2225 }
2226 if (match.hit)
2227 {
2228 Match match(false);
2229 Match* parentMatch9 = &match;
2230 {
2231 Match match(true);
2232 Match* parentMatch10 = &match;
2233 {
2234 System.Lex.Span span = lexer.GetSpan();
2235 Match match(false);
2236 if (*lexer == RBRACE)
2237 {
2238 ++lexer;
2239 match.hit = true;
2240 }
2241 if (match.hit)
2242 {
2243 *parentMatch10 = match;
2244 }
2245 else
2246 {
2247 lexer.ThrowExpectationFailure(span, GetTokenName(RBRACE));
2248 }
2249 }
2250 *parentMatch9 = match;
2251 }
2252 *parentMatch2 = match;
2253 }
2254 *parentMatch1 = match;
2255 }
2256 if (match.hit)
2257 {
2258 context->ValidateGlobalVariables();
2259 }
2260 *parentMatch0 = match;
2261 }
2262 #if (DEBUG)
2263 if (writeToLog)
2264 {
2265 if (match.hit)
2266 {
2267 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"DataDefinitions");
2268 }
2269 else
2270 {
2271 System.Lex.WriteFailureToLog(lexer, u"DataDefinitions");
2272 }
2273 }
2274 #endif
2275 if (!match.hit)
2276 {
2277 match.value = null;
2278 }
2279 return match;
2280 }
2281 public static Match DataDefinition(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
2282 {
2283 #if (DEBUG)
2284 Span debugSpan;
2285 bool writeToLog = lexer.Log() != null;
2286 if (writeToLog)
2287 {
2288 debugSpan = lexer.GetSpan();
2289 System.Lex.WriteBeginRuleToLog(lexer, u"DataDefinition");
2290 }
2291 #endif
2292 bool once;
2293 string variableName;
2294 cmsx.intermediate.Type* type;
2295 UniquePtr<cmsx.intermediate.Type> t;
2296 UniquePtr<cmsx.intermediate.ConstantValue> constant;
2297 Match match(false);
2298 Match* parentMatch0 = &match;
2299 {
2300 Match match(false);
2301 Match* parentMatch1 = &match;
2302 {
2303 Match match(false);
2304 Match* parentMatch2 = &match;
2305 {
2306 Match match(false);
2307 Match* parentMatch3 = &match;
2308 {
2309 long pos = lexer.GetPos();
2310 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
2311 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
2312 if (match.hit)
2313 {
2314 type = t.Release();
2315 }
2316 *parentMatch3 = match;
2317 }
2318 *parentMatch2 = match;
2319 }
2320 if (match.hit)
2321 {
2322 Match match(false);
2323 Match* parentMatch4 = &match;
2324 {
2325 Match match(true);
2326 long save = lexer.GetPos();
2327 Match* parentMatch5 = &match;
2328 {
2329 Match match(false);
2330 Match* parentMatch6 = &match;
2331 {
2332 Match match(false);
2333 Match* parentMatch7 = &match;
2334 {
2335 long pos = lexer.GetPos();
2336 Match match(false);
2337 if (*lexer == ONCE)
2338 {
2339 ++lexer;
2340 match.hit = true;
2341 }
2342 if (match.hit)
2343 {
2344 once = true;
2345 }
2346 *parentMatch7 = match;
2347 }
2348 *parentMatch6 = match;
2349 }
2350 if (match.hit)
2351 {
2352 *parentMatch5 = match;
2353 }
2354 else
2355 {
2356 lexer.SetPos(save);
2357 }
2358 }
2359 *parentMatch4 = match;
2360 }
2361 *parentMatch2 = match;
2362 }
2363 *parentMatch1 = match;
2364 }
2365 if (match.hit)
2366 {
2367 Match match(false);
2368 Match* parentMatch8 = &match;
2369 {
2370 Match match(false);
2371 Match* parentMatch9 = &match;
2372 {
2373 long pos = lexer.GetPos();
2374 Match match(true);
2375 Match* parentMatch10 = &match;
2376 {
2377 System.Lex.Span span = lexer.GetSpan();
2378 Match match(false);
2379 if (*lexer == ID)
2380 {
2381 ++lexer;
2382 match.hit = true;
2383 }
2384 if (match.hit)
2385 {
2386 *parentMatch10 = match;
2387 }
2388 else
2389 {
2390 lexer.ThrowExpectationFailure(span, GetTokenName(ID));
2391 }
2392 }
2393 if (match.hit)
2394 {
2395 variableName = ToUtf8(lexer.GetToken(pos).match.ToString());
2396 }
2397 *parentMatch9 = match;
2398 }
2399 *parentMatch8 = match;
2400 }
2401 *parentMatch1 = match;
2402 }
2403 *parentMatch0 = match;
2404 }
2405 if (match.hit)
2406 {
2407 Match match(false);
2408 Match* parentMatch11 = &match;
2409 {
2410 Match match(false);
2411 Match* parentMatch12 = &match;
2412 {
2413 Match match(false);
2414 Match* parentMatch13 = &match;
2415 {
2416 long save = lexer.GetPos();
2417 Match match(false);
2418 Match* parentMatch14 = &match;
2419 {
2420 long pos = lexer.GetPos();
2421 Span span = lexer.GetSpan();
2422 Match match(false);
2423 if (*lexer == SEMICOLON)
2424 {
2425 ++lexer;
2426 match.hit = true;
2427 }
2428 if (match.hit)
2429 {
2430 context->AddGlobalVariable(type, variableName, cast<cmsx.intermediate.ConstantValue*>(null), span.line, once);
2431 }
2432 *parentMatch14 = match;
2433 }
2434 *parentMatch13 = match;
2435 if (!match.hit)
2436 {
2437 Match match(false);
2438 Match* parentMatch15 = &match;
2439 lexer.SetPos(save);
2440 {
2441 Match match(false);
2442 Match* parentMatch16 = &match;
2443 {
2444 Match match(true);
2445 Match* parentMatch17 = &match;
2446 {
2447 System.Lex.Span span = lexer.GetSpan();
2448 Match match(false);
2449 if (*lexer == ASSIGN)
2450 {
2451 ++lexer;
2452 match.hit = true;
2453 }
2454 if (match.hit)
2455 {
2456 *parentMatch17 = match;
2457 }
2458 else
2459 {
2460 lexer.ThrowExpectationFailure(span, GetTokenName(ASSIGN));
2461 }
2462 }
2463 *parentMatch16 = match;
2464 }
2465 if (match.hit)
2466 {
2467 Match match(false);
2468 Match* parentMatch18 = &match;
2469 {
2470 Match match(false);
2471 Match* parentMatch19 = &match;
2472 {
2473 long pos = lexer.GetPos();
2474 Span span = lexer.GetSpan();
2475 Match match = IntermediateCodeFileParser.Constant(lexer, context);
2476 constant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
2477 if (match.hit)
2478 {
2479 context->AddGlobalVariable(type, variableName, constant.Release(), span.line, once);
2480 }
2481 *parentMatch19 = match;
2482 }
2483 *parentMatch18 = match;
2484 }
2485 *parentMatch16 = match;
2486 }
2487 *parentMatch15 = match;
2488 }
2489 *parentMatch13 = match;
2490 }
2491 }
2492 *parentMatch12 = match;
2493 }
2494 *parentMatch11 = match;
2495 }
2496 *parentMatch0 = match;
2497 }
2498 #if (DEBUG)
2499 if (writeToLog)
2500 {
2501 if (match.hit)
2502 {
2503 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"DataDefinition");
2504 }
2505 else
2506 {
2507 System.Lex.WriteFailureToLog(lexer, u"DataDefinition");
2508 }
2509 }
2510 #endif
2511 if (!match.hit)
2512 {
2513 match.value = null;
2514 }
2515 return match;
2516 }
2517 public static Match Functions(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
2518 {
2519 #if (DEBUG)
2520 Span debugSpan;
2521 bool writeToLog = lexer.Log() != null;
2522 if (writeToLog)
2523 {
2524 debugSpan = lexer.GetSpan();
2525 System.Lex.WriteBeginRuleToLog(lexer, u"Functions");
2526 }
2527 #endif
2528 Match match(true);
2529 Match* parentMatch0 = &match;
2530 {
2531 while (true)
2532 {
2533 long save = lexer.GetPos();
2534 {
2535 Match match = IntermediateCodeFileParser.Function(lexer, context);
2536 if (match.hit)
2537 {
2538 *parentMatch0 = match;
2539 }
2540 else
2541 {
2542 lexer.SetPos(save);
2543 break;
2544 }
2545 }
2546 }
2547 }
2548 #if (DEBUG)
2549 if (writeToLog)
2550 {
2551 if (match.hit)
2552 {
2553 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Functions");
2554 }
2555 else
2556 {
2557 System.Lex.WriteFailureToLog(lexer, u"Functions");
2558 }
2559 }
2560 #endif
2561 if (!match.hit)
2562 {
2563 match.value = null;
2564 }
2565 return match;
2566 }
2567 public static Match Function(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
2568 {
2569 #if (DEBUG)
2570 Span debugSpan;
2571 bool writeToLog = lexer.Log() != null;
2572 if (writeToLog)
2573 {
2574 debugSpan = lexer.GetSpan();
2575 System.Lex.WriteBeginRuleToLog(lexer, u"Function");
2576 }
2577 #endif
2578 cmsx.intermediate.Function* function;
2579 UniquePtr<cmsx.intermediate.Function> fun;
2580 Match match(false);
2581 Match* parentMatch0 = &match;
2582 {
2583 Match match(false);
2584 Match* parentMatch1 = &match;
2585 {
2586 Match match(false);
2587 Match* parentMatch2 = &match;
2588 {
2589 Match match(false);
2590 Match* parentMatch3 = &match;
2591 {
2592 long pos = lexer.GetPos();
2593 Match match = IntermediateCodeFileParser.FunctionHeader(lexer, context);
2594 fun.Reset(cast<cmsx.intermediate.Function*>(match.value));
2595 if (match.hit)
2596 {
2597 function = fun.Release();
2598 context->SetCurrentFunction(function);
2599 }
2600 *parentMatch3 = match;
2601 }
2602 *parentMatch2 = match;
2603 }
2604 if (match.hit)
2605 {
2606 Match match(false);
2607 Match* parentMatch4 = &match;
2608 {
2609 Match match(true);
2610 Match* parentMatch5 = &match;
2611 {
2612 System.Lex.Span span = lexer.GetSpan();
2613 Match match(false);
2614 if (*lexer == LBRACE)
2615 {
2616 ++lexer;
2617 match.hit = true;
2618 }
2619 if (match.hit)
2620 {
2621 *parentMatch5 = match;
2622 }
2623 else
2624 {
2625 lexer.ThrowExpectationFailure(span, GetTokenName(LBRACE));
2626 }
2627 }
2628 *parentMatch4 = match;
2629 }
2630 *parentMatch2 = match;
2631 }
2632 *parentMatch1 = match;
2633 }
2634 if (match.hit)
2635 {
2636 Match match(false);
2637 Match* parentMatch6 = &match;
2638 {
2639 Match match(true);
2640 Match* parentMatch7 = &match;
2641 {
2642 while (true)
2643 {
2644 long save = lexer.GetPos();
2645 {
2646 Match match = IntermediateCodeFileParser.BasicBlock(lexer, context, function);
2647 if (match.hit)
2648 {
2649 *parentMatch7 = match;
2650 }
2651 else
2652 {
2653 lexer.SetPos(save);
2654 break;
2655 }
2656 }
2657 }
2658 }
2659 *parentMatch6 = match;
2660 }
2661 *parentMatch1 = match;
2662 }
2663 *parentMatch0 = match;
2664 }
2665 if (match.hit)
2666 {
2667 Match match(false);
2668 Match* parentMatch8 = &match;
2669 {
2670 Match match(true);
2671 Match* parentMatch9 = &match;
2672 {
2673 System.Lex.Span span = lexer.GetSpan();
2674 Match match(false);
2675 if (*lexer == RBRACE)
2676 {
2677 ++lexer;
2678 match.hit = true;
2679 }
2680 if (match.hit)
2681 {
2682 *parentMatch9 = match;
2683 }
2684 else
2685 {
2686 lexer.ThrowExpectationFailure(span, GetTokenName(RBRACE));
2687 }
2688 }
2689 *parentMatch8 = match;
2690 }
2691 *parentMatch0 = match;
2692 }
2693 #if (DEBUG)
2694 if (writeToLog)
2695 {
2696 if (match.hit)
2697 {
2698 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Function");
2699 }
2700 else
2701 {
2702 System.Lex.WriteFailureToLog(lexer, u"Function");
2703 }
2704 }
2705 #endif
2706 if (!match.hit)
2707 {
2708 match.value = null;
2709 }
2710 return match;
2711 }
2712 public static Match FunctionHeader(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
2713 {
2714 #if (DEBUG)
2715 Span debugSpan;
2716 bool writeToLog = lexer.Log() != null;
2717 if (writeToLog)
2718 {
2719 debugSpan = lexer.GetSpan();
2720 System.Lex.WriteBeginRuleToLog(lexer, u"FunctionHeader");
2721 }
2722 #endif
2723 bool once;
2724 string functionId;
2725 cmsx.intermediate.Type* functionType;
2726 UniquePtr<cmsx.intermediate.Type> t;
2727 UniquePtr<cmsx.intermediate.MDStructRef> md;
2728 Match match(false);
2729 Match* parentMatch0 = &match;
2730 {
2731 Match match(false);
2732 Match* parentMatch1 = &match;
2733 {
2734 Match match(false);
2735 Match* parentMatch2 = &match;
2736 {
2737 Match match(false);
2738 Match* parentMatch3 = &match;
2739 {
2740 Match match(false);
2741 if (*lexer == FUNCTION)
2742 {
2743 ++lexer;
2744 match.hit = true;
2745 }
2746 *parentMatch3 = match;
2747 }
2748 if (match.hit)
2749 {
2750 Match match(false);
2751 Match* parentMatch4 = &match;
2752 {
2753 Match match(false);
2754 Match* parentMatch5 = &match;
2755 {
2756 long pos = lexer.GetPos();
2757 Match match(true);
2758 Match* parentMatch6 = &match;
2759 {
2760 System.Lex.Span span = lexer.GetSpan();
2761 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
2762 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
2763 if (match.hit)
2764 {
2765 *parentMatch6 = match;
2766 }
2767 else
2768 {
2769 lexer.ThrowExpectationFailure(span, u"TypeExpr");
2770 }
2771 }
2772 if (match.hit)
2773 {
2774 functionType = t.Release();
2775 }
2776 *parentMatch5 = match;
2777 }
2778 *parentMatch4 = match;
2779 }
2780 *parentMatch3 = match;
2781 }
2782 *parentMatch2 = match;
2783 }
2784 if (match.hit)
2785 {
2786 Match match(false);
2787 Match* parentMatch7 = &match;
2788 {
2789 Match match(true);
2790 long save = lexer.GetPos();
2791 Match* parentMatch8 = &match;
2792 {
2793 Match match(false);
2794 Match* parentMatch9 = &match;
2795 {
2796 Match match(false);
2797 Match* parentMatch10 = &match;
2798 {
2799 long pos = lexer.GetPos();
2800 Match match(false);
2801 if (*lexer == ONCE)
2802 {
2803 ++lexer;
2804 match.hit = true;
2805 }
2806 if (match.hit)
2807 {
2808 once = true;
2809 }
2810 *parentMatch10 = match;
2811 }
2812 *parentMatch9 = match;
2813 }
2814 if (match.hit)
2815 {
2816 *parentMatch8 = match;
2817 }
2818 else
2819 {
2820 lexer.SetPos(save);
2821 }
2822 }
2823 *parentMatch7 = match;
2824 }
2825 *parentMatch2 = match;
2826 }
2827 *parentMatch1 = match;
2828 }
2829 if (match.hit)
2830 {
2831 Match match(false);
2832 Match* parentMatch11 = &match;
2833 {
2834 Match match(false);
2835 Match* parentMatch12 = &match;
2836 {
2837 long pos = lexer.GetPos();
2838 Match match(true);
2839 Match* parentMatch13 = &match;
2840 {
2841 System.Lex.Span span = lexer.GetSpan();
2842 Match match(false);
2843 if (*lexer == ID)
2844 {
2845 ++lexer;
2846 match.hit = true;
2847 }
2848 if (match.hit)
2849 {
2850 *parentMatch13 = match;
2851 }
2852 else
2853 {
2854 lexer.ThrowExpectationFailure(span, GetTokenName(ID));
2855 }
2856 }
2857 if (match.hit)
2858 {
2859 functionId = ToUtf8(lexer.GetToken(pos).match.ToString());
2860 }
2861 *parentMatch12 = match;
2862 }
2863 *parentMatch11 = match;
2864 }
2865 *parentMatch1 = match;
2866 }
2867 *parentMatch0 = match;
2868 }
2869 if (match.hit)
2870 {
2871 Match match(false);
2872 Match* parentMatch14 = &match;
2873 {
2874 Match match(false);
2875 Match* parentMatch15 = &match;
2876 {
2877 long pos = lexer.GetPos();
2878 Span span = lexer.GetSpan();
2879 Match match(false);
2880 Match* parentMatch16 = &match;
2881 {
2882 Match match(true);
2883 long save = lexer.GetPos();
2884 Match* parentMatch17 = &match;
2885 {
2886 Match match = IntermediateCodeFileParser.MDStructRef(lexer, context);
2887 md.Reset(cast<cmsx.intermediate.MDStructRef*>(match.value));
2888 if (match.hit)
2889 {
2890 *parentMatch17 = match;
2891 }
2892 else
2893 {
2894 lexer.SetPos(save);
2895 }
2896 }
2897 *parentMatch16 = match;
2898 }
2899 if (match.hit)
2900 {
2901 {
2902 #if (DEBUG)
2903 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FunctionHeader");
2904 #endif
2905 return Match(true, context->AddFunction(span.line, functionType, functionId, once, md.Release()));
2906 }
2907 }
2908 *parentMatch15 = match;
2909 }
2910 *parentMatch14 = match;
2911 }
2912 *parentMatch0 = match;
2913 }
2914 #if (DEBUG)
2915 if (writeToLog)
2916 {
2917 if (match.hit)
2918 {
2919 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FunctionHeader");
2920 }
2921 else
2922 {
2923 System.Lex.WriteFailureToLog(lexer, u"FunctionHeader");
2924 }
2925 }
2926 #endif
2927 if (!match.hit)
2928 {
2929 match.value = null;
2930 }
2931 return match;
2932 }
2933 public static Match BasicBlock(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Function* function)
2934 {
2935 #if (DEBUG)
2936 Span debugSpan;
2937 bool writeToLog = lexer.Log() != null;
2938 if (writeToLog)
2939 {
2940 debugSpan = lexer.GetSpan();
2941 System.Lex.WriteBeginRuleToLog(lexer, u"BasicBlock");
2942 }
2943 #endif
2944 cmsx.intermediate.BasicBlock* bb;
2945 UniquePtr<Value<uint>> id;
2946 Match match(false);
2947 Match* parentMatch0 = &match;
2948 {
2949 Match match(false);
2950 Match* parentMatch1 = &match;
2951 {
2952 long pos = lexer.GetPos();
2953 Match match = IntermediateCodeFileParser.Label(lexer);
2954 id.Reset(cast<Value<uint>*>(match.value));
2955 if (match.hit)
2956 {
2957 bb = function->AddBasicBlock(id->value);
2958 }
2959 *parentMatch1 = match;
2960 }
2961 *parentMatch0 = match;
2962 }
2963 if (match.hit)
2964 {
2965 Match match(false);
2966 Match* parentMatch2 = &match;
2967 {
2968 Match match = IntermediateCodeFileParser.Instructions(lexer, context, bb);
2969 *parentMatch2 = match;
2970 }
2971 *parentMatch0 = match;
2972 }
2973 #if (DEBUG)
2974 if (writeToLog)
2975 {
2976 if (match.hit)
2977 {
2978 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BasicBlock");
2979 }
2980 else
2981 {
2982 System.Lex.WriteFailureToLog(lexer, u"BasicBlock");
2983 }
2984 }
2985 #endif
2986 if (!match.hit)
2987 {
2988 match.value = null;
2989 }
2990 return match;
2991 }
2992 public static Match Label(IntermediateCodeLexer& lexer)
2993 {
2994 #if (DEBUG)
2995 Span debugSpan;
2996 bool writeToLog = lexer.Log() != null;
2997 if (writeToLog)
2998 {
2999 debugSpan = lexer.GetSpan();
3000 System.Lex.WriteBeginRuleToLog(lexer, u"Label");
3001 }
3002 #endif
3003 Match match(false);
3004 Match* parentMatch0 = &match;
3005 {
3006 Match match(false);
3007 if (*lexer == AT)
3008 {
3009 ++lexer;
3010 match.hit = true;
3011 }
3012 *parentMatch0 = match;
3013 }
3014 if (match.hit)
3015 {
3016 Match match(false);
3017 Match* parentMatch1 = &match;
3018 {
3019 Match match(false);
3020 Match* parentMatch2 = &match;
3021 {
3022 long pos = lexer.GetPos();
3023 Match match(false);
3024 if (*lexer == NUMBER)
3025 {
3026 ++lexer;
3027 match.hit = true;
3028 }
3029 if (match.hit)
3030 {
3031 {
3032 #if (DEBUG)
3033 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Label");
3034 #endif
3035 return Match(true, new Value<uint>(ParseUInt(ToUtf8(lexer.GetToken(pos).match.ToString()))));
3036 }
3037 }
3038 *parentMatch2 = match;
3039 }
3040 *parentMatch1 = match;
3041 }
3042 *parentMatch0 = match;
3043 }
3044 #if (DEBUG)
3045 if (writeToLog)
3046 {
3047 if (match.hit)
3048 {
3049 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Label");
3050 }
3051 else
3052 {
3053 System.Lex.WriteFailureToLog(lexer, u"Label");
3054 }
3055 }
3056 #endif
3057 if (!match.hit)
3058 {
3059 match.value = null;
3060 }
3061 return match;
3062 }
3063 public static Match Instructions(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.BasicBlock* bb)
3064 {
3065 #if (DEBUG)
3066 Span debugSpan;
3067 bool writeToLog = lexer.Log() != null;
3068 if (writeToLog)
3069 {
3070 debugSpan = lexer.GetSpan();
3071 System.Lex.WriteBeginRuleToLog(lexer, u"Instructions");
3072 }
3073 #endif
3074 UniquePtr<cmsx.intermediate.Instruction> instruction;
3075 UniquePtr<cmsx.intermediate.MDStructRef> lineInfo;
3076 Match match(false);
3077 Match* parentMatch0 = &match;
3078 {
3079 Match match(false);
3080 Match* parentMatch1 = &match;
3081 {
3082 Match match(false);
3083 Match* parentMatch2 = &match;
3084 {
3085 long pos = lexer.GetPos();
3086 Match match(false);
3087 Match* parentMatch3 = &match;
3088 {
3089 Match match(false);
3090 Match* parentMatch4 = &match;
3091 {
3092 Match match = IntermediateCodeFileParser.Instruction(lexer, context);
3093 instruction.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
3094 *parentMatch4 = match;
3095 }
3096 if (match.hit)
3097 {
3098 Match match(false);
3099 Match* parentMatch5 = &match;
3100 {
3101 Match match(true);
3102 long save = lexer.GetPos();
3103 Match* parentMatch6 = &match;
3104 {
3105 Match match(false);
3106 Match* parentMatch7 = &match;
3107 {
3108 Match match = IntermediateCodeFileParser.MDStructRef(lexer, context);
3109 lineInfo.Reset(cast<cmsx.intermediate.MDStructRef*>(match.value));
3110 *parentMatch7 = match;
3111 }
3112 if (match.hit)
3113 {
3114 *parentMatch6 = match;
3115 }
3116 else
3117 {
3118 lexer.SetPos(save);
3119 }
3120 }
3121 *parentMatch5 = match;
3122 }
3123 *parentMatch4 = match;
3124 }
3125 *parentMatch3 = match;
3126 }
3127 if (match.hit)
3128 {
3129 bb->AddInstruction(instruction.Release(), lineInfo.Release());
3130 }
3131 *parentMatch2 = match;
3132 }
3133 *parentMatch1 = match;
3134 }
3135 *parentMatch0 = match;
3136 }
3137 if (match.hit)
3138 {
3139 Match match(true);
3140 Match* parentMatch8 = &match;
3141 while (true)
3142 {
3143 long save = lexer.GetPos();
3144 {
3145 Match match(false);
3146 Match* parentMatch9 = &match;
3147 {
3148 Match match(false);
3149 Match* parentMatch10 = &match;
3150 {
3151 long pos = lexer.GetPos();
3152 Match match(false);
3153 Match* parentMatch11 = &match;
3154 {
3155 Match match(false);
3156 Match* parentMatch12 = &match;
3157 {
3158 Match match = IntermediateCodeFileParser.Instruction(lexer, context);
3159 instruction.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
3160 *parentMatch12 = match;
3161 }
3162 if (match.hit)
3163 {
3164 Match match(false);
3165 Match* parentMatch13 = &match;
3166 {
3167 Match match(true);
3168 long save = lexer.GetPos();
3169 Match* parentMatch14 = &match;
3170 {
3171 Match match(false);
3172 Match* parentMatch15 = &match;
3173 {
3174 Match match = IntermediateCodeFileParser.MDStructRef(lexer, context);
3175 lineInfo.Reset(cast<cmsx.intermediate.MDStructRef*>(match.value));
3176 *parentMatch15 = match;
3177 }
3178 if (match.hit)
3179 {
3180 *parentMatch14 = match;
3181 }
3182 else
3183 {
3184 lexer.SetPos(save);
3185 }
3186 }
3187 *parentMatch13 = match;
3188 }
3189 *parentMatch12 = match;
3190 }
3191 *parentMatch11 = match;
3192 }
3193 if (match.hit)
3194 {
3195 bb->AddInstruction(instruction.Release(), lineInfo.Release());
3196 }
3197 *parentMatch10 = match;
3198 }
3199 *parentMatch9 = match;
3200 }
3201 if (match.hit)
3202 {
3203 *parentMatch8 = match;
3204 }
3205 else
3206 {
3207 lexer.SetPos(save);
3208 break;
3209 }
3210 }
3211 }
3212 }
3213 #if (DEBUG)
3214 if (writeToLog)
3215 {
3216 if (match.hit)
3217 {
3218 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instructions");
3219 }
3220 else
3221 {
3222 System.Lex.WriteFailureToLog(lexer, u"Instructions");
3223 }
3224 }
3225 #endif
3226 if (!match.hit)
3227 {
3228 match.value = null;
3229 }
3230 return match;
3231 }
3232 public static Match Instruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
3233 {
3234 #if (DEBUG)
3235 Span debugSpan;
3236 bool writeToLog = lexer.Log() != null;
3237 if (writeToLog)
3238 {
3239 debugSpan = lexer.GetSpan();
3240 System.Lex.WriteBeginRuleToLog(lexer, u"Instruction");
3241 }
3242 #endif
3243 UniquePtr<cmsx.intermediate.Instruction> store;
3244 UniquePtr<cmsx.intermediate.Instruction> arg;
3245 UniquePtr<cmsx.intermediate.Instruction> jmp;
3246 UniquePtr<cmsx.intermediate.Instruction> branch;
3247 UniquePtr<cmsx.intermediate.Instruction> call;
3248 UniquePtr<cmsx.intermediate.Instruction> ret;
3249 UniquePtr<cmsx.intermediate.SwitchInstruction> swtch;
3250 UniquePtr<cmsx.intermediate.Instruction> valueInst;
3251 UniquePtr<cmsx.intermediate.Instruction> nopInst;
3252 UniquePtr<cmsx.intermediate.Instruction> saveInst;
3253 Match match(false);
3254 Match* parentMatch0 = &match;
3255 {
3256 long save = lexer.GetPos();
3257 Match match(false);
3258 Match* parentMatch1 = &match;
3259 {
3260 long save = lexer.GetPos();
3261 Match match(false);
3262 Match* parentMatch2 = &match;
3263 {
3264 long save = lexer.GetPos();
3265 Match match(false);
3266 Match* parentMatch3 = &match;
3267 {
3268 long save = lexer.GetPos();
3269 Match match(false);
3270 Match* parentMatch4 = &match;
3271 {
3272 long save = lexer.GetPos();
3273 Match match(false);
3274 Match* parentMatch5 = &match;
3275 {
3276 long save = lexer.GetPos();
3277 Match match(false);
3278 Match* parentMatch6 = &match;
3279 {
3280 long save = lexer.GetPos();
3281 Match match(false);
3282 Match* parentMatch7 = &match;
3283 {
3284 long save = lexer.GetPos();
3285 Match match(false);
3286 Match* parentMatch8 = &match;
3287 {
3288 long save = lexer.GetPos();
3289 Match match(false);
3290 Match* parentMatch9 = &match;
3291 {
3292 long pos = lexer.GetPos();
3293 Match match = IntermediateCodeFileParser.StoreInstruction(lexer, context);
3294 store.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
3295 if (match.hit)
3296 {
3297 {
3298 #if (DEBUG)
3299 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instruction");
3300 #endif
3301 return Match(true, store.Release());
3302 }
3303 }
3304 *parentMatch9 = match;
3305 }
3306 *parentMatch8 = match;
3307 if (!match.hit)
3308 {
3309 Match match(false);
3310 Match* parentMatch10 = &match;
3311 lexer.SetPos(save);
3312 {
3313 Match match(false);
3314 Match* parentMatch11 = &match;
3315 {
3316 long pos = lexer.GetPos();
3317 Match match = IntermediateCodeFileParser.ArgInstruction(lexer, context);
3318 arg.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
3319 if (match.hit)
3320 {
3321 {
3322 #if (DEBUG)
3323 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instruction");
3324 #endif
3325 return Match(true, arg.Release());
3326 }
3327 }
3328 *parentMatch11 = match;
3329 }
3330 *parentMatch10 = match;
3331 }
3332 *parentMatch8 = match;
3333 }
3334 }
3335 *parentMatch7 = match;
3336 if (!match.hit)
3337 {
3338 Match match(false);
3339 Match* parentMatch12 = &match;
3340 lexer.SetPos(save);
3341 {
3342 Match match(false);
3343 Match* parentMatch13 = &match;
3344 {
3345 long pos = lexer.GetPos();
3346 Match match = IntermediateCodeFileParser.JumpInstruction(lexer, context);
3347 jmp.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
3348 if (match.hit)
3349 {
3350 {
3351 #if (DEBUG)
3352 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instruction");
3353 #endif
3354 return Match(true, jmp.Release());
3355 }
3356 }
3357 *parentMatch13 = match;
3358 }
3359 *parentMatch12 = match;
3360 }
3361 *parentMatch7 = match;
3362 }
3363 }
3364 *parentMatch6 = match;
3365 if (!match.hit)
3366 {
3367 Match match(false);
3368 Match* parentMatch14 = &match;
3369 lexer.SetPos(save);
3370 {
3371 Match match(false);
3372 Match* parentMatch15 = &match;
3373 {
3374 long pos = lexer.GetPos();
3375 Match match = IntermediateCodeFileParser.BranchInstruction(lexer, context);
3376 branch.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
3377 if (match.hit)
3378 {
3379 {
3380 #if (DEBUG)
3381 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instruction");
3382 #endif
3383 return Match(true, branch.Release());
3384 }
3385 }
3386 *parentMatch15 = match;
3387 }
3388 *parentMatch14 = match;
3389 }
3390 *parentMatch6 = match;
3391 }
3392 }
3393 *parentMatch5 = match;
3394 if (!match.hit)
3395 {
3396 Match match(false);
3397 Match* parentMatch16 = &match;
3398 lexer.SetPos(save);
3399 {
3400 Match match(false);
3401 Match* parentMatch17 = &match;
3402 {
3403 long pos = lexer.GetPos();
3404 Match match = IntermediateCodeFileParser.ProcedureCallInstruction(lexer, context);
3405 call.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
3406 if (match.hit)
3407 {
3408 {
3409 #if (DEBUG)
3410 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instruction");
3411 #endif
3412 return Match(true, call.Release());
3413 }
3414 }
3415 *parentMatch17 = match;
3416 }
3417 *parentMatch16 = match;
3418 }
3419 *parentMatch5 = match;
3420 }
3421 }
3422 *parentMatch4 = match;
3423 if (!match.hit)
3424 {
3425 Match match(false);
3426 Match* parentMatch18 = &match;
3427 lexer.SetPos(save);
3428 {
3429 Match match(false);
3430 Match* parentMatch19 = &match;
3431 {
3432 long pos = lexer.GetPos();
3433 Match match = IntermediateCodeFileParser.RetInstruction(lexer, context);
3434 ret.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
3435 if (match.hit)
3436 {
3437 {
3438 #if (DEBUG)
3439 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instruction");
3440 #endif
3441 return Match(true, ret.Release());
3442 }
3443 }
3444 *parentMatch19 = match;
3445 }
3446 *parentMatch18 = match;
3447 }
3448 *parentMatch4 = match;
3449 }
3450 }
3451 *parentMatch3 = match;
3452 if (!match.hit)
3453 {
3454 Match match(false);
3455 Match* parentMatch20 = &match;
3456 lexer.SetPos(save);
3457 {
3458 Match match(false);
3459 Match* parentMatch21 = &match;
3460 {
3461 long pos = lexer.GetPos();
3462 Match match = IntermediateCodeFileParser.SwitchInstruction(lexer, context);
3463 swtch.Reset(cast<cmsx.intermediate.SwitchInstruction*>(match.value));
3464 if (match.hit)
3465 {
3466 {
3467 #if (DEBUG)
3468 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instruction");
3469 #endif
3470 return Match(true, swtch.Release());
3471 }
3472 }
3473 *parentMatch21 = match;
3474 }
3475 *parentMatch20 = match;
3476 }
3477 *parentMatch3 = match;
3478 }
3479 }
3480 *parentMatch2 = match;
3481 if (!match.hit)
3482 {
3483 Match match(false);
3484 Match* parentMatch22 = &match;
3485 lexer.SetPos(save);
3486 {
3487 Match match(false);
3488 Match* parentMatch23 = &match;
3489 {
3490 long pos = lexer.GetPos();
3491 Match match = IntermediateCodeFileParser.ValueInstruction(lexer, context);
3492 valueInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
3493 if (match.hit)
3494 {
3495 {
3496 #if (DEBUG)
3497 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instruction");
3498 #endif
3499 return Match(true, valueInst.Release());
3500 }
3501 }
3502 *parentMatch23 = match;
3503 }
3504 *parentMatch22 = match;
3505 }
3506 *parentMatch2 = match;
3507 }
3508 }
3509 *parentMatch1 = match;
3510 if (!match.hit)
3511 {
3512 Match match(false);
3513 Match* parentMatch24 = &match;
3514 lexer.SetPos(save);
3515 {
3516 Match match(false);
3517 Match* parentMatch25 = &match;
3518 {
3519 long pos = lexer.GetPos();
3520 Match match = IntermediateCodeFileParser.NoOperationInstruction(lexer, context);
3521 nopInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
3522 if (match.hit)
3523 {
3524 {
3525 #if (DEBUG)
3526 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instruction");
3527 #endif
3528 return Match(true, nopInst.Release());
3529 }
3530 }
3531 *parentMatch25 = match;
3532 }
3533 *parentMatch24 = match;
3534 }
3535 *parentMatch1 = match;
3536 }
3537 }
3538 *parentMatch0 = match;
3539 if (!match.hit)
3540 {
3541 Match match(false);
3542 Match* parentMatch26 = &match;
3543 lexer.SetPos(save);
3544 {
3545 Match match(false);
3546 Match* parentMatch27 = &match;
3547 {
3548 long pos = lexer.GetPos();
3549 Match match = IntermediateCodeFileParser.SaveInstruction(lexer, context);
3550 saveInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
3551 if (match.hit)
3552 {
3553 {
3554 #if (DEBUG)
3555 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instruction");
3556 #endif
3557 return Match(true, saveInst.Release());
3558 }
3559 }
3560 *parentMatch27 = match;
3561 }
3562 *parentMatch26 = match;
3563 }
3564 *parentMatch0 = match;
3565 }
3566 }
3567 #if (DEBUG)
3568 if (writeToLog)
3569 {
3570 if (match.hit)
3571 {
3572 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Instruction");
3573 }
3574 else
3575 {
3576 System.Lex.WriteFailureToLog(lexer, u"Instruction");
3577 }
3578 }
3579 #endif
3580 if (!match.hit)
3581 {
3582 match.value = null;
3583 }
3584 return match;
3585 }
3586 public static Match StoreInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
3587 {
3588 #if (DEBUG)
3589 Span debugSpan;
3590 bool writeToLog = lexer.Log() != null;
3591 if (writeToLog)
3592 {
3593 debugSpan = lexer.GetSpan();
3594 System.Lex.WriteBeginRuleToLog(lexer, u"StoreInstruction");
3595 }
3596 #endif
3597 cmsx.intermediate.Type* type;
3598 cmsx.intermediate.Type* ptrType;
3599 UniquePtr<cmsx.intermediate.Type> t;
3600 UniquePtr<cmsx.intermediate.Value> val;
3601 UniquePtr<cmsx.intermediate.Type> pt;
3602 UniquePtr<cmsx.intermediate.Value> ptr;
3603 Match match(false);
3604 Match* parentMatch0 = &match;
3605 {
3606 Match match(false);
3607 Match* parentMatch1 = &match;
3608 {
3609 Match match(false);
3610 Match* parentMatch2 = &match;
3611 {
3612 Match match(false);
3613 Match* parentMatch3 = &match;
3614 {
3615 Match match(false);
3616 Match* parentMatch4 = &match;
3617 {
3618 Match match(false);
3619 if (*lexer == STORE)
3620 {
3621 ++lexer;
3622 match.hit = true;
3623 }
3624 *parentMatch4 = match;
3625 }
3626 if (match.hit)
3627 {
3628 Match match(false);
3629 Match* parentMatch5 = &match;
3630 {
3631 Match match(false);
3632 Match* parentMatch6 = &match;
3633 {
3634 long pos = lexer.GetPos();
3635 Match match(true);
3636 Match* parentMatch7 = &match;
3637 {
3638 System.Lex.Span span = lexer.GetSpan();
3639 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
3640 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
3641 if (match.hit)
3642 {
3643 *parentMatch7 = match;
3644 }
3645 else
3646 {
3647 lexer.ThrowExpectationFailure(span, u"TypeExpr");
3648 }
3649 }
3650 if (match.hit)
3651 {
3652 type = t.Release();
3653 }
3654 *parentMatch6 = match;
3655 }
3656 *parentMatch5 = match;
3657 }
3658 *parentMatch4 = match;
3659 }
3660 *parentMatch3 = match;
3661 }
3662 if (match.hit)
3663 {
3664 Match match(false);
3665 Match* parentMatch8 = &match;
3666 {
3667 Match match(true);
3668 Match* parentMatch9 = &match;
3669 {
3670 System.Lex.Span span = lexer.GetSpan();
3671 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, type);
3672 val.Reset(cast<cmsx.intermediate.Value*>(match.value));
3673 if (match.hit)
3674 {
3675 *parentMatch9 = match;
3676 }
3677 else
3678 {
3679 lexer.ThrowExpectationFailure(span, u"TypedValue");
3680 }
3681 }
3682 *parentMatch8 = match;
3683 }
3684 *parentMatch3 = match;
3685 }
3686 *parentMatch2 = match;
3687 }
3688 if (match.hit)
3689 {
3690 Match match(false);
3691 Match* parentMatch10 = &match;
3692 {
3693 Match match(true);
3694 Match* parentMatch11 = &match;
3695 {
3696 System.Lex.Span span = lexer.GetSpan();
3697 Match match(false);
3698 if (*lexer == COMMA)
3699 {
3700 ++lexer;
3701 match.hit = true;
3702 }
3703 if (match.hit)
3704 {
3705 *parentMatch11 = match;
3706 }
3707 else
3708 {
3709 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
3710 }
3711 }
3712 *parentMatch10 = match;
3713 }
3714 *parentMatch2 = match;
3715 }
3716 *parentMatch1 = match;
3717 }
3718 if (match.hit)
3719 {
3720 Match match(false);
3721 Match* parentMatch12 = &match;
3722 {
3723 Match match(false);
3724 Match* parentMatch13 = &match;
3725 {
3726 long pos = lexer.GetPos();
3727 Match match(true);
3728 Match* parentMatch14 = &match;
3729 {
3730 System.Lex.Span span = lexer.GetSpan();
3731 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
3732 pt.Reset(cast<cmsx.intermediate.Type*>(match.value));
3733 if (match.hit)
3734 {
3735 *parentMatch14 = match;
3736 }
3737 else
3738 {
3739 lexer.ThrowExpectationFailure(span, u"TypeExpr");
3740 }
3741 }
3742 if (match.hit)
3743 {
3744 ptrType = pt.Release();
3745 }
3746 *parentMatch13 = match;
3747 }
3748 *parentMatch12 = match;
3749 }
3750 *parentMatch1 = match;
3751 }
3752 *parentMatch0 = match;
3753 }
3754 if (match.hit)
3755 {
3756 Match match(false);
3757 Match* parentMatch15 = &match;
3758 {
3759 Match match(false);
3760 Match* parentMatch16 = &match;
3761 {
3762 long pos = lexer.GetPos();
3763 Span span = lexer.GetSpan();
3764 Match match(true);
3765 Match* parentMatch17 = &match;
3766 {
3767 System.Lex.Span span = lexer.GetSpan();
3768 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, ptrType);
3769 ptr.Reset(cast<cmsx.intermediate.Value*>(match.value));
3770 if (match.hit)
3771 {
3772 *parentMatch17 = match;
3773 }
3774 else
3775 {
3776 lexer.ThrowExpectationFailure(span, u"TypedValue");
3777 }
3778 }
3779 if (match.hit)
3780 {
3781 {
3782 #if (DEBUG)
3783 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StoreInstruction");
3784 #endif
3785 return Match(true, new cmsx.intermediate.StoreInstruction(val.Release(), ptr.Release(), span.line));
3786 }
3787 }
3788 *parentMatch16 = match;
3789 }
3790 *parentMatch15 = match;
3791 }
3792 *parentMatch0 = match;
3793 }
3794 #if (DEBUG)
3795 if (writeToLog)
3796 {
3797 if (match.hit)
3798 {
3799 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StoreInstruction");
3800 }
3801 else
3802 {
3803 System.Lex.WriteFailureToLog(lexer, u"StoreInstruction");
3804 }
3805 }
3806 #endif
3807 if (!match.hit)
3808 {
3809 match.value = null;
3810 }
3811 return match;
3812 }
3813 public static Match ArgInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
3814 {
3815 #if (DEBUG)
3816 Span debugSpan;
3817 bool writeToLog = lexer.Log() != null;
3818 if (writeToLog)
3819 {
3820 debugSpan = lexer.GetSpan();
3821 System.Lex.WriteBeginRuleToLog(lexer, u"ArgInstruction");
3822 }
3823 #endif
3824 cmsx.intermediate.Type* type;
3825 UniquePtr<cmsx.intermediate.Type> t;
3826 UniquePtr<cmsx.intermediate.Value> arg;
3827 Match match(false);
3828 Match* parentMatch0 = &match;
3829 {
3830 Match match(false);
3831 Match* parentMatch1 = &match;
3832 {
3833 Match match(false);
3834 if (*lexer == ARG)
3835 {
3836 ++lexer;
3837 match.hit = true;
3838 }
3839 *parentMatch1 = match;
3840 }
3841 if (match.hit)
3842 {
3843 Match match(false);
3844 Match* parentMatch2 = &match;
3845 {
3846 Match match(false);
3847 Match* parentMatch3 = &match;
3848 {
3849 long pos = lexer.GetPos();
3850 Match match(true);
3851 Match* parentMatch4 = &match;
3852 {
3853 System.Lex.Span span = lexer.GetSpan();
3854 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
3855 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
3856 if (match.hit)
3857 {
3858 *parentMatch4 = match;
3859 }
3860 else
3861 {
3862 lexer.ThrowExpectationFailure(span, u"TypeExpr");
3863 }
3864 }
3865 if (match.hit)
3866 {
3867 type = t.Release();
3868 }
3869 *parentMatch3 = match;
3870 }
3871 *parentMatch2 = match;
3872 }
3873 *parentMatch1 = match;
3874 }
3875 *parentMatch0 = match;
3876 }
3877 if (match.hit)
3878 {
3879 Match match(false);
3880 Match* parentMatch5 = &match;
3881 {
3882 Match match(false);
3883 Match* parentMatch6 = &match;
3884 {
3885 long pos = lexer.GetPos();
3886 Span span = lexer.GetSpan();
3887 Match match(true);
3888 Match* parentMatch7 = &match;
3889 {
3890 System.Lex.Span span = lexer.GetSpan();
3891 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, type);
3892 arg.Reset(cast<cmsx.intermediate.Value*>(match.value));
3893 if (match.hit)
3894 {
3895 *parentMatch7 = match;
3896 }
3897 else
3898 {
3899 lexer.ThrowExpectationFailure(span, u"TypedValue");
3900 }
3901 }
3902 if (match.hit)
3903 {
3904 {
3905 #if (DEBUG)
3906 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ArgInstruction");
3907 #endif
3908 return Match(true, new cmsx.intermediate.ArgInstruction(arg.Release(), span.line));
3909 }
3910 }
3911 *parentMatch6 = match;
3912 }
3913 *parentMatch5 = match;
3914 }
3915 *parentMatch0 = match;
3916 }
3917 #if (DEBUG)
3918 if (writeToLog)
3919 {
3920 if (match.hit)
3921 {
3922 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ArgInstruction");
3923 }
3924 else
3925 {
3926 System.Lex.WriteFailureToLog(lexer, u"ArgInstruction");
3927 }
3928 }
3929 #endif
3930 if (!match.hit)
3931 {
3932 match.value = null;
3933 }
3934 return match;
3935 }
3936 public static Match JumpInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
3937 {
3938 #if (DEBUG)
3939 Span debugSpan;
3940 bool writeToLog = lexer.Log() != null;
3941 if (writeToLog)
3942 {
3943 debugSpan = lexer.GetSpan();
3944 System.Lex.WriteBeginRuleToLog(lexer, u"JumpInstruction");
3945 }
3946 #endif
3947 UniquePtr<Value<uint>> target;
3948 Match match(false);
3949 Match* parentMatch0 = &match;
3950 {
3951 Match match(false);
3952 if (*lexer == JMP)
3953 {
3954 ++lexer;
3955 match.hit = true;
3956 }
3957 *parentMatch0 = match;
3958 }
3959 if (match.hit)
3960 {
3961 Match match(false);
3962 Match* parentMatch1 = &match;
3963 {
3964 Match match(false);
3965 Match* parentMatch2 = &match;
3966 {
3967 long pos = lexer.GetPos();
3968 Span span = lexer.GetSpan();
3969 Match match(true);
3970 Match* parentMatch3 = &match;
3971 {
3972 System.Lex.Span span = lexer.GetSpan();
3973 Match match = IntermediateCodeFileParser.Label(lexer);
3974 target.Reset(cast<Value<uint>*>(match.value));
3975 if (match.hit)
3976 {
3977 *parentMatch3 = match;
3978 }
3979 else
3980 {
3981 lexer.ThrowExpectationFailure(span, u"Label");
3982 }
3983 }
3984 if (match.hit)
3985 {
3986 {
3987 #if (DEBUG)
3988 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"JumpInstruction");
3989 #endif
3990 return Match(true, new cmsx.intermediate.JumpInstruction(target->value, span.line));
3991 }
3992 }
3993 *parentMatch2 = match;
3994 }
3995 *parentMatch1 = match;
3996 }
3997 *parentMatch0 = match;
3998 }
3999 #if (DEBUG)
4000 if (writeToLog)
4001 {
4002 if (match.hit)
4003 {
4004 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"JumpInstruction");
4005 }
4006 else
4007 {
4008 System.Lex.WriteFailureToLog(lexer, u"JumpInstruction");
4009 }
4010 }
4011 #endif
4012 if (!match.hit)
4013 {
4014 match.value = null;
4015 }
4016 return match;
4017 }
4018 public static Match BranchInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
4019 {
4020 #if (DEBUG)
4021 Span debugSpan;
4022 bool writeToLog = lexer.Log() != null;
4023 if (writeToLog)
4024 {
4025 debugSpan = lexer.GetSpan();
4026 System.Lex.WriteBeginRuleToLog(lexer, u"BranchInstruction");
4027 }
4028 #endif
4029 cmsx.intermediate.Type* type;
4030 UniquePtr<cmsx.intermediate.Type> t;
4031 UniquePtr<cmsx.intermediate.Value> cond;
4032 UniquePtr<Value<uint>> trueTarget;
4033 UniquePtr<Value<uint>> falseTarget;
4034 Match match(false);
4035 Match* parentMatch0 = &match;
4036 {
4037 Match match(false);
4038 Match* parentMatch1 = &match;
4039 {
4040 Match match(false);
4041 Match* parentMatch2 = &match;
4042 {
4043 Match match(false);
4044 Match* parentMatch3 = &match;
4045 {
4046 Match match(false);
4047 Match* parentMatch4 = &match;
4048 {
4049 Match match(false);
4050 Match* parentMatch5 = &match;
4051 {
4052 Match match(false);
4053 if (*lexer == BRANCH)
4054 {
4055 ++lexer;
4056 match.hit = true;
4057 }
4058 *parentMatch5 = match;
4059 }
4060 if (match.hit)
4061 {
4062 Match match(false);
4063 Match* parentMatch6 = &match;
4064 {
4065 Match match(false);
4066 Match* parentMatch7 = &match;
4067 {
4068 long pos = lexer.GetPos();
4069 Match match(true);
4070 Match* parentMatch8 = &match;
4071 {
4072 System.Lex.Span span = lexer.GetSpan();
4073 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
4074 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
4075 if (match.hit)
4076 {
4077 *parentMatch8 = match;
4078 }
4079 else
4080 {
4081 lexer.ThrowExpectationFailure(span, u"TypeExpr");
4082 }
4083 }
4084 if (match.hit)
4085 {
4086 type = t.Release();
4087 }
4088 *parentMatch7 = match;
4089 }
4090 *parentMatch6 = match;
4091 }
4092 *parentMatch5 = match;
4093 }
4094 *parentMatch4 = match;
4095 }
4096 if (match.hit)
4097 {
4098 Match match(false);
4099 Match* parentMatch9 = &match;
4100 {
4101 Match match(true);
4102 Match* parentMatch10 = &match;
4103 {
4104 System.Lex.Span span = lexer.GetSpan();
4105 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, type);
4106 cond.Reset(cast<cmsx.intermediate.Value*>(match.value));
4107 if (match.hit)
4108 {
4109 *parentMatch10 = match;
4110 }
4111 else
4112 {
4113 lexer.ThrowExpectationFailure(span, u"TypedValue");
4114 }
4115 }
4116 *parentMatch9 = match;
4117 }
4118 *parentMatch4 = match;
4119 }
4120 *parentMatch3 = match;
4121 }
4122 if (match.hit)
4123 {
4124 Match match(false);
4125 Match* parentMatch11 = &match;
4126 {
4127 Match match(true);
4128 Match* parentMatch12 = &match;
4129 {
4130 System.Lex.Span span = lexer.GetSpan();
4131 Match match(false);
4132 if (*lexer == COMMA)
4133 {
4134 ++lexer;
4135 match.hit = true;
4136 }
4137 if (match.hit)
4138 {
4139 *parentMatch12 = match;
4140 }
4141 else
4142 {
4143 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
4144 }
4145 }
4146 *parentMatch11 = match;
4147 }
4148 *parentMatch3 = match;
4149 }
4150 *parentMatch2 = match;
4151 }
4152 if (match.hit)
4153 {
4154 Match match(false);
4155 Match* parentMatch13 = &match;
4156 {
4157 Match match(true);
4158 Match* parentMatch14 = &match;
4159 {
4160 System.Lex.Span span = lexer.GetSpan();
4161 Match match = IntermediateCodeFileParser.Label(lexer);
4162 trueTarget.Reset(cast<Value<uint>*>(match.value));
4163 if (match.hit)
4164 {
4165 *parentMatch14 = match;
4166 }
4167 else
4168 {
4169 lexer.ThrowExpectationFailure(span, u"Label");
4170 }
4171 }
4172 *parentMatch13 = match;
4173 }
4174 *parentMatch2 = match;
4175 }
4176 *parentMatch1 = match;
4177 }
4178 if (match.hit)
4179 {
4180 Match match(false);
4181 Match* parentMatch15 = &match;
4182 {
4183 Match match(true);
4184 Match* parentMatch16 = &match;
4185 {
4186 System.Lex.Span span = lexer.GetSpan();
4187 Match match(false);
4188 if (*lexer == COMMA)
4189 {
4190 ++lexer;
4191 match.hit = true;
4192 }
4193 if (match.hit)
4194 {
4195 *parentMatch16 = match;
4196 }
4197 else
4198 {
4199 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
4200 }
4201 }
4202 *parentMatch15 = match;
4203 }
4204 *parentMatch1 = match;
4205 }
4206 *parentMatch0 = match;
4207 }
4208 if (match.hit)
4209 {
4210 Match match(false);
4211 Match* parentMatch17 = &match;
4212 {
4213 Match match(false);
4214 Match* parentMatch18 = &match;
4215 {
4216 long pos = lexer.GetPos();
4217 Span span = lexer.GetSpan();
4218 Match match(true);
4219 Match* parentMatch19 = &match;
4220 {
4221 System.Lex.Span span = lexer.GetSpan();
4222 Match match = IntermediateCodeFileParser.Label(lexer);
4223 falseTarget.Reset(cast<Value<uint>*>(match.value));
4224 if (match.hit)
4225 {
4226 *parentMatch19 = match;
4227 }
4228 else
4229 {
4230 lexer.ThrowExpectationFailure(span, u"Label");
4231 }
4232 }
4233 if (match.hit)
4234 {
4235 {
4236 #if (DEBUG)
4237 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BranchInstruction");
4238 #endif
4239 return Match(true, new cmsx.intermediate.BranchInstruction(cond.Release(), trueTarget->value, falseTarget->value, span.line));
4240 }
4241 }
4242 *parentMatch18 = match;
4243 }
4244 *parentMatch17 = match;
4245 }
4246 *parentMatch0 = match;
4247 }
4248 #if (DEBUG)
4249 if (writeToLog)
4250 {
4251 if (match.hit)
4252 {
4253 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BranchInstruction");
4254 }
4255 else
4256 {
4257 System.Lex.WriteFailureToLog(lexer, u"BranchInstruction");
4258 }
4259 }
4260 #endif
4261 if (!match.hit)
4262 {
4263 match.value = null;
4264 }
4265 return match;
4266 }
4267 public static Match ProcedureCallInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
4268 {
4269 #if (DEBUG)
4270 Span debugSpan;
4271 bool writeToLog = lexer.Log() != null;
4272 if (writeToLog)
4273 {
4274 debugSpan = lexer.GetSpan();
4275 System.Lex.WriteBeginRuleToLog(lexer, u"ProcedureCallInstruction");
4276 }
4277 #endif
4278 cmsx.intermediate.Type* functionType;
4279 UniquePtr<cmsx.intermediate.Type> ft;
4280 UniquePtr<cmsx.intermediate.Value> callee;
4281 Match match(false);
4282 Match* parentMatch0 = &match;
4283 {
4284 Match match(false);
4285 Match* parentMatch1 = &match;
4286 {
4287 Match match(false);
4288 if (*lexer == CALL)
4289 {
4290 ++lexer;
4291 match.hit = true;
4292 }
4293 *parentMatch1 = match;
4294 }
4295 if (match.hit)
4296 {
4297 Match match(false);
4298 Match* parentMatch2 = &match;
4299 {
4300 Match match(false);
4301 Match* parentMatch3 = &match;
4302 {
4303 long pos = lexer.GetPos();
4304 Match match(true);
4305 Match* parentMatch4 = &match;
4306 {
4307 System.Lex.Span span = lexer.GetSpan();
4308 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
4309 ft.Reset(cast<cmsx.intermediate.Type*>(match.value));
4310 if (match.hit)
4311 {
4312 *parentMatch4 = match;
4313 }
4314 else
4315 {
4316 lexer.ThrowExpectationFailure(span, u"TypeExpr");
4317 }
4318 }
4319 if (match.hit)
4320 {
4321 functionType = ft.Release();
4322 }
4323 *parentMatch3 = match;
4324 }
4325 *parentMatch2 = match;
4326 }
4327 *parentMatch1 = match;
4328 }
4329 *parentMatch0 = match;
4330 }
4331 if (match.hit)
4332 {
4333 Match match(false);
4334 Match* parentMatch5 = &match;
4335 {
4336 Match match(false);
4337 Match* parentMatch6 = &match;
4338 {
4339 long pos = lexer.GetPos();
4340 Span span = lexer.GetSpan();
4341 Match match(true);
4342 Match* parentMatch7 = &match;
4343 {
4344 System.Lex.Span span = lexer.GetSpan();
4345 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, functionType);
4346 callee.Reset(cast<cmsx.intermediate.Value*>(match.value));
4347 if (match.hit)
4348 {
4349 *parentMatch7 = match;
4350 }
4351 else
4352 {
4353 lexer.ThrowExpectationFailure(span, u"TypedValue");
4354 }
4355 }
4356 if (match.hit)
4357 {
4358 {
4359 #if (DEBUG)
4360 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ProcedureCallInstruction");
4361 #endif
4362 return Match(true, new cmsx.intermediate.ProcedureCallInstruction(callee.Release(), span.line));
4363 }
4364 }
4365 *parentMatch6 = match;
4366 }
4367 *parentMatch5 = match;
4368 }
4369 *parentMatch0 = match;
4370 }
4371 #if (DEBUG)
4372 if (writeToLog)
4373 {
4374 if (match.hit)
4375 {
4376 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ProcedureCallInstruction");
4377 }
4378 else
4379 {
4380 System.Lex.WriteFailureToLog(lexer, u"ProcedureCallInstruction");
4381 }
4382 }
4383 #endif
4384 if (!match.hit)
4385 {
4386 match.value = null;
4387 }
4388 return match;
4389 }
4390 public static Match RetInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
4391 {
4392 #if (DEBUG)
4393 Span debugSpan;
4394 bool writeToLog = lexer.Log() != null;
4395 if (writeToLog)
4396 {
4397 debugSpan = lexer.GetSpan();
4398 System.Lex.WriteBeginRuleToLog(lexer, u"RetInstruction");
4399 }
4400 #endif
4401 cmsx.intermediate.Type* type;
4402 UniquePtr<cmsx.intermediate.Type> t;
4403 UniquePtr<cmsx.intermediate.Value> val;
4404 Match match(false);
4405 Match* parentMatch0 = &match;
4406 {
4407 Match match(false);
4408 if (*lexer == RET)
4409 {
4410 ++lexer;
4411 match.hit = true;
4412 }
4413 *parentMatch0 = match;
4414 }
4415 if (match.hit)
4416 {
4417 Match match(false);
4418 Match* parentMatch1 = &match;
4419 {
4420 Match match(false);
4421 Match* parentMatch2 = &match;
4422 {
4423 Match match(false);
4424 Match* parentMatch3 = &match;
4425 {
4426 long save = lexer.GetPos();
4427 Match match(false);
4428 Match* parentMatch4 = &match;
4429 {
4430 long pos = lexer.GetPos();
4431 Span span = lexer.GetSpan();
4432 Match match(false);
4433 Match* parentMatch5 = &match;
4434 {
4435 Match match(false);
4436 Match* parentMatch6 = &match;
4437 long save = lexer.GetPos();
4438 {
4439 Match match(false);
4440 if (*lexer == VOID)
4441 {
4442 ++lexer;
4443 match.hit = true;
4444 }
4445 *parentMatch6 = match;
4446 }
4447 if (match.hit)
4448 {
4449 Match match(false);
4450 Match* parentMatch7 = &match;
4451 {
4452 long tmp = lexer.GetPos();
4453 lexer.SetPos(save);
4454 save = tmp;
4455 Match match(false);
4456 Match* parentMatch8 = &match;
4457 {
4458 Match match(false);
4459 Match* parentMatch9 = &match;
4460 {
4461 Match match(false);
4462 if (*lexer == VOID)
4463 {
4464 ++lexer;
4465 match.hit = true;
4466 }
4467 *parentMatch9 = match;
4468 }
4469 if (match.hit)
4470 {
4471 Match match(false);
4472 Match* parentMatch10 = &match;
4473 {
4474 Match match(false);
4475 if (*lexer == AST)
4476 {
4477 ++lexer;
4478 match.hit = true;
4479 }
4480 *parentMatch10 = match;
4481 }
4482 *parentMatch9 = match;
4483 }
4484 *parentMatch8 = match;
4485 }
4486 *parentMatch7 = match;
4487 }
4488 if (!match.hit)
4489 {
4490 lexer.SetPos(save);
4491 }
4492 *parentMatch6 = Match(!match.hit, match.value);
4493 }
4494 *parentMatch5 = match;
4495 }
4496 if (match.hit)
4497 {
4498 {
4499 #if (DEBUG)
4500 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RetInstruction");
4501 #endif
4502 return Match(true, new cmsx.intermediate.RetInstruction(null, span.line));
4503 }
4504 }
4505 *parentMatch4 = match;
4506 }
4507 *parentMatch3 = match;
4508 if (!match.hit)
4509 {
4510 Match match(false);
4511 Match* parentMatch11 = &match;
4512 lexer.SetPos(save);
4513 {
4514 Match match(false);
4515 Match* parentMatch12 = &match;
4516 {
4517 Match match(false);
4518 Match* parentMatch13 = &match;
4519 {
4520 long pos = lexer.GetPos();
4521 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
4522 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
4523 if (match.hit)
4524 {
4525 type = t.Release();
4526 }
4527 *parentMatch13 = match;
4528 }
4529 *parentMatch12 = match;
4530 }
4531 if (match.hit)
4532 {
4533 Match match(false);
4534 Match* parentMatch14 = &match;
4535 {
4536 Match match(false);
4537 Match* parentMatch15 = &match;
4538 {
4539 long pos = lexer.GetPos();
4540 Span span = lexer.GetSpan();
4541 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, type);
4542 val.Reset(cast<cmsx.intermediate.Value*>(match.value));
4543 if (match.hit)
4544 {
4545 {
4546 #if (DEBUG)
4547 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RetInstruction");
4548 #endif
4549 return Match(true, new cmsx.intermediate.RetInstruction(val.Release(), span.line));
4550 }
4551 }
4552 *parentMatch15 = match;
4553 }
4554 *parentMatch14 = match;
4555 }
4556 *parentMatch12 = match;
4557 }
4558 *parentMatch11 = match;
4559 }
4560 *parentMatch3 = match;
4561 }
4562 }
4563 *parentMatch2 = match;
4564 }
4565 *parentMatch1 = match;
4566 }
4567 *parentMatch0 = match;
4568 }
4569 #if (DEBUG)
4570 if (writeToLog)
4571 {
4572 if (match.hit)
4573 {
4574 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"RetInstruction");
4575 }
4576 else
4577 {
4578 System.Lex.WriteFailureToLog(lexer, u"RetInstruction");
4579 }
4580 }
4581 #endif
4582 if (!match.hit)
4583 {
4584 match.value = null;
4585 }
4586 return match;
4587 }
4588 public static Match SwitchInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
4589 {
4590 #if (DEBUG)
4591 Span debugSpan;
4592 bool writeToLog = lexer.Log() != null;
4593 if (writeToLog)
4594 {
4595 debugSpan = lexer.GetSpan();
4596 System.Lex.WriteBeginRuleToLog(lexer, u"SwitchInstruction");
4597 }
4598 #endif
4599 cmsx.intermediate.SwitchInstruction* inst;
4600 cmsx.intermediate.Type* type;
4601 cmsx.intermediate.Type* caseType;
4602 UniquePtr<cmsx.intermediate.Type> t;
4603 UniquePtr<cmsx.intermediate.Value> cond;
4604 UniquePtr<Value<uint>> defaultTarget;
4605 UniquePtr<cmsx.intermediate.Type> ct;
4606 UniquePtr<cmsx.intermediate.Value> caseValue;
4607 UniquePtr<Value<uint>> caseTarget;
4608 Match match(false);
4609 Match* parentMatch0 = &match;
4610 {
4611 long pos = lexer.GetPos();
4612 Match match(false);
4613 Match* parentMatch1 = &match;
4614 {
4615 Match match(false);
4616 Match* parentMatch2 = &match;
4617 {
4618 Match match(false);
4619 Match* parentMatch3 = &match;
4620 {
4621 Match match(false);
4622 Match* parentMatch4 = &match;
4623 {
4624 Match match(false);
4625 Match* parentMatch5 = &match;
4626 {
4627 Match match(false);
4628 Match* parentMatch6 = &match;
4629 {
4630 Match match(false);
4631 Match* parentMatch7 = &match;
4632 {
4633 Match match(false);
4634 Match* parentMatch8 = &match;
4635 {
4636 Match match(false);
4637 if (*lexer == SWITCH)
4638 {
4639 ++lexer;
4640 match.hit = true;
4641 }
4642 *parentMatch8 = match;
4643 }
4644 if (match.hit)
4645 {
4646 Match match(false);
4647 Match* parentMatch9 = &match;
4648 {
4649 Match match(false);
4650 Match* parentMatch10 = &match;
4651 {
4652 long pos = lexer.GetPos();
4653 Match match(true);
4654 Match* parentMatch11 = &match;
4655 {
4656 System.Lex.Span span = lexer.GetSpan();
4657 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
4658 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
4659 if (match.hit)
4660 {
4661 *parentMatch11 = match;
4662 }
4663 else
4664 {
4665 lexer.ThrowExpectationFailure(span, u"TypeExpr");
4666 }
4667 }
4668 if (match.hit)
4669 {
4670 type = t.Release();
4671 }
4672 *parentMatch10 = match;
4673 }
4674 *parentMatch9 = match;
4675 }
4676 *parentMatch8 = match;
4677 }
4678 *parentMatch7 = match;
4679 }
4680 if (match.hit)
4681 {
4682 Match match(false);
4683 Match* parentMatch12 = &match;
4684 {
4685 Match match(true);
4686 Match* parentMatch13 = &match;
4687 {
4688 System.Lex.Span span = lexer.GetSpan();
4689 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, type);
4690 cond.Reset(cast<cmsx.intermediate.Value*>(match.value));
4691 if (match.hit)
4692 {
4693 *parentMatch13 = match;
4694 }
4695 else
4696 {
4697 lexer.ThrowExpectationFailure(span, u"TypedValue");
4698 }
4699 }
4700 *parentMatch12 = match;
4701 }
4702 *parentMatch7 = match;
4703 }
4704 *parentMatch6 = match;
4705 }
4706 if (match.hit)
4707 {
4708 Match match(false);
4709 Match* parentMatch14 = &match;
4710 {
4711 Match match(false);
4712 Match* parentMatch15 = &match;
4713 {
4714 long pos = lexer.GetPos();
4715 Span span = lexer.GetSpan();
4716 Match match(true);
4717 Match* parentMatch16 = &match;
4718 {
4719 System.Lex.Span span = lexer.GetSpan();
4720 Match match = IntermediateCodeFileParser.Label(lexer);
4721 defaultTarget.Reset(cast<Value<uint>*>(match.value));
4722 if (match.hit)
4723 {
4724 *parentMatch16 = match;
4725 }
4726 else
4727 {
4728 lexer.ThrowExpectationFailure(span, u"Label");
4729 }
4730 }
4731 if (match.hit)
4732 {
4733 inst = new cmsx.intermediate.SwitchInstruction(cond.Release(), defaultTarget->value, span.line);
4734 }
4735 *parentMatch15 = match;
4736 }
4737 *parentMatch14 = match;
4738 }
4739 *parentMatch6 = match;
4740 }
4741 *parentMatch5 = match;
4742 }
4743 if (match.hit)
4744 {
4745 Match match(false);
4746 Match* parentMatch17 = &match;
4747 {
4748 Match match(true);
4749 Match* parentMatch18 = &match;
4750 {
4751 System.Lex.Span span = lexer.GetSpan();
4752 Match match(false);
4753 if (*lexer == COMMA)
4754 {
4755 ++lexer;
4756 match.hit = true;
4757 }
4758 if (match.hit)
4759 {
4760 *parentMatch18 = match;
4761 }
4762 else
4763 {
4764 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
4765 }
4766 }
4767 *parentMatch17 = match;
4768 }
4769 *parentMatch5 = match;
4770 }
4771 *parentMatch4 = match;
4772 }
4773 if (match.hit)
4774 {
4775 Match match(false);
4776 Match* parentMatch19 = &match;
4777 {
4778 Match match(true);
4779 Match* parentMatch20 = &match;
4780 {
4781 System.Lex.Span span = lexer.GetSpan();
4782 Match match(false);
4783 if (*lexer == LBRACKET)
4784 {
4785 ++lexer;
4786 match.hit = true;
4787 }
4788 if (match.hit)
4789 {
4790 *parentMatch20 = match;
4791 }
4792 else
4793 {
4794 lexer.ThrowExpectationFailure(span, GetTokenName(LBRACKET));
4795 }
4796 }
4797 *parentMatch19 = match;
4798 }
4799 *parentMatch4 = match;
4800 }
4801 *parentMatch3 = match;
4802 }
4803 if (match.hit)
4804 {
4805 Match match(false);
4806 Match* parentMatch21 = &match;
4807 {
4808 Match match(false);
4809 Match* parentMatch22 = &match;
4810 {
4811 Match match(false);
4812 Match* parentMatch23 = &match;
4813 {
4814 Match match(false);
4815 Match* parentMatch24 = &match;
4816 {
4817 long pos = lexer.GetPos();
4818 Match match(false);
4819 Match* parentMatch25 = &match;
4820 {
4821 Match match(false);
4822 Match* parentMatch26 = &match;
4823 {
4824 Match match(false);
4825 Match* parentMatch27 = &match;
4826 {
4827 Match match(false);
4828 Match* parentMatch28 = &match;
4829 {
4830 Match match(false);
4831 Match* parentMatch29 = &match;
4832 {
4833 long pos = lexer.GetPos();
4834 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
4835 ct.Reset(cast<cmsx.intermediate.Type*>(match.value));
4836 if (match.hit)
4837 {
4838 caseType = ct.Release();
4839 }
4840 *parentMatch29 = match;
4841 }
4842 *parentMatch28 = match;
4843 }
4844 if (match.hit)
4845 {
4846 Match match(false);
4847 Match* parentMatch30 = &match;
4848 {
4849 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, caseType);
4850 caseValue.Reset(cast<cmsx.intermediate.Value*>(match.value));
4851 *parentMatch30 = match;
4852 }
4853 *parentMatch28 = match;
4854 }
4855 *parentMatch27 = match;
4856 }
4857 if (match.hit)
4858 {
4859 Match match(false);
4860 Match* parentMatch31 = &match;
4861 {
4862 Match match(false);
4863 if (*lexer == COMMA)
4864 {
4865 ++lexer;
4866 match.hit = true;
4867 }
4868 *parentMatch31 = match;
4869 }
4870 *parentMatch27 = match;
4871 }
4872 *parentMatch26 = match;
4873 }
4874 if (match.hit)
4875 {
4876 Match match(false);
4877 Match* parentMatch32 = &match;
4878 {
4879 Match match = IntermediateCodeFileParser.Label(lexer);
4880 caseTarget.Reset(cast<Value<uint>*>(match.value));
4881 *parentMatch32 = match;
4882 }
4883 *parentMatch26 = match;
4884 }
4885 *parentMatch25 = match;
4886 }
4887 if (match.hit)
4888 {
4889 inst->AddCase(caseValue.Release(), caseTarget->value);
4890 }
4891 *parentMatch24 = match;
4892 }
4893 *parentMatch23 = match;
4894 }
4895 if (match.hit)
4896 {
4897 Match match(false);
4898 Match* parentMatch33 = &match;
4899 {
4900 Match match(true);
4901 Match* parentMatch34 = &match;
4902 {
4903 while (true)
4904 {
4905 long save = lexer.GetPos();
4906 {
4907 Match match(false);
4908 Match* parentMatch35 = &match;
4909 {
4910 Match match(false);
4911 if (*lexer == COLON)
4912 {
4913 ++lexer;
4914 match.hit = true;
4915 }
4916 *parentMatch35 = match;
4917 }
4918 if (match.hit)
4919 {
4920 Match match(false);
4921 Match* parentMatch36 = &match;
4922 {
4923 Match match(false);
4924 Match* parentMatch37 = &match;
4925 {
4926 long pos = lexer.GetPos();
4927 Match match(false);
4928 Match* parentMatch38 = &match;
4929 {
4930 Match match(false);
4931 Match* parentMatch39 = &match;
4932 {
4933 Match match(false);
4934 Match* parentMatch40 = &match;
4935 {
4936 Match match(false);
4937 Match* parentMatch41 = &match;
4938 {
4939 Match match(false);
4940 Match* parentMatch42 = &match;
4941 {
4942 long pos = lexer.GetPos();
4943 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
4944 ct.Reset(cast<cmsx.intermediate.Type*>(match.value));
4945 if (match.hit)
4946 {
4947 caseType = ct.Release();
4948 }
4949 *parentMatch42 = match;
4950 }
4951 *parentMatch41 = match;
4952 }
4953 if (match.hit)
4954 {
4955 Match match(false);
4956 Match* parentMatch43 = &match;
4957 {
4958 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, caseType);
4959 caseValue.Reset(cast<cmsx.intermediate.Value*>(match.value));
4960 *parentMatch43 = match;
4961 }
4962 *parentMatch41 = match;
4963 }
4964 *parentMatch40 = match;
4965 }
4966 if (match.hit)
4967 {
4968 Match match(false);
4969 Match* parentMatch44 = &match;
4970 {
4971 Match match(false);
4972 if (*lexer == COMMA)
4973 {
4974 ++lexer;
4975 match.hit = true;
4976 }
4977 *parentMatch44 = match;
4978 }
4979 *parentMatch40 = match;
4980 }
4981 *parentMatch39 = match;
4982 }
4983 if (match.hit)
4984 {
4985 Match match(false);
4986 Match* parentMatch45 = &match;
4987 {
4988 Match match = IntermediateCodeFileParser.Label(lexer);
4989 caseTarget.Reset(cast<Value<uint>*>(match.value));
4990 *parentMatch45 = match;
4991 }
4992 *parentMatch39 = match;
4993 }
4994 *parentMatch38 = match;
4995 }
4996 if (match.hit)
4997 {
4998 inst->AddCase(caseValue.Release(), caseTarget->value);
4999 }
5000 *parentMatch37 = match;
5001 }
5002 *parentMatch36 = match;
5003 }
5004 *parentMatch35 = match;
5005 }
5006 if (match.hit)
5007 {
5008 *parentMatch34 = match;
5009 }
5010 else
5011 {
5012 lexer.SetPos(save);
5013 break;
5014 }
5015 }
5016 }
5017 }
5018 *parentMatch33 = match;
5019 }
5020 *parentMatch23 = match;
5021 }
5022 *parentMatch22 = match;
5023 }
5024 *parentMatch21 = match;
5025 }
5026 *parentMatch3 = match;
5027 }
5028 *parentMatch2 = match;
5029 }
5030 if (match.hit)
5031 {
5032 Match match(false);
5033 Match* parentMatch46 = &match;
5034 {
5035 Match match(true);
5036 Match* parentMatch47 = &match;
5037 {
5038 System.Lex.Span span = lexer.GetSpan();
5039 Match match(false);
5040 if (*lexer == RBRACKET)
5041 {
5042 ++lexer;
5043 match.hit = true;
5044 }
5045 if (match.hit)
5046 {
5047 *parentMatch47 = match;
5048 }
5049 else
5050 {
5051 lexer.ThrowExpectationFailure(span, GetTokenName(RBRACKET));
5052 }
5053 }
5054 *parentMatch46 = match;
5055 }
5056 *parentMatch2 = match;
5057 }
5058 *parentMatch1 = match;
5059 }
5060 if (match.hit)
5061 {
5062 {
5063 #if (DEBUG)
5064 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"SwitchInstruction");
5065 #endif
5066 return Match(true, inst);
5067 }
5068 }
5069 *parentMatch0 = match;
5070 }
5071 #if (DEBUG)
5072 if (writeToLog)
5073 {
5074 if (match.hit)
5075 {
5076 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"SwitchInstruction");
5077 }
5078 else
5079 {
5080 System.Lex.WriteFailureToLog(lexer, u"SwitchInstruction");
5081 }
5082 }
5083 #endif
5084 if (!match.hit)
5085 {
5086 match.value = null;
5087 }
5088 return match;
5089 }
5090 public static Match ValueInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
5091 {
5092 #if (DEBUG)
5093 Span debugSpan;
5094 bool writeToLog = lexer.Log() != null;
5095 if (writeToLog)
5096 {
5097 debugSpan = lexer.GetSpan();
5098 System.Lex.WriteBeginRuleToLog(lexer, u"ValueInstruction");
5099 }
5100 #endif
5101 cmsx.intermediate.Type* type;
5102 cmsx.intermediate.Value* result;
5103 UniquePtr<cmsx.intermediate.Type> t;
5104 UniquePtr<cmsx.intermediate.Value> r;
5105 UniquePtr<cmsx.intermediate.Instruction> op;
5106 Match match(false);
5107 Match* parentMatch0 = &match;
5108 {
5109 Match match(false);
5110 Match* parentMatch1 = &match;
5111 {
5112 Match match(false);
5113 Match* parentMatch2 = &match;
5114 {
5115 Match match(false);
5116 Match* parentMatch3 = &match;
5117 {
5118 long pos = lexer.GetPos();
5119 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
5120 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
5121 if (match.hit)
5122 {
5123 type = t.Release();
5124 }
5125 *parentMatch3 = match;
5126 }
5127 *parentMatch2 = match;
5128 }
5129 if (match.hit)
5130 {
5131 Match match(false);
5132 Match* parentMatch4 = &match;
5133 {
5134 Match match(false);
5135 Match* parentMatch5 = &match;
5136 {
5137 long pos = lexer.GetPos();
5138 Match match(true);
5139 Match* parentMatch6 = &match;
5140 {
5141 System.Lex.Span span = lexer.GetSpan();
5142 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, type);
5143 r.Reset(cast<cmsx.intermediate.Value*>(match.value));
5144 if (match.hit)
5145 {
5146 *parentMatch6 = match;
5147 }
5148 else
5149 {
5150 lexer.ThrowExpectationFailure(span, u"TypedValue");
5151 }
5152 }
5153 if (match.hit)
5154 {
5155 result = r.Release();
5156 }
5157 *parentMatch5 = match;
5158 }
5159 *parentMatch4 = match;
5160 }
5161 *parentMatch2 = match;
5162 }
5163 *parentMatch1 = match;
5164 }
5165 if (match.hit)
5166 {
5167 Match match(false);
5168 Match* parentMatch7 = &match;
5169 {
5170 Match match(false);
5171 if (*lexer == ASSIGN)
5172 {
5173 ++lexer;
5174 match.hit = true;
5175 }
5176 *parentMatch7 = match;
5177 }
5178 *parentMatch1 = match;
5179 }
5180 *parentMatch0 = match;
5181 }
5182 if (match.hit)
5183 {
5184 Match match(false);
5185 Match* parentMatch8 = &match;
5186 {
5187 Match match(false);
5188 Match* parentMatch9 = &match;
5189 {
5190 long pos = lexer.GetPos();
5191 Match match(true);
5192 Match* parentMatch10 = &match;
5193 {
5194 System.Lex.Span span = lexer.GetSpan();
5195 Match match = IntermediateCodeFileParser.Operation(lexer, context, result);
5196 op.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
5197 if (match.hit)
5198 {
5199 *parentMatch10 = match;
5200 }
5201 else
5202 {
5203 lexer.ThrowExpectationFailure(span, u"Operation");
5204 }
5205 }
5206 if (match.hit)
5207 {
5208 {
5209 #if (DEBUG)
5210 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ValueInstruction");
5211 #endif
5212 return Match(true, op.Release());
5213 }
5214 }
5215 *parentMatch9 = match;
5216 }
5217 *parentMatch8 = match;
5218 }
5219 *parentMatch0 = match;
5220 }
5221 #if (DEBUG)
5222 if (writeToLog)
5223 {
5224 if (match.hit)
5225 {
5226 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ValueInstruction");
5227 }
5228 else
5229 {
5230 System.Lex.WriteFailureToLog(lexer, u"ValueInstruction");
5231 }
5232 }
5233 #endif
5234 if (!match.hit)
5235 {
5236 match.value = null;
5237 }
5238 return match;
5239 }
5240 public static Match Operation(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Value* result)
5241 {
5242 #if (DEBUG)
5243 Span debugSpan;
5244 bool writeToLog = lexer.Log() != null;
5245 if (writeToLog)
5246 {
5247 debugSpan = lexer.GetSpan();
5248 System.Lex.WriteBeginRuleToLog(lexer, u"Operation");
5249 }
5250 #endif
5251 UniquePtr<cmsx.intermediate.Instruction> unaryInst;
5252 UniquePtr<cmsx.intermediate.Instruction> binaryInst;
5253 UniquePtr<cmsx.intermediate.Instruction> paramInst;
5254 UniquePtr<cmsx.intermediate.Instruction> localInst;
5255 UniquePtr<cmsx.intermediate.Instruction> loadInst;
5256 UniquePtr<cmsx.intermediate.Instruction> elemAddrInst;
5257 UniquePtr<cmsx.intermediate.Instruction> ptrOffsetInst;
5258 UniquePtr<cmsx.intermediate.Instruction> ptrDiffInst;
5259 UniquePtr<cmsx.intermediate.Instruction> functionCallInst;
5260 UniquePtr<cmsx.intermediate.Instruction> trapInst;
5261 Match match(false);
5262 Match* parentMatch0 = &match;
5263 {
5264 long save = lexer.GetPos();
5265 Match match(false);
5266 Match* parentMatch1 = &match;
5267 {
5268 long save = lexer.GetPos();
5269 Match match(false);
5270 Match* parentMatch2 = &match;
5271 {
5272 long save = lexer.GetPos();
5273 Match match(false);
5274 Match* parentMatch3 = &match;
5275 {
5276 long save = lexer.GetPos();
5277 Match match(false);
5278 Match* parentMatch4 = &match;
5279 {
5280 long save = lexer.GetPos();
5281 Match match(false);
5282 Match* parentMatch5 = &match;
5283 {
5284 long save = lexer.GetPos();
5285 Match match(false);
5286 Match* parentMatch6 = &match;
5287 {
5288 long save = lexer.GetPos();
5289 Match match(false);
5290 Match* parentMatch7 = &match;
5291 {
5292 long save = lexer.GetPos();
5293 Match match(false);
5294 Match* parentMatch8 = &match;
5295 {
5296 long save = lexer.GetPos();
5297 Match match(false);
5298 Match* parentMatch9 = &match;
5299 {
5300 long pos = lexer.GetPos();
5301 Match match = IntermediateCodeFileParser.UnaryInstruction(lexer, context, result);
5302 unaryInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
5303 if (match.hit)
5304 {
5305 {
5306 #if (DEBUG)
5307 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operation");
5308 #endif
5309 return Match(true, unaryInst.Release());
5310 }
5311 }
5312 *parentMatch9 = match;
5313 }
5314 *parentMatch8 = match;
5315 if (!match.hit)
5316 {
5317 Match match(false);
5318 Match* parentMatch10 = &match;
5319 lexer.SetPos(save);
5320 {
5321 Match match(false);
5322 Match* parentMatch11 = &match;
5323 {
5324 long pos = lexer.GetPos();
5325 Match match = IntermediateCodeFileParser.BinaryInstruction(lexer, context, result);
5326 binaryInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
5327 if (match.hit)
5328 {
5329 {
5330 #if (DEBUG)
5331 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operation");
5332 #endif
5333 return Match(true, binaryInst.Release());
5334 }
5335 }
5336 *parentMatch11 = match;
5337 }
5338 *parentMatch10 = match;
5339 }
5340 *parentMatch8 = match;
5341 }
5342 }
5343 *parentMatch7 = match;
5344 if (!match.hit)
5345 {
5346 Match match(false);
5347 Match* parentMatch12 = &match;
5348 lexer.SetPos(save);
5349 {
5350 Match match(false);
5351 Match* parentMatch13 = &match;
5352 {
5353 long pos = lexer.GetPos();
5354 Match match = IntermediateCodeFileParser.ParamInstruction(lexer, context, result);
5355 paramInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
5356 if (match.hit)
5357 {
5358 {
5359 #if (DEBUG)
5360 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operation");
5361 #endif
5362 return Match(true, paramInst.Release());
5363 }
5364 }
5365 *parentMatch13 = match;
5366 }
5367 *parentMatch12 = match;
5368 }
5369 *parentMatch7 = match;
5370 }
5371 }
5372 *parentMatch6 = match;
5373 if (!match.hit)
5374 {
5375 Match match(false);
5376 Match* parentMatch14 = &match;
5377 lexer.SetPos(save);
5378 {
5379 Match match(false);
5380 Match* parentMatch15 = &match;
5381 {
5382 long pos = lexer.GetPos();
5383 Match match = IntermediateCodeFileParser.LocalInstruction(lexer, context, result);
5384 localInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
5385 if (match.hit)
5386 {
5387 {
5388 #if (DEBUG)
5389 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operation");
5390 #endif
5391 return Match(true, localInst.Release());
5392 }
5393 }
5394 *parentMatch15 = match;
5395 }
5396 *parentMatch14 = match;
5397 }
5398 *parentMatch6 = match;
5399 }
5400 }
5401 *parentMatch5 = match;
5402 if (!match.hit)
5403 {
5404 Match match(false);
5405 Match* parentMatch16 = &match;
5406 lexer.SetPos(save);
5407 {
5408 Match match(false);
5409 Match* parentMatch17 = &match;
5410 {
5411 long pos = lexer.GetPos();
5412 Match match = IntermediateCodeFileParser.LoadInstruction(lexer, context, result);
5413 loadInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
5414 if (match.hit)
5415 {
5416 {
5417 #if (DEBUG)
5418 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operation");
5419 #endif
5420 return Match(true, loadInst.Release());
5421 }
5422 }
5423 *parentMatch17 = match;
5424 }
5425 *parentMatch16 = match;
5426 }
5427 *parentMatch5 = match;
5428 }
5429 }
5430 *parentMatch4 = match;
5431 if (!match.hit)
5432 {
5433 Match match(false);
5434 Match* parentMatch18 = &match;
5435 lexer.SetPos(save);
5436 {
5437 Match match(false);
5438 Match* parentMatch19 = &match;
5439 {
5440 long pos = lexer.GetPos();
5441 Match match = IntermediateCodeFileParser.ElemAddrInstruction(lexer, context, result);
5442 elemAddrInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
5443 if (match.hit)
5444 {
5445 {
5446 #if (DEBUG)
5447 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operation");
5448 #endif
5449 return Match(true, elemAddrInst.Release());
5450 }
5451 }
5452 *parentMatch19 = match;
5453 }
5454 *parentMatch18 = match;
5455 }
5456 *parentMatch4 = match;
5457 }
5458 }
5459 *parentMatch3 = match;
5460 if (!match.hit)
5461 {
5462 Match match(false);
5463 Match* parentMatch20 = &match;
5464 lexer.SetPos(save);
5465 {
5466 Match match(false);
5467 Match* parentMatch21 = &match;
5468 {
5469 long pos = lexer.GetPos();
5470 Match match = IntermediateCodeFileParser.PtrOffsetInstruction(lexer, context, result);
5471 ptrOffsetInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
5472 if (match.hit)
5473 {
5474 {
5475 #if (DEBUG)
5476 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operation");
5477 #endif
5478 return Match(true, ptrOffsetInst.Release());
5479 }
5480 }
5481 *parentMatch21 = match;
5482 }
5483 *parentMatch20 = match;
5484 }
5485 *parentMatch3 = match;
5486 }
5487 }
5488 *parentMatch2 = match;
5489 if (!match.hit)
5490 {
5491 Match match(false);
5492 Match* parentMatch22 = &match;
5493 lexer.SetPos(save);
5494 {
5495 Match match(false);
5496 Match* parentMatch23 = &match;
5497 {
5498 long pos = lexer.GetPos();
5499 Match match = IntermediateCodeFileParser.PtrDiffInstruction(lexer, context, result);
5500 ptrDiffInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
5501 if (match.hit)
5502 {
5503 {
5504 #if (DEBUG)
5505 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operation");
5506 #endif
5507 return Match(true, ptrDiffInst.Release());
5508 }
5509 }
5510 *parentMatch23 = match;
5511 }
5512 *parentMatch22 = match;
5513 }
5514 *parentMatch2 = match;
5515 }
5516 }
5517 *parentMatch1 = match;
5518 if (!match.hit)
5519 {
5520 Match match(false);
5521 Match* parentMatch24 = &match;
5522 lexer.SetPos(save);
5523 {
5524 Match match(false);
5525 Match* parentMatch25 = &match;
5526 {
5527 long pos = lexer.GetPos();
5528 Match match = IntermediateCodeFileParser.FunctionCallInstruction(lexer, context, result);
5529 functionCallInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
5530 if (match.hit)
5531 {
5532 {
5533 #if (DEBUG)
5534 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operation");
5535 #endif
5536 return Match(true, functionCallInst.Release());
5537 }
5538 }
5539 *parentMatch25 = match;
5540 }
5541 *parentMatch24 = match;
5542 }
5543 *parentMatch1 = match;
5544 }
5545 }
5546 *parentMatch0 = match;
5547 if (!match.hit)
5548 {
5549 Match match(false);
5550 Match* parentMatch26 = &match;
5551 lexer.SetPos(save);
5552 {
5553 Match match(false);
5554 Match* parentMatch27 = &match;
5555 {
5556 long pos = lexer.GetPos();
5557 Match match = IntermediateCodeFileParser.TrapInstruction(lexer, context, result);
5558 trapInst.Reset(cast<cmsx.intermediate.Instruction*>(match.value));
5559 if (match.hit)
5560 {
5561 {
5562 #if (DEBUG)
5563 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operation");
5564 #endif
5565 return Match(true, trapInst.Release());
5566 }
5567 }
5568 *parentMatch27 = match;
5569 }
5570 *parentMatch26 = match;
5571 }
5572 *parentMatch0 = match;
5573 }
5574 }
5575 #if (DEBUG)
5576 if (writeToLog)
5577 {
5578 if (match.hit)
5579 {
5580 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operation");
5581 }
5582 else
5583 {
5584 System.Lex.WriteFailureToLog(lexer, u"Operation");
5585 }
5586 }
5587 #endif
5588 if (!match.hit)
5589 {
5590 match.value = null;
5591 }
5592 return match;
5593 }
5594 public static Match UnaryInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Value* result)
5595 {
5596 #if (DEBUG)
5597 Span debugSpan;
5598 bool writeToLog = lexer.Log() != null;
5599 if (writeToLog)
5600 {
5601 debugSpan = lexer.GetSpan();
5602 System.Lex.WriteBeginRuleToLog(lexer, u"UnaryInstruction");
5603 }
5604 #endif
5605 cmsx.intermediate.UnaryInstruction* inst;
5606 UniquePtr<cmsx.intermediate.UnaryInstruction> unaryInst;
5607 UniquePtr<cmsx.intermediate.Value> arg;
5608 Match match(false);
5609 Match* parentMatch0 = &match;
5610 {
5611 Match match(false);
5612 Match* parentMatch1 = &match;
5613 {
5614 long pos = lexer.GetPos();
5615 Match match = IntermediateCodeFileParser.UnaryInst(lexer);
5616 unaryInst.Reset(cast<cmsx.intermediate.UnaryInstruction*>(match.value));
5617 if (match.hit)
5618 {
5619 inst = unaryInst.Release();
5620 }
5621 *parentMatch1 = match;
5622 }
5623 *parentMatch0 = match;
5624 }
5625 if (match.hit)
5626 {
5627 Match match(false);
5628 Match* parentMatch2 = &match;
5629 {
5630 Match match(false);
5631 Match* parentMatch3 = &match;
5632 {
5633 long pos = lexer.GetPos();
5634 Match match(true);
5635 Match* parentMatch4 = &match;
5636 {
5637 System.Lex.Span span = lexer.GetSpan();
5638 Match match = IntermediateCodeFileParser.Operand(lexer, context);
5639 arg.Reset(cast<cmsx.intermediate.Value*>(match.value));
5640 if (match.hit)
5641 {
5642 *parentMatch4 = match;
5643 }
5644 else
5645 {
5646 lexer.ThrowExpectationFailure(span, u"Operand");
5647 }
5648 }
5649 if (match.hit)
5650 {
5651 inst->SetOperand(arg.Release());
5652 inst->SetResult(result);
5653 {
5654 #if (DEBUG)
5655 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInstruction");
5656 #endif
5657 return Match(true, inst);
5658 }
5659 }
5660 *parentMatch3 = match;
5661 }
5662 *parentMatch2 = match;
5663 }
5664 *parentMatch0 = match;
5665 }
5666 #if (DEBUG)
5667 if (writeToLog)
5668 {
5669 if (match.hit)
5670 {
5671 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInstruction");
5672 }
5673 else
5674 {
5675 System.Lex.WriteFailureToLog(lexer, u"UnaryInstruction");
5676 }
5677 }
5678 #endif
5679 if (!match.hit)
5680 {
5681 match.value = null;
5682 }
5683 return match;
5684 }
5685 public static Match UnaryInst(IntermediateCodeLexer& lexer)
5686 {
5687 #if (DEBUG)
5688 Span debugSpan;
5689 bool writeToLog = lexer.Log() != null;
5690 if (writeToLog)
5691 {
5692 debugSpan = lexer.GetSpan();
5693 System.Lex.WriteBeginRuleToLog(lexer, u"UnaryInst");
5694 }
5695 #endif
5696 Match match(false);
5697 long pos = lexer.GetPos();
5698 Span span = lexer.GetSpan();
5699 switch (*lexer)
5700 {
5701 case NOT:
5702 {
5703 ++lexer;
5704 {
5705 #if (DEBUG)
5706 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInst");
5707 #endif
5708 return Match(true, new cmsx.intermediate.NotInstruction(span.line));
5709 }
5710 break;
5711 }
5712 case NEG:
5713 {
5714 ++lexer;
5715 {
5716 #if (DEBUG)
5717 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInst");
5718 #endif
5719 return Match(true, new cmsx.intermediate.NegInstruction(span.line));
5720 }
5721 break;
5722 }
5723 case SIGNEXTEND:
5724 {
5725 ++lexer;
5726 {
5727 #if (DEBUG)
5728 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInst");
5729 #endif
5730 return Match(true, new cmsx.intermediate.SignExtendInstruction(span.line));
5731 }
5732 break;
5733 }
5734 case ZEROEXTEND:
5735 {
5736 ++lexer;
5737 {
5738 #if (DEBUG)
5739 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInst");
5740 #endif
5741 return Match(true, new cmsx.intermediate.ZeroExtendInstruction(span.line));
5742 }
5743 break;
5744 }
5745 case TRUNCATE:
5746 {
5747 ++lexer;
5748 {
5749 #if (DEBUG)
5750 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInst");
5751 #endif
5752 return Match(true, new cmsx.intermediate.TruncateInstruction(span.line));
5753 }
5754 break;
5755 }
5756 case BITCAST:
5757 {
5758 ++lexer;
5759 {
5760 #if (DEBUG)
5761 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInst");
5762 #endif
5763 return Match(true, new cmsx.intermediate.BitCastInstruction(span.line));
5764 }
5765 break;
5766 }
5767 case INTTOFLOAT:
5768 {
5769 ++lexer;
5770 {
5771 #if (DEBUG)
5772 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInst");
5773 #endif
5774 return Match(true, new cmsx.intermediate.IntToFloatInstruction(span.line));
5775 }
5776 break;
5777 }
5778 case FLOATTOINT:
5779 {
5780 ++lexer;
5781 {
5782 #if (DEBUG)
5783 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInst");
5784 #endif
5785 return Match(true, new cmsx.intermediate.FloatToIntInstruction(span.line));
5786 }
5787 break;
5788 }
5789 case INTTOPTR:
5790 {
5791 ++lexer;
5792 {
5793 #if (DEBUG)
5794 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInst");
5795 #endif
5796 return Match(true, new cmsx.intermediate.IntToPtrInstruction(span.line));
5797 }
5798 break;
5799 }
5800 case PTRTOINT:
5801 {
5802 ++lexer;
5803 {
5804 #if (DEBUG)
5805 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInst");
5806 #endif
5807 return Match(true, new cmsx.intermediate.PtrToIntInstruction(span.line));
5808 }
5809 break;
5810 }
5811 }
5812 #if (DEBUG)
5813 if (writeToLog)
5814 {
5815 if (match.hit)
5816 {
5817 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UnaryInst");
5818 }
5819 else
5820 {
5821 System.Lex.WriteFailureToLog(lexer, u"UnaryInst");
5822 }
5823 }
5824 #endif
5825 if (!match.hit)
5826 {
5827 match.value = null;
5828 }
5829 return match;
5830 }
5831 public static Match BinaryInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Value* result)
5832 {
5833 #if (DEBUG)
5834 Span debugSpan;
5835 bool writeToLog = lexer.Log() != null;
5836 if (writeToLog)
5837 {
5838 debugSpan = lexer.GetSpan();
5839 System.Lex.WriteBeginRuleToLog(lexer, u"BinaryInstruction");
5840 }
5841 #endif
5842 cmsx.intermediate.BinaryInstruction* inst;
5843 UniquePtr<cmsx.intermediate.BinaryInstruction> binaryInst;
5844 UniquePtr<cmsx.intermediate.Value> left;
5845 UniquePtr<cmsx.intermediate.Value> right;
5846 Match match(false);
5847 Match* parentMatch0 = &match;
5848 {
5849 Match match(false);
5850 Match* parentMatch1 = &match;
5851 {
5852 Match match(false);
5853 Match* parentMatch2 = &match;
5854 {
5855 Match match(false);
5856 Match* parentMatch3 = &match;
5857 {
5858 long pos = lexer.GetPos();
5859 Match match = IntermediateCodeFileParser.BinaryInst(lexer);
5860 binaryInst.Reset(cast<cmsx.intermediate.BinaryInstruction*>(match.value));
5861 if (match.hit)
5862 {
5863 inst = binaryInst.Release();
5864 }
5865 *parentMatch3 = match;
5866 }
5867 *parentMatch2 = match;
5868 }
5869 if (match.hit)
5870 {
5871 Match match(false);
5872 Match* parentMatch4 = &match;
5873 {
5874 Match match(true);
5875 Match* parentMatch5 = &match;
5876 {
5877 System.Lex.Span span = lexer.GetSpan();
5878 Match match = IntermediateCodeFileParser.Operand(lexer, context);
5879 left.Reset(cast<cmsx.intermediate.Value*>(match.value));
5880 if (match.hit)
5881 {
5882 *parentMatch5 = match;
5883 }
5884 else
5885 {
5886 lexer.ThrowExpectationFailure(span, u"Operand");
5887 }
5888 }
5889 *parentMatch4 = match;
5890 }
5891 *parentMatch2 = match;
5892 }
5893 *parentMatch1 = match;
5894 }
5895 if (match.hit)
5896 {
5897 Match match(false);
5898 Match* parentMatch6 = &match;
5899 {
5900 Match match(true);
5901 Match* parentMatch7 = &match;
5902 {
5903 System.Lex.Span span = lexer.GetSpan();
5904 Match match(false);
5905 if (*lexer == COMMA)
5906 {
5907 ++lexer;
5908 match.hit = true;
5909 }
5910 if (match.hit)
5911 {
5912 *parentMatch7 = match;
5913 }
5914 else
5915 {
5916 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
5917 }
5918 }
5919 *parentMatch6 = match;
5920 }
5921 *parentMatch1 = match;
5922 }
5923 *parentMatch0 = match;
5924 }
5925 if (match.hit)
5926 {
5927 Match match(false);
5928 Match* parentMatch8 = &match;
5929 {
5930 Match match(false);
5931 Match* parentMatch9 = &match;
5932 {
5933 long pos = lexer.GetPos();
5934 Match match(true);
5935 Match* parentMatch10 = &match;
5936 {
5937 System.Lex.Span span = lexer.GetSpan();
5938 Match match = IntermediateCodeFileParser.Operand(lexer, context);
5939 right.Reset(cast<cmsx.intermediate.Value*>(match.value));
5940 if (match.hit)
5941 {
5942 *parentMatch10 = match;
5943 }
5944 else
5945 {
5946 lexer.ThrowExpectationFailure(span, u"Operand");
5947 }
5948 }
5949 if (match.hit)
5950 {
5951 inst->SetOperands(left.Release(), right.Release());
5952 inst->SetResult(result);
5953 {
5954 #if (DEBUG)
5955 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInstruction");
5956 #endif
5957 return Match(true, inst);
5958 }
5959 }
5960 *parentMatch9 = match;
5961 }
5962 *parentMatch8 = match;
5963 }
5964 *parentMatch0 = match;
5965 }
5966 #if (DEBUG)
5967 if (writeToLog)
5968 {
5969 if (match.hit)
5970 {
5971 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInstruction");
5972 }
5973 else
5974 {
5975 System.Lex.WriteFailureToLog(lexer, u"BinaryInstruction");
5976 }
5977 }
5978 #endif
5979 if (!match.hit)
5980 {
5981 match.value = null;
5982 }
5983 return match;
5984 }
5985 public static Match BinaryInst(IntermediateCodeLexer& lexer)
5986 {
5987 #if (DEBUG)
5988 Span debugSpan;
5989 bool writeToLog = lexer.Log() != null;
5990 if (writeToLog)
5991 {
5992 debugSpan = lexer.GetSpan();
5993 System.Lex.WriteBeginRuleToLog(lexer, u"BinaryInst");
5994 }
5995 #endif
5996 Match match(false);
5997 long pos = lexer.GetPos();
5998 Span span = lexer.GetSpan();
5999 switch (*lexer)
6000 {
6001 case ADD:
6002 {
6003 ++lexer;
6004 {
6005 #if (DEBUG)
6006 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6007 #endif
6008 return Match(true, new cmsx.intermediate.AddInstruction(span.line));
6009 }
6010 break;
6011 }
6012 case SUB:
6013 {
6014 ++lexer;
6015 {
6016 #if (DEBUG)
6017 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6018 #endif
6019 return Match(true, new cmsx.intermediate.SubInstruction(span.line));
6020 }
6021 break;
6022 }
6023 case MUL:
6024 {
6025 ++lexer;
6026 {
6027 #if (DEBUG)
6028 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6029 #endif
6030 return Match(true, new cmsx.intermediate.MulInstruction(span.line));
6031 }
6032 break;
6033 }
6034 case DIV:
6035 {
6036 ++lexer;
6037 {
6038 #if (DEBUG)
6039 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6040 #endif
6041 return Match(true, new cmsx.intermediate.DivInstruction(span.line));
6042 }
6043 break;
6044 }
6045 case MOD:
6046 {
6047 ++lexer;
6048 {
6049 #if (DEBUG)
6050 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6051 #endif
6052 return Match(true, new cmsx.intermediate.ModInstruction(span.line));
6053 }
6054 break;
6055 }
6056 case AND:
6057 {
6058 ++lexer;
6059 {
6060 #if (DEBUG)
6061 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6062 #endif
6063 return Match(true, new cmsx.intermediate.AndInstruction(span.line));
6064 }
6065 break;
6066 }
6067 case OR:
6068 {
6069 ++lexer;
6070 {
6071 #if (DEBUG)
6072 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6073 #endif
6074 return Match(true, new cmsx.intermediate.OrInstruction(span.line));
6075 }
6076 break;
6077 }
6078 case XOR:
6079 {
6080 ++lexer;
6081 {
6082 #if (DEBUG)
6083 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6084 #endif
6085 return Match(true, new cmsx.intermediate.XorInstruction(span.line));
6086 }
6087 break;
6088 }
6089 case SHL:
6090 {
6091 ++lexer;
6092 {
6093 #if (DEBUG)
6094 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6095 #endif
6096 return Match(true, new cmsx.intermediate.ShlInstruction(span.line));
6097 }
6098 break;
6099 }
6100 case SHR:
6101 {
6102 ++lexer;
6103 {
6104 #if (DEBUG)
6105 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6106 #endif
6107 return Match(true, new cmsx.intermediate.ShrInstruction(span.line));
6108 }
6109 break;
6110 }
6111 case EQUAL:
6112 {
6113 ++lexer;
6114 {
6115 #if (DEBUG)
6116 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6117 #endif
6118 return Match(true, new cmsx.intermediate.EqualInstruction(span.line));
6119 }
6120 break;
6121 }
6122 case LESS:
6123 {
6124 ++lexer;
6125 {
6126 #if (DEBUG)
6127 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6128 #endif
6129 return Match(true, new cmsx.intermediate.LessInstruction(span.line));
6130 }
6131 break;
6132 }
6133 }
6134 #if (DEBUG)
6135 if (writeToLog)
6136 {
6137 if (match.hit)
6138 {
6139 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BinaryInst");
6140 }
6141 else
6142 {
6143 System.Lex.WriteFailureToLog(lexer, u"BinaryInst");
6144 }
6145 }
6146 #endif
6147 if (!match.hit)
6148 {
6149 match.value = null;
6150 }
6151 return match;
6152 }
6153 public static Match ParamInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Value* result)
6154 {
6155 #if (DEBUG)
6156 Span debugSpan;
6157 bool writeToLog = lexer.Log() != null;
6158 if (writeToLog)
6159 {
6160 debugSpan = lexer.GetSpan();
6161 System.Lex.WriteBeginRuleToLog(lexer, u"ParamInstruction");
6162 }
6163 #endif
6164 Match match(false);
6165 Match* parentMatch0 = &match;
6166 {
6167 long pos = lexer.GetPos();
6168 Span span = lexer.GetSpan();
6169 Match match(false);
6170 if (*lexer == PARAM)
6171 {
6172 ++lexer;
6173 match.hit = true;
6174 }
6175 if (match.hit)
6176 {
6177 {
6178 #if (DEBUG)
6179 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParamInstruction");
6180 #endif
6181 return Match(true, new cmsx.intermediate.ParamInstruction(result, span.line));
6182 }
6183 }
6184 *parentMatch0 = match;
6185 }
6186 #if (DEBUG)
6187 if (writeToLog)
6188 {
6189 if (match.hit)
6190 {
6191 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ParamInstruction");
6192 }
6193 else
6194 {
6195 System.Lex.WriteFailureToLog(lexer, u"ParamInstruction");
6196 }
6197 }
6198 #endif
6199 if (!match.hit)
6200 {
6201 match.value = null;
6202 }
6203 return match;
6204 }
6205 public static Match LocalInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Value* result)
6206 {
6207 #if (DEBUG)
6208 Span debugSpan;
6209 bool writeToLog = lexer.Log() != null;
6210 if (writeToLog)
6211 {
6212 debugSpan = lexer.GetSpan();
6213 System.Lex.WriteBeginRuleToLog(lexer, u"LocalInstruction");
6214 }
6215 #endif
6216 cmsx.intermediate.Type* localType;
6217 UniquePtr<cmsx.intermediate.Type> t;
6218 Match match(false);
6219 Match* parentMatch0 = &match;
6220 {
6221 long pos = lexer.GetPos();
6222 Span span = lexer.GetSpan();
6223 Match match(false);
6224 Match* parentMatch1 = &match;
6225 {
6226 Match match(false);
6227 Match* parentMatch2 = &match;
6228 {
6229 Match match(false);
6230 if (*lexer == LOCAL)
6231 {
6232 ++lexer;
6233 match.hit = true;
6234 }
6235 *parentMatch2 = match;
6236 }
6237 if (match.hit)
6238 {
6239 Match match(false);
6240 Match* parentMatch3 = &match;
6241 {
6242 Match match(false);
6243 Match* parentMatch4 = &match;
6244 {
6245 long pos = lexer.GetPos();
6246 Match match(true);
6247 Match* parentMatch5 = &match;
6248 {
6249 System.Lex.Span span = lexer.GetSpan();
6250 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
6251 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
6252 if (match.hit)
6253 {
6254 *parentMatch5 = match;
6255 }
6256 else
6257 {
6258 lexer.ThrowExpectationFailure(span, u"TypeExpr");
6259 }
6260 }
6261 if (match.hit)
6262 {
6263 localType = t.Release();
6264 }
6265 *parentMatch4 = match;
6266 }
6267 *parentMatch3 = match;
6268 }
6269 *parentMatch2 = match;
6270 }
6271 *parentMatch1 = match;
6272 }
6273 if (match.hit)
6274 {
6275 {
6276 #if (DEBUG)
6277 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LocalInstruction");
6278 #endif
6279 return Match(true, new cmsx.intermediate.LocalInstruction(result, localType, span.line));
6280 }
6281 }
6282 *parentMatch0 = match;
6283 }
6284 #if (DEBUG)
6285 if (writeToLog)
6286 {
6287 if (match.hit)
6288 {
6289 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LocalInstruction");
6290 }
6291 else
6292 {
6293 System.Lex.WriteFailureToLog(lexer, u"LocalInstruction");
6294 }
6295 }
6296 #endif
6297 if (!match.hit)
6298 {
6299 match.value = null;
6300 }
6301 return match;
6302 }
6303 public static Match LoadInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Value* result)
6304 {
6305 #if (DEBUG)
6306 Span debugSpan;
6307 bool writeToLog = lexer.Log() != null;
6308 if (writeToLog)
6309 {
6310 debugSpan = lexer.GetSpan();
6311 System.Lex.WriteBeginRuleToLog(lexer, u"LoadInstruction");
6312 }
6313 #endif
6314 UniquePtr<cmsx.intermediate.Value> ptr;
6315 Match match(false);
6316 Match* parentMatch0 = &match;
6317 {
6318 long pos = lexer.GetPos();
6319 Span span = lexer.GetSpan();
6320 Match match(false);
6321 Match* parentMatch1 = &match;
6322 {
6323 Match match(false);
6324 Match* parentMatch2 = &match;
6325 {
6326 Match match(false);
6327 if (*lexer == LOAD)
6328 {
6329 ++lexer;
6330 match.hit = true;
6331 }
6332 *parentMatch2 = match;
6333 }
6334 if (match.hit)
6335 {
6336 Match match(false);
6337 Match* parentMatch3 = &match;
6338 {
6339 Match match(true);
6340 Match* parentMatch4 = &match;
6341 {
6342 System.Lex.Span span = lexer.GetSpan();
6343 Match match = IntermediateCodeFileParser.Operand(lexer, context);
6344 ptr.Reset(cast<cmsx.intermediate.Value*>(match.value));
6345 if (match.hit)
6346 {
6347 *parentMatch4 = match;
6348 }
6349 else
6350 {
6351 lexer.ThrowExpectationFailure(span, u"Operand");
6352 }
6353 }
6354 *parentMatch3 = match;
6355 }
6356 *parentMatch2 = match;
6357 }
6358 *parentMatch1 = match;
6359 }
6360 if (match.hit)
6361 {
6362 {
6363 #if (DEBUG)
6364 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LoadInstruction");
6365 #endif
6366 return Match(true, new cmsx.intermediate.LoadInstruction(result, ptr.Release(), span.line));
6367 }
6368 }
6369 *parentMatch0 = match;
6370 }
6371 #if (DEBUG)
6372 if (writeToLog)
6373 {
6374 if (match.hit)
6375 {
6376 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LoadInstruction");
6377 }
6378 else
6379 {
6380 System.Lex.WriteFailureToLog(lexer, u"LoadInstruction");
6381 }
6382 }
6383 #endif
6384 if (!match.hit)
6385 {
6386 match.value = null;
6387 }
6388 return match;
6389 }
6390 public static Match ElemAddrInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Value* result)
6391 {
6392 #if (DEBUG)
6393 Span debugSpan;
6394 bool writeToLog = lexer.Log() != null;
6395 if (writeToLog)
6396 {
6397 debugSpan = lexer.GetSpan();
6398 System.Lex.WriteBeginRuleToLog(lexer, u"ElemAddrInstruction");
6399 }
6400 #endif
6401 UniquePtr<cmsx.intermediate.Value> ptr;
6402 UniquePtr<cmsx.intermediate.Value> index;
6403 Match match(false);
6404 Match* parentMatch0 = &match;
6405 {
6406 long pos = lexer.GetPos();
6407 Span span = lexer.GetSpan();
6408 Match match(false);
6409 Match* parentMatch1 = &match;
6410 {
6411 Match match(false);
6412 Match* parentMatch2 = &match;
6413 {
6414 Match match(false);
6415 Match* parentMatch3 = &match;
6416 {
6417 Match match(false);
6418 Match* parentMatch4 = &match;
6419 {
6420 Match match(false);
6421 if (*lexer == ELEMADDR)
6422 {
6423 ++lexer;
6424 match.hit = true;
6425 }
6426 *parentMatch4 = match;
6427 }
6428 if (match.hit)
6429 {
6430 Match match(false);
6431 Match* parentMatch5 = &match;
6432 {
6433 Match match(true);
6434 Match* parentMatch6 = &match;
6435 {
6436 System.Lex.Span span = lexer.GetSpan();
6437 Match match = IntermediateCodeFileParser.Operand(lexer, context);
6438 ptr.Reset(cast<cmsx.intermediate.Value*>(match.value));
6439 if (match.hit)
6440 {
6441 *parentMatch6 = match;
6442 }
6443 else
6444 {
6445 lexer.ThrowExpectationFailure(span, u"Operand");
6446 }
6447 }
6448 *parentMatch5 = match;
6449 }
6450 *parentMatch4 = match;
6451 }
6452 *parentMatch3 = match;
6453 }
6454 if (match.hit)
6455 {
6456 Match match(false);
6457 Match* parentMatch7 = &match;
6458 {
6459 Match match(true);
6460 Match* parentMatch8 = &match;
6461 {
6462 System.Lex.Span span = lexer.GetSpan();
6463 Match match(false);
6464 if (*lexer == COMMA)
6465 {
6466 ++lexer;
6467 match.hit = true;
6468 }
6469 if (match.hit)
6470 {
6471 *parentMatch8 = match;
6472 }
6473 else
6474 {
6475 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
6476 }
6477 }
6478 *parentMatch7 = match;
6479 }
6480 *parentMatch3 = match;
6481 }
6482 *parentMatch2 = match;
6483 }
6484 if (match.hit)
6485 {
6486 Match match(false);
6487 Match* parentMatch9 = &match;
6488 {
6489 Match match(true);
6490 Match* parentMatch10 = &match;
6491 {
6492 System.Lex.Span span = lexer.GetSpan();
6493 Match match = IntermediateCodeFileParser.Operand(lexer, context);
6494 index.Reset(cast<cmsx.intermediate.Value*>(match.value));
6495 if (match.hit)
6496 {
6497 *parentMatch10 = match;
6498 }
6499 else
6500 {
6501 lexer.ThrowExpectationFailure(span, u"Operand");
6502 }
6503 }
6504 *parentMatch9 = match;
6505 }
6506 *parentMatch2 = match;
6507 }
6508 *parentMatch1 = match;
6509 }
6510 if (match.hit)
6511 {
6512 {
6513 #if (DEBUG)
6514 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ElemAddrInstruction");
6515 #endif
6516 return Match(true, new cmsx.intermediate.ElemAddrInstruction(result, ptr.Release(), index.Release(), span.line));
6517 }
6518 }
6519 *parentMatch0 = match;
6520 }
6521 #if (DEBUG)
6522 if (writeToLog)
6523 {
6524 if (match.hit)
6525 {
6526 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ElemAddrInstruction");
6527 }
6528 else
6529 {
6530 System.Lex.WriteFailureToLog(lexer, u"ElemAddrInstruction");
6531 }
6532 }
6533 #endif
6534 if (!match.hit)
6535 {
6536 match.value = null;
6537 }
6538 return match;
6539 }
6540 public static Match PtrOffsetInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Value* result)
6541 {
6542 #if (DEBUG)
6543 Span debugSpan;
6544 bool writeToLog = lexer.Log() != null;
6545 if (writeToLog)
6546 {
6547 debugSpan = lexer.GetSpan();
6548 System.Lex.WriteBeginRuleToLog(lexer, u"PtrOffsetInstruction");
6549 }
6550 #endif
6551 UniquePtr<cmsx.intermediate.Value> ptr;
6552 UniquePtr<cmsx.intermediate.Value> offset;
6553 Match match(false);
6554 Match* parentMatch0 = &match;
6555 {
6556 long pos = lexer.GetPos();
6557 Span span = lexer.GetSpan();
6558 Match match(false);
6559 Match* parentMatch1 = &match;
6560 {
6561 Match match(false);
6562 Match* parentMatch2 = &match;
6563 {
6564 Match match(false);
6565 Match* parentMatch3 = &match;
6566 {
6567 Match match(false);
6568 Match* parentMatch4 = &match;
6569 {
6570 Match match(false);
6571 if (*lexer == PTROFFSET)
6572 {
6573 ++lexer;
6574 match.hit = true;
6575 }
6576 *parentMatch4 = match;
6577 }
6578 if (match.hit)
6579 {
6580 Match match(false);
6581 Match* parentMatch5 = &match;
6582 {
6583 Match match(true);
6584 Match* parentMatch6 = &match;
6585 {
6586 System.Lex.Span span = lexer.GetSpan();
6587 Match match = IntermediateCodeFileParser.Operand(lexer, context);
6588 ptr.Reset(cast<cmsx.intermediate.Value*>(match.value));
6589 if (match.hit)
6590 {
6591 *parentMatch6 = match;
6592 }
6593 else
6594 {
6595 lexer.ThrowExpectationFailure(span, u"Operand");
6596 }
6597 }
6598 *parentMatch5 = match;
6599 }
6600 *parentMatch4 = match;
6601 }
6602 *parentMatch3 = match;
6603 }
6604 if (match.hit)
6605 {
6606 Match match(false);
6607 Match* parentMatch7 = &match;
6608 {
6609 Match match(true);
6610 Match* parentMatch8 = &match;
6611 {
6612 System.Lex.Span span = lexer.GetSpan();
6613 Match match(false);
6614 if (*lexer == COMMA)
6615 {
6616 ++lexer;
6617 match.hit = true;
6618 }
6619 if (match.hit)
6620 {
6621 *parentMatch8 = match;
6622 }
6623 else
6624 {
6625 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
6626 }
6627 }
6628 *parentMatch7 = match;
6629 }
6630 *parentMatch3 = match;
6631 }
6632 *parentMatch2 = match;
6633 }
6634 if (match.hit)
6635 {
6636 Match match(false);
6637 Match* parentMatch9 = &match;
6638 {
6639 Match match(true);
6640 Match* parentMatch10 = &match;
6641 {
6642 System.Lex.Span span = lexer.GetSpan();
6643 Match match = IntermediateCodeFileParser.Operand(lexer, context);
6644 offset.Reset(cast<cmsx.intermediate.Value*>(match.value));
6645 if (match.hit)
6646 {
6647 *parentMatch10 = match;
6648 }
6649 else
6650 {
6651 lexer.ThrowExpectationFailure(span, u"Operand");
6652 }
6653 }
6654 *parentMatch9 = match;
6655 }
6656 *parentMatch2 = match;
6657 }
6658 *parentMatch1 = match;
6659 }
6660 if (match.hit)
6661 {
6662 {
6663 #if (DEBUG)
6664 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PtrOffsetInstruction");
6665 #endif
6666 return Match(true, new cmsx.intermediate.PtrOffsetInstruction(result, ptr.Release(), offset.Release(), span.line));
6667 }
6668 }
6669 *parentMatch0 = match;
6670 }
6671 #if (DEBUG)
6672 if (writeToLog)
6673 {
6674 if (match.hit)
6675 {
6676 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PtrOffsetInstruction");
6677 }
6678 else
6679 {
6680 System.Lex.WriteFailureToLog(lexer, u"PtrOffsetInstruction");
6681 }
6682 }
6683 #endif
6684 if (!match.hit)
6685 {
6686 match.value = null;
6687 }
6688 return match;
6689 }
6690 public static Match PtrDiffInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Value* result)
6691 {
6692 #if (DEBUG)
6693 Span debugSpan;
6694 bool writeToLog = lexer.Log() != null;
6695 if (writeToLog)
6696 {
6697 debugSpan = lexer.GetSpan();
6698 System.Lex.WriteBeginRuleToLog(lexer, u"PtrDiffInstruction");
6699 }
6700 #endif
6701 UniquePtr<cmsx.intermediate.Value> leftPtr;
6702 UniquePtr<cmsx.intermediate.Value> rightPtr;
6703 Match match(false);
6704 Match* parentMatch0 = &match;
6705 {
6706 long pos = lexer.GetPos();
6707 Span span = lexer.GetSpan();
6708 Match match(false);
6709 Match* parentMatch1 = &match;
6710 {
6711 Match match(false);
6712 Match* parentMatch2 = &match;
6713 {
6714 Match match(false);
6715 Match* parentMatch3 = &match;
6716 {
6717 Match match(false);
6718 Match* parentMatch4 = &match;
6719 {
6720 Match match(false);
6721 if (*lexer == PTRDIFF)
6722 {
6723 ++lexer;
6724 match.hit = true;
6725 }
6726 *parentMatch4 = match;
6727 }
6728 if (match.hit)
6729 {
6730 Match match(false);
6731 Match* parentMatch5 = &match;
6732 {
6733 Match match(true);
6734 Match* parentMatch6 = &match;
6735 {
6736 System.Lex.Span span = lexer.GetSpan();
6737 Match match = IntermediateCodeFileParser.Operand(lexer, context);
6738 leftPtr.Reset(cast<cmsx.intermediate.Value*>(match.value));
6739 if (match.hit)
6740 {
6741 *parentMatch6 = match;
6742 }
6743 else
6744 {
6745 lexer.ThrowExpectationFailure(span, u"Operand");
6746 }
6747 }
6748 *parentMatch5 = match;
6749 }
6750 *parentMatch4 = match;
6751 }
6752 *parentMatch3 = match;
6753 }
6754 if (match.hit)
6755 {
6756 Match match(false);
6757 Match* parentMatch7 = &match;
6758 {
6759 Match match(true);
6760 Match* parentMatch8 = &match;
6761 {
6762 System.Lex.Span span = lexer.GetSpan();
6763 Match match(false);
6764 if (*lexer == COMMA)
6765 {
6766 ++lexer;
6767 match.hit = true;
6768 }
6769 if (match.hit)
6770 {
6771 *parentMatch8 = match;
6772 }
6773 else
6774 {
6775 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
6776 }
6777 }
6778 *parentMatch7 = match;
6779 }
6780 *parentMatch3 = match;
6781 }
6782 *parentMatch2 = match;
6783 }
6784 if (match.hit)
6785 {
6786 Match match(false);
6787 Match* parentMatch9 = &match;
6788 {
6789 Match match(true);
6790 Match* parentMatch10 = &match;
6791 {
6792 System.Lex.Span span = lexer.GetSpan();
6793 Match match = IntermediateCodeFileParser.Operand(lexer, context);
6794 rightPtr.Reset(cast<cmsx.intermediate.Value*>(match.value));
6795 if (match.hit)
6796 {
6797 *parentMatch10 = match;
6798 }
6799 else
6800 {
6801 lexer.ThrowExpectationFailure(span, u"Operand");
6802 }
6803 }
6804 *parentMatch9 = match;
6805 }
6806 *parentMatch2 = match;
6807 }
6808 *parentMatch1 = match;
6809 }
6810 if (match.hit)
6811 {
6812 {
6813 #if (DEBUG)
6814 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PtrDiffInstruction");
6815 #endif
6816 return Match(true, new cmsx.intermediate.PtrDiffInstruction(result, leftPtr.Release(), rightPtr.Release(), span.line));
6817 }
6818 }
6819 *parentMatch0 = match;
6820 }
6821 #if (DEBUG)
6822 if (writeToLog)
6823 {
6824 if (match.hit)
6825 {
6826 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PtrDiffInstruction");
6827 }
6828 else
6829 {
6830 System.Lex.WriteFailureToLog(lexer, u"PtrDiffInstruction");
6831 }
6832 }
6833 #endif
6834 if (!match.hit)
6835 {
6836 match.value = null;
6837 }
6838 return match;
6839 }
6840 public static Match FunctionCallInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Value* result)
6841 {
6842 #if (DEBUG)
6843 Span debugSpan;
6844 bool writeToLog = lexer.Log() != null;
6845 if (writeToLog)
6846 {
6847 debugSpan = lexer.GetSpan();
6848 System.Lex.WriteBeginRuleToLog(lexer, u"FunctionCallInstruction");
6849 }
6850 #endif
6851 cmsx.intermediate.Type* functionType;
6852 UniquePtr<cmsx.intermediate.Type> ft;
6853 UniquePtr<cmsx.intermediate.Value> callee;
6854 Match match(false);
6855 Match* parentMatch0 = &match;
6856 {
6857 long pos = lexer.GetPos();
6858 Span span = lexer.GetSpan();
6859 Match match(false);
6860 Match* parentMatch1 = &match;
6861 {
6862 Match match(false);
6863 Match* parentMatch2 = &match;
6864 {
6865 Match match(false);
6866 Match* parentMatch3 = &match;
6867 {
6868 Match match(false);
6869 if (*lexer == CALL)
6870 {
6871 ++lexer;
6872 match.hit = true;
6873 }
6874 *parentMatch3 = match;
6875 }
6876 if (match.hit)
6877 {
6878 Match match(false);
6879 Match* parentMatch4 = &match;
6880 {
6881 Match match(false);
6882 Match* parentMatch5 = &match;
6883 {
6884 long pos = lexer.GetPos();
6885 Match match(true);
6886 Match* parentMatch6 = &match;
6887 {
6888 System.Lex.Span span = lexer.GetSpan();
6889 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
6890 ft.Reset(cast<cmsx.intermediate.Type*>(match.value));
6891 if (match.hit)
6892 {
6893 *parentMatch6 = match;
6894 }
6895 else
6896 {
6897 lexer.ThrowExpectationFailure(span, u"TypeExpr");
6898 }
6899 }
6900 if (match.hit)
6901 {
6902 functionType = ft.Release();
6903 }
6904 *parentMatch5 = match;
6905 }
6906 *parentMatch4 = match;
6907 }
6908 *parentMatch3 = match;
6909 }
6910 *parentMatch2 = match;
6911 }
6912 if (match.hit)
6913 {
6914 Match match(false);
6915 Match* parentMatch7 = &match;
6916 {
6917 Match match(true);
6918 Match* parentMatch8 = &match;
6919 {
6920 System.Lex.Span span = lexer.GetSpan();
6921 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, functionType);
6922 callee.Reset(cast<cmsx.intermediate.Value*>(match.value));
6923 if (match.hit)
6924 {
6925 *parentMatch8 = match;
6926 }
6927 else
6928 {
6929 lexer.ThrowExpectationFailure(span, u"TypedValue");
6930 }
6931 }
6932 *parentMatch7 = match;
6933 }
6934 *parentMatch2 = match;
6935 }
6936 *parentMatch1 = match;
6937 }
6938 if (match.hit)
6939 {
6940 {
6941 #if (DEBUG)
6942 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FunctionCallInstruction");
6943 #endif
6944 return Match(true, new cmsx.intermediate.FunctionCallInstruction(result, callee.Release(), span.line));
6945 }
6946 }
6947 *parentMatch0 = match;
6948 }
6949 #if (DEBUG)
6950 if (writeToLog)
6951 {
6952 if (match.hit)
6953 {
6954 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FunctionCallInstruction");
6955 }
6956 else
6957 {
6958 System.Lex.WriteFailureToLog(lexer, u"FunctionCallInstruction");
6959 }
6960 }
6961 #endif
6962 if (!match.hit)
6963 {
6964 match.value = null;
6965 }
6966 return match;
6967 }
6968 public static Match TrapInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Value* result)
6969 {
6970 #if (DEBUG)
6971 Span debugSpan;
6972 bool writeToLog = lexer.Log() != null;
6973 if (writeToLog)
6974 {
6975 debugSpan = lexer.GetSpan();
6976 System.Lex.WriteBeginRuleToLog(lexer, u"TrapInstruction");
6977 }
6978 #endif
6979 cmsx.intermediate.Type* type1;
6980 cmsx.intermediate.Type* type2;
6981 cmsx.intermediate.Type* type3;
6982 UniquePtr<cmsx.intermediate.Type> t1;
6983 UniquePtr<cmsx.intermediate.Value> val1;
6984 UniquePtr<cmsx.intermediate.Type> t2;
6985 UniquePtr<cmsx.intermediate.Value> val2;
6986 UniquePtr<cmsx.intermediate.Type> t3;
6987 UniquePtr<cmsx.intermediate.Value> val3;
6988 Match match(false);
6989 Match* parentMatch0 = &match;
6990 {
6991 long pos = lexer.GetPos();
6992 Span span = lexer.GetSpan();
6993 Match match(false);
6994 Match* parentMatch1 = &match;
6995 {
6996 Match match(false);
6997 Match* parentMatch2 = &match;
6998 {
6999 Match match(false);
7000 Match* parentMatch3 = &match;
7001 {
7002 Match match(false);
7003 Match* parentMatch4 = &match;
7004 {
7005 Match match(false);
7006 Match* parentMatch5 = &match;
7007 {
7008 Match match(false);
7009 Match* parentMatch6 = &match;
7010 {
7011 Match match(false);
7012 Match* parentMatch7 = &match;
7013 {
7014 Match match(false);
7015 Match* parentMatch8 = &match;
7016 {
7017 Match match(false);
7018 Match* parentMatch9 = &match;
7019 {
7020 Match match(false);
7021 if (*lexer == TRAP)
7022 {
7023 ++lexer;
7024 match.hit = true;
7025 }
7026 *parentMatch9 = match;
7027 }
7028 if (match.hit)
7029 {
7030 Match match(false);
7031 Match* parentMatch10 = &match;
7032 {
7033 Match match(false);
7034 Match* parentMatch11 = &match;
7035 {
7036 long pos = lexer.GetPos();
7037 Match match(true);
7038 Match* parentMatch12 = &match;
7039 {
7040 System.Lex.Span span = lexer.GetSpan();
7041 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
7042 t1.Reset(cast<cmsx.intermediate.Type*>(match.value));
7043 if (match.hit)
7044 {
7045 *parentMatch12 = match;
7046 }
7047 else
7048 {
7049 lexer.ThrowExpectationFailure(span, u"TypeExpr");
7050 }
7051 }
7052 if (match.hit)
7053 {
7054 type1 = t1.Release();
7055 }
7056 *parentMatch11 = match;
7057 }
7058 *parentMatch10 = match;
7059 }
7060 *parentMatch9 = match;
7061 }
7062 *parentMatch8 = match;
7063 }
7064 if (match.hit)
7065 {
7066 Match match(false);
7067 Match* parentMatch13 = &match;
7068 {
7069 Match match(true);
7070 Match* parentMatch14 = &match;
7071 {
7072 System.Lex.Span span = lexer.GetSpan();
7073 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, type1);
7074 val1.Reset(cast<cmsx.intermediate.Value*>(match.value));
7075 if (match.hit)
7076 {
7077 *parentMatch14 = match;
7078 }
7079 else
7080 {
7081 lexer.ThrowExpectationFailure(span, u"TypedValue");
7082 }
7083 }
7084 *parentMatch13 = match;
7085 }
7086 *parentMatch8 = match;
7087 }
7088 *parentMatch7 = match;
7089 }
7090 if (match.hit)
7091 {
7092 Match match(false);
7093 Match* parentMatch15 = &match;
7094 {
7095 Match match(true);
7096 Match* parentMatch16 = &match;
7097 {
7098 System.Lex.Span span = lexer.GetSpan();
7099 Match match(false);
7100 if (*lexer == COMMA)
7101 {
7102 ++lexer;
7103 match.hit = true;
7104 }
7105 if (match.hit)
7106 {
7107 *parentMatch16 = match;
7108 }
7109 else
7110 {
7111 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
7112 }
7113 }
7114 *parentMatch15 = match;
7115 }
7116 *parentMatch7 = match;
7117 }
7118 *parentMatch6 = match;
7119 }
7120 if (match.hit)
7121 {
7122 Match match(false);
7123 Match* parentMatch17 = &match;
7124 {
7125 Match match(false);
7126 Match* parentMatch18 = &match;
7127 {
7128 long pos = lexer.GetPos();
7129 Match match(true);
7130 Match* parentMatch19 = &match;
7131 {
7132 System.Lex.Span span = lexer.GetSpan();
7133 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
7134 t2.Reset(cast<cmsx.intermediate.Type*>(match.value));
7135 if (match.hit)
7136 {
7137 *parentMatch19 = match;
7138 }
7139 else
7140 {
7141 lexer.ThrowExpectationFailure(span, u"TypeExpr");
7142 }
7143 }
7144 if (match.hit)
7145 {
7146 type2 = t2.Release();
7147 }
7148 *parentMatch18 = match;
7149 }
7150 *parentMatch17 = match;
7151 }
7152 *parentMatch6 = match;
7153 }
7154 *parentMatch5 = match;
7155 }
7156 if (match.hit)
7157 {
7158 Match match(false);
7159 Match* parentMatch20 = &match;
7160 {
7161 Match match(true);
7162 Match* parentMatch21 = &match;
7163 {
7164 System.Lex.Span span = lexer.GetSpan();
7165 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, type2);
7166 val2.Reset(cast<cmsx.intermediate.Value*>(match.value));
7167 if (match.hit)
7168 {
7169 *parentMatch21 = match;
7170 }
7171 else
7172 {
7173 lexer.ThrowExpectationFailure(span, u"TypedValue");
7174 }
7175 }
7176 *parentMatch20 = match;
7177 }
7178 *parentMatch5 = match;
7179 }
7180 *parentMatch4 = match;
7181 }
7182 if (match.hit)
7183 {
7184 Match match(false);
7185 Match* parentMatch22 = &match;
7186 {
7187 Match match(true);
7188 Match* parentMatch23 = &match;
7189 {
7190 System.Lex.Span span = lexer.GetSpan();
7191 Match match(false);
7192 if (*lexer == COMMA)
7193 {
7194 ++lexer;
7195 match.hit = true;
7196 }
7197 if (match.hit)
7198 {
7199 *parentMatch23 = match;
7200 }
7201 else
7202 {
7203 lexer.ThrowExpectationFailure(span, GetTokenName(COMMA));
7204 }
7205 }
7206 *parentMatch22 = match;
7207 }
7208 *parentMatch4 = match;
7209 }
7210 *parentMatch3 = match;
7211 }
7212 if (match.hit)
7213 {
7214 Match match(false);
7215 Match* parentMatch24 = &match;
7216 {
7217 Match match(false);
7218 Match* parentMatch25 = &match;
7219 {
7220 long pos = lexer.GetPos();
7221 Match match(true);
7222 Match* parentMatch26 = &match;
7223 {
7224 System.Lex.Span span = lexer.GetSpan();
7225 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
7226 t3.Reset(cast<cmsx.intermediate.Type*>(match.value));
7227 if (match.hit)
7228 {
7229 *parentMatch26 = match;
7230 }
7231 else
7232 {
7233 lexer.ThrowExpectationFailure(span, u"TypeExpr");
7234 }
7235 }
7236 if (match.hit)
7237 {
7238 type3 = t3.Release();
7239 }
7240 *parentMatch25 = match;
7241 }
7242 *parentMatch24 = match;
7243 }
7244 *parentMatch3 = match;
7245 }
7246 *parentMatch2 = match;
7247 }
7248 if (match.hit)
7249 {
7250 Match match(false);
7251 Match* parentMatch27 = &match;
7252 {
7253 Match match(true);
7254 Match* parentMatch28 = &match;
7255 {
7256 System.Lex.Span span = lexer.GetSpan();
7257 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, type3);
7258 val3.Reset(cast<cmsx.intermediate.Value*>(match.value));
7259 if (match.hit)
7260 {
7261 *parentMatch28 = match;
7262 }
7263 else
7264 {
7265 lexer.ThrowExpectationFailure(span, u"TypedValue");
7266 }
7267 }
7268 *parentMatch27 = match;
7269 }
7270 *parentMatch2 = match;
7271 }
7272 *parentMatch1 = match;
7273 }
7274 if (match.hit)
7275 {
7276 {
7277 #if (DEBUG)
7278 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TrapInstruction");
7279 #endif
7280 return Match(true, new cmsx.intermediate.TrapInstruction(result, val1.Release(), val2.Release(), val3.Release(), span.line));
7281 }
7282 }
7283 *parentMatch0 = match;
7284 }
7285 #if (DEBUG)
7286 if (writeToLog)
7287 {
7288 if (match.hit)
7289 {
7290 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TrapInstruction");
7291 }
7292 else
7293 {
7294 System.Lex.WriteFailureToLog(lexer, u"TrapInstruction");
7295 }
7296 }
7297 #endif
7298 if (!match.hit)
7299 {
7300 match.value = null;
7301 }
7302 return match;
7303 }
7304 public static Match NoOperationInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
7305 {
7306 #if (DEBUG)
7307 Span debugSpan;
7308 bool writeToLog = lexer.Log() != null;
7309 if (writeToLog)
7310 {
7311 debugSpan = lexer.GetSpan();
7312 System.Lex.WriteBeginRuleToLog(lexer, u"NoOperationInstruction");
7313 }
7314 #endif
7315 Match match(false);
7316 Match* parentMatch0 = &match;
7317 {
7318 long pos = lexer.GetPos();
7319 Span span = lexer.GetSpan();
7320 Match match(false);
7321 if (*lexer == NOP)
7322 {
7323 ++lexer;
7324 match.hit = true;
7325 }
7326 if (match.hit)
7327 {
7328 {
7329 #if (DEBUG)
7330 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NoOperationInstruction");
7331 #endif
7332 return Match(true, new cmsx.intermediate.NoOperationInstruction(span.line));
7333 }
7334 }
7335 *parentMatch0 = match;
7336 }
7337 #if (DEBUG)
7338 if (writeToLog)
7339 {
7340 if (match.hit)
7341 {
7342 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"NoOperationInstruction");
7343 }
7344 else
7345 {
7346 System.Lex.WriteFailureToLog(lexer, u"NoOperationInstruction");
7347 }
7348 }
7349 #endif
7350 if (!match.hit)
7351 {
7352 match.value = null;
7353 }
7354 return match;
7355 }
7356 public static Match SaveInstruction(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
7357 {
7358 #if (DEBUG)
7359 Span debugSpan;
7360 bool writeToLog = lexer.Log() != null;
7361 if (writeToLog)
7362 {
7363 debugSpan = lexer.GetSpan();
7364 System.Lex.WriteBeginRuleToLog(lexer, u"SaveInstruction");
7365 }
7366 #endif
7367 Match match(false);
7368 Match* parentMatch0 = &match;
7369 {
7370 long pos = lexer.GetPos();
7371 Span span = lexer.GetSpan();
7372 Match match(false);
7373 if (*lexer == SAVE)
7374 {
7375 ++lexer;
7376 match.hit = true;
7377 }
7378 if (match.hit)
7379 {
7380 {
7381 #if (DEBUG)
7382 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"SaveInstruction");
7383 #endif
7384 return Match(true, new cmsx.intermediate.SaveInstruction(span.line));
7385 }
7386 }
7387 *parentMatch0 = match;
7388 }
7389 #if (DEBUG)
7390 if (writeToLog)
7391 {
7392 if (match.hit)
7393 {
7394 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"SaveInstruction");
7395 }
7396 else
7397 {
7398 System.Lex.WriteFailureToLog(lexer, u"SaveInstruction");
7399 }
7400 }
7401 #endif
7402 if (!match.hit)
7403 {
7404 match.value = null;
7405 }
7406 return match;
7407 }
7408 public static Match Operand(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
7409 {
7410 #if (DEBUG)
7411 Span debugSpan;
7412 bool writeToLog = lexer.Log() != null;
7413 if (writeToLog)
7414 {
7415 debugSpan = lexer.GetSpan();
7416 System.Lex.WriteBeginRuleToLog(lexer, u"Operand");
7417 }
7418 #endif
7419 cmsx.intermediate.Type* type;
7420 UniquePtr<cmsx.intermediate.Type> t;
7421 UniquePtr<cmsx.intermediate.Value> val;
7422 Match match(false);
7423 Match* parentMatch0 = &match;
7424 {
7425 long pos = lexer.GetPos();
7426 Match match(false);
7427 Match* parentMatch1 = &match;
7428 {
7429 Match match(false);
7430 Match* parentMatch2 = &match;
7431 {
7432 Match match(false);
7433 Match* parentMatch3 = &match;
7434 {
7435 long pos = lexer.GetPos();
7436 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
7437 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
7438 if (match.hit)
7439 {
7440 type = t.Release();
7441 }
7442 *parentMatch3 = match;
7443 }
7444 *parentMatch2 = match;
7445 }
7446 if (match.hit)
7447 {
7448 Match match(false);
7449 Match* parentMatch4 = &match;
7450 {
7451 Match match(true);
7452 Match* parentMatch5 = &match;
7453 {
7454 System.Lex.Span span = lexer.GetSpan();
7455 Match match = IntermediateCodeFileParser.TypedValue(lexer, context, type);
7456 val.Reset(cast<cmsx.intermediate.Value*>(match.value));
7457 if (match.hit)
7458 {
7459 *parentMatch5 = match;
7460 }
7461 else
7462 {
7463 lexer.ThrowExpectationFailure(span, u"TypedValue");
7464 }
7465 }
7466 *parentMatch4 = match;
7467 }
7468 *parentMatch2 = match;
7469 }
7470 *parentMatch1 = match;
7471 }
7472 if (match.hit)
7473 {
7474 {
7475 #if (DEBUG)
7476 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operand");
7477 #endif
7478 return Match(true, val.Release());
7479 }
7480 }
7481 *parentMatch0 = match;
7482 }
7483 #if (DEBUG)
7484 if (writeToLog)
7485 {
7486 if (match.hit)
7487 {
7488 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Operand");
7489 }
7490 else
7491 {
7492 System.Lex.WriteFailureToLog(lexer, u"Operand");
7493 }
7494 }
7495 #endif
7496 if (!match.hit)
7497 {
7498 match.value = null;
7499 }
7500 return match;
7501 }
7502 public static Match TypeExpr(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
7503 {
7504 #if (DEBUG)
7505 Span debugSpan;
7506 bool writeToLog = lexer.Log() != null;
7507 if (writeToLog)
7508 {
7509 debugSpan = lexer.GetSpan();
7510 System.Lex.WriteBeginRuleToLog(lexer, u"TypeExpr");
7511 }
7512 #endif
7513 UniquePtr<cmsx.intermediate.Type> postfix;
7514 Match match(false);
7515 Match* parentMatch0 = &match;
7516 {
7517 long pos = lexer.GetPos();
7518 Match match = IntermediateCodeFileParser.PostfixTypeExpr(lexer, context);
7519 postfix.Reset(cast<cmsx.intermediate.Type*>(match.value));
7520 if (match.hit)
7521 {
7522 {
7523 #if (DEBUG)
7524 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TypeExpr");
7525 #endif
7526 return Match(true, postfix.Release());
7527 }
7528 }
7529 *parentMatch0 = match;
7530 }
7531 #if (DEBUG)
7532 if (writeToLog)
7533 {
7534 if (match.hit)
7535 {
7536 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TypeExpr");
7537 }
7538 else
7539 {
7540 System.Lex.WriteFailureToLog(lexer, u"TypeExpr");
7541 }
7542 }
7543 #endif
7544 if (!match.hit)
7545 {
7546 match.value = null;
7547 }
7548 return match;
7549 }
7550 public static Match PostfixTypeExpr(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
7551 {
7552 #if (DEBUG)
7553 Span debugSpan;
7554 bool writeToLog = lexer.Log() != null;
7555 if (writeToLog)
7556 {
7557 debugSpan = lexer.GetSpan();
7558 System.Lex.WriteBeginRuleToLog(lexer, u"PostfixTypeExpr");
7559 }
7560 #endif
7561 cmsx.intermediate.Type* type;
7562 UniquePtr<cmsx.intermediate.Type> primary;
7563 Match match(false);
7564 Match* parentMatch0 = &match;
7565 {
7566 long pos = lexer.GetPos();
7567 Match match(false);
7568 Match* parentMatch1 = &match;
7569 {
7570 Match match(false);
7571 Match* parentMatch2 = &match;
7572 {
7573 Match match(false);
7574 Match* parentMatch3 = &match;
7575 {
7576 long pos = lexer.GetPos();
7577 Match match = IntermediateCodeFileParser.PrimaryTypeExpr(lexer, context);
7578 primary.Reset(cast<cmsx.intermediate.Type*>(match.value));
7579 if (match.hit)
7580 {
7581 type = primary.Release();
7582 }
7583 *parentMatch3 = match;
7584 }
7585 *parentMatch2 = match;
7586 }
7587 if (match.hit)
7588 {
7589 Match match(false);
7590 Match* parentMatch4 = &match;
7591 {
7592 Match match(true);
7593 Match* parentMatch5 = &match;
7594 {
7595 while (true)
7596 {
7597 long save = lexer.GetPos();
7598 {
7599 Match match(false);
7600 Match* parentMatch6 = &match;
7601 {
7602 Match match(false);
7603 Match* parentMatch7 = &match;
7604 {
7605 long pos = lexer.GetPos();
7606 Match match(false);
7607 if (*lexer == AST)
7608 {
7609 ++lexer;
7610 match.hit = true;
7611 }
7612 if (match.hit)
7613 {
7614 type = context->GetPtrType(type);
7615 }
7616 *parentMatch7 = match;
7617 }
7618 *parentMatch6 = match;
7619 }
7620 if (match.hit)
7621 {
7622 *parentMatch5 = match;
7623 }
7624 else
7625 {
7626 lexer.SetPos(save);
7627 break;
7628 }
7629 }
7630 }
7631 }
7632 *parentMatch4 = match;
7633 }
7634 *parentMatch2 = match;
7635 }
7636 *parentMatch1 = match;
7637 }
7638 if (match.hit)
7639 {
7640 {
7641 #if (DEBUG)
7642 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PostfixTypeExpr");
7643 #endif
7644 return Match(true, type);
7645 }
7646 }
7647 *parentMatch0 = match;
7648 }
7649 #if (DEBUG)
7650 if (writeToLog)
7651 {
7652 if (match.hit)
7653 {
7654 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PostfixTypeExpr");
7655 }
7656 else
7657 {
7658 System.Lex.WriteFailureToLog(lexer, u"PostfixTypeExpr");
7659 }
7660 }
7661 #endif
7662 if (!match.hit)
7663 {
7664 match.value = null;
7665 }
7666 return match;
7667 }
7668 public static Match PrimaryTypeExpr(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
7669 {
7670 #if (DEBUG)
7671 Span debugSpan;
7672 bool writeToLog = lexer.Log() != null;
7673 if (writeToLog)
7674 {
7675 debugSpan = lexer.GetSpan();
7676 System.Lex.WriteBeginRuleToLog(lexer, u"PrimaryTypeExpr");
7677 }
7678 #endif
7679 UniquePtr<cmsx.intermediate.Type> typeId;
7680 UniquePtr<cmsx.intermediate.Type> primitive;
7681 Match match(false);
7682 Match* parentMatch0 = &match;
7683 {
7684 long save = lexer.GetPos();
7685 Match match(false);
7686 Match* parentMatch1 = &match;
7687 {
7688 long pos = lexer.GetPos();
7689 Match match = IntermediateCodeFileParser.TypeId(lexer, context);
7690 typeId.Reset(cast<cmsx.intermediate.Type*>(match.value));
7691 if (match.hit)
7692 {
7693 {
7694 #if (DEBUG)
7695 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimaryTypeExpr");
7696 #endif
7697 return Match(true, typeId.Release());
7698 }
7699 }
7700 *parentMatch1 = match;
7701 }
7702 *parentMatch0 = match;
7703 if (!match.hit)
7704 {
7705 Match match(false);
7706 Match* parentMatch2 = &match;
7707 lexer.SetPos(save);
7708 {
7709 Match match(false);
7710 Match* parentMatch3 = &match;
7711 {
7712 long pos = lexer.GetPos();
7713 Match match = IntermediateCodeFileParser.PrimitiveType(lexer, context);
7714 primitive.Reset(cast<cmsx.intermediate.Type*>(match.value));
7715 if (match.hit)
7716 {
7717 {
7718 #if (DEBUG)
7719 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimaryTypeExpr");
7720 #endif
7721 return Match(true, primitive.Release());
7722 }
7723 }
7724 *parentMatch3 = match;
7725 }
7726 *parentMatch2 = match;
7727 }
7728 *parentMatch0 = match;
7729 }
7730 }
7731 #if (DEBUG)
7732 if (writeToLog)
7733 {
7734 if (match.hit)
7735 {
7736 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimaryTypeExpr");
7737 }
7738 else
7739 {
7740 System.Lex.WriteFailureToLog(lexer, u"PrimaryTypeExpr");
7741 }
7742 }
7743 #endif
7744 if (!match.hit)
7745 {
7746 match.value = null;
7747 }
7748 return match;
7749 }
7750 public static Match TypeId(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
7751 {
7752 #if (DEBUG)
7753 Span debugSpan;
7754 bool writeToLog = lexer.Log() != null;
7755 if (writeToLog)
7756 {
7757 debugSpan = lexer.GetSpan();
7758 System.Lex.WriteBeginRuleToLog(lexer, u"TypeId");
7759 }
7760 #endif
7761 Match match(false);
7762 Match* parentMatch0 = &match;
7763 {
7764 long pos = lexer.GetPos();
7765 Span span = lexer.GetSpan();
7766 Match match(false);
7767 if (*lexer == TYPEID)
7768 {
7769 ++lexer;
7770 match.hit = true;
7771 }
7772 if (match.hit)
7773 {
7774 {
7775 #if (DEBUG)
7776 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TypeId");
7777 #endif
7778 return Match(true, context->GetTypeById(span.line, ToUtf8(lexer.GetToken(pos).match.ToString())));
7779 }
7780 }
7781 *parentMatch0 = match;
7782 }
7783 #if (DEBUG)
7784 if (writeToLog)
7785 {
7786 if (match.hit)
7787 {
7788 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TypeId");
7789 }
7790 else
7791 {
7792 System.Lex.WriteFailureToLog(lexer, u"TypeId");
7793 }
7794 }
7795 #endif
7796 if (!match.hit)
7797 {
7798 match.value = null;
7799 }
7800 return match;
7801 }
7802 public static Match PrimitiveType(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
7803 {
7804 #if (DEBUG)
7805 Span debugSpan;
7806 bool writeToLog = lexer.Log() != null;
7807 if (writeToLog)
7808 {
7809 debugSpan = lexer.GetSpan();
7810 System.Lex.WriteBeginRuleToLog(lexer, u"PrimitiveType");
7811 }
7812 #endif
7813 Match match(false);
7814 long pos = lexer.GetPos();
7815 Span span = lexer.GetSpan();
7816 switch (*lexer)
7817 {
7818 case VOID:
7819 {
7820 ++lexer;
7821 {
7822 #if (DEBUG)
7823 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7824 #endif
7825 return Match(true, context->GetVoidType());
7826 }
7827 break;
7828 }
7829 case BOOL:
7830 {
7831 ++lexer;
7832 {
7833 #if (DEBUG)
7834 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7835 #endif
7836 return Match(true, context->GetBoolType());
7837 }
7838 break;
7839 }
7840 case SBYTE:
7841 {
7842 ++lexer;
7843 {
7844 #if (DEBUG)
7845 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7846 #endif
7847 return Match(true, context->GetSByteType());
7848 }
7849 break;
7850 }
7851 case BYTE:
7852 {
7853 ++lexer;
7854 {
7855 #if (DEBUG)
7856 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7857 #endif
7858 return Match(true, context->GetByteType());
7859 }
7860 break;
7861 }
7862 case SHORT:
7863 {
7864 ++lexer;
7865 {
7866 #if (DEBUG)
7867 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7868 #endif
7869 return Match(true, context->GetShortType());
7870 }
7871 break;
7872 }
7873 case USHORT:
7874 {
7875 ++lexer;
7876 {
7877 #if (DEBUG)
7878 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7879 #endif
7880 return Match(true, context->GetUShortType());
7881 }
7882 break;
7883 }
7884 case INT:
7885 {
7886 ++lexer;
7887 {
7888 #if (DEBUG)
7889 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7890 #endif
7891 return Match(true, context->GetIntType());
7892 }
7893 break;
7894 }
7895 case UINT:
7896 {
7897 ++lexer;
7898 {
7899 #if (DEBUG)
7900 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7901 #endif
7902 return Match(true, context->GetUIntType());
7903 }
7904 break;
7905 }
7906 case LONG:
7907 {
7908 ++lexer;
7909 {
7910 #if (DEBUG)
7911 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7912 #endif
7913 return Match(true, context->GetLongType());
7914 }
7915 break;
7916 }
7917 case ULONG:
7918 {
7919 ++lexer;
7920 {
7921 #if (DEBUG)
7922 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7923 #endif
7924 return Match(true, context->GetULongType());
7925 }
7926 break;
7927 }
7928 case FLOAT:
7929 {
7930 ++lexer;
7931 {
7932 #if (DEBUG)
7933 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7934 #endif
7935 return Match(true, context->GetFloatType());
7936 }
7937 break;
7938 }
7939 case DOUBLE:
7940 {
7941 ++lexer;
7942 {
7943 #if (DEBUG)
7944 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7945 #endif
7946 return Match(true, context->GetDoubleType());
7947 }
7948 break;
7949 }
7950 }
7951 #if (DEBUG)
7952 if (writeToLog)
7953 {
7954 if (match.hit)
7955 {
7956 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveType");
7957 }
7958 else
7959 {
7960 System.Lex.WriteFailureToLog(lexer, u"PrimitiveType");
7961 }
7962 }
7963 #endif
7964 if (!match.hit)
7965 {
7966 match.value = null;
7967 }
7968 return match;
7969 }
7970 public static Match PrimitiveTypeName(IntermediateCodeLexer& lexer)
7971 {
7972 #if (DEBUG)
7973 Span debugSpan;
7974 bool writeToLog = lexer.Log() != null;
7975 if (writeToLog)
7976 {
7977 debugSpan = lexer.GetSpan();
7978 System.Lex.WriteBeginRuleToLog(lexer, u"PrimitiveTypeName");
7979 }
7980 #endif
7981 Match match(false);
7982 long pos = lexer.GetPos();
7983 Span span = lexer.GetSpan();
7984 switch (*lexer)
7985 {
7986 case VOID:
7987 {
7988 ++lexer;
7989 {
7990 #if (DEBUG)
7991 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
7992 #endif
7993 return Match(true, new Value<string>("void"));
7994 }
7995 break;
7996 }
7997 case BOOL:
7998 {
7999 ++lexer;
8000 {
8001 #if (DEBUG)
8002 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8003 #endif
8004 return Match(true, new Value<string>("bool"));
8005 }
8006 break;
8007 }
8008 case SBYTE:
8009 {
8010 ++lexer;
8011 {
8012 #if (DEBUG)
8013 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8014 #endif
8015 return Match(true, new Value<string>("sbyte"));
8016 }
8017 break;
8018 }
8019 case BYTE:
8020 {
8021 ++lexer;
8022 {
8023 #if (DEBUG)
8024 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8025 #endif
8026 return Match(true, new Value<string>("byte"));
8027 }
8028 break;
8029 }
8030 case SHORT:
8031 {
8032 ++lexer;
8033 {
8034 #if (DEBUG)
8035 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8036 #endif
8037 return Match(true, new Value<string>("short"));
8038 }
8039 break;
8040 }
8041 case USHORT:
8042 {
8043 ++lexer;
8044 {
8045 #if (DEBUG)
8046 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8047 #endif
8048 return Match(true, new Value<string>("ushort"));
8049 }
8050 break;
8051 }
8052 case INT:
8053 {
8054 ++lexer;
8055 {
8056 #if (DEBUG)
8057 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8058 #endif
8059 return Match(true, new Value<string>("int"));
8060 }
8061 break;
8062 }
8063 case UINT:
8064 {
8065 ++lexer;
8066 {
8067 #if (DEBUG)
8068 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8069 #endif
8070 return Match(true, new Value<string>("uint"));
8071 }
8072 break;
8073 }
8074 case LONG:
8075 {
8076 ++lexer;
8077 {
8078 #if (DEBUG)
8079 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8080 #endif
8081 return Match(true, new Value<string>("long"));
8082 }
8083 break;
8084 }
8085 case ULONG:
8086 {
8087 ++lexer;
8088 {
8089 #if (DEBUG)
8090 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8091 #endif
8092 return Match(true, new Value<string>("ulong"));
8093 }
8094 break;
8095 }
8096 case FLOAT:
8097 {
8098 ++lexer;
8099 {
8100 #if (DEBUG)
8101 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8102 #endif
8103 return Match(true, new Value<string>("float"));
8104 }
8105 break;
8106 }
8107 case DOUBLE:
8108 {
8109 ++lexer;
8110 {
8111 #if (DEBUG)
8112 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8113 #endif
8114 return Match(true, new Value<string>("double"));
8115 }
8116 break;
8117 }
8118 }
8119 #if (DEBUG)
8120 if (writeToLog)
8121 {
8122 if (match.hit)
8123 {
8124 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PrimitiveTypeName");
8125 }
8126 else
8127 {
8128 System.Lex.WriteFailureToLog(lexer, u"PrimitiveTypeName");
8129 }
8130 }
8131 #endif
8132 if (!match.hit)
8133 {
8134 match.value = null;
8135 }
8136 return match;
8137 }
8138 public static Match TypedValue(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Type* type)
8139 {
8140 #if (DEBUG)
8141 Span debugSpan;
8142 bool writeToLog = lexer.Log() != null;
8143 if (writeToLog)
8144 {
8145 debugSpan = lexer.GetSpan();
8146 System.Lex.WriteBeginRuleToLog(lexer, u"TypedValue");
8147 }
8148 #endif
8149 UniquePtr<cmsx.intermediate.Value> idValue;
8150 UniquePtr<cmsx.intermediate.ConstantValue> symbolValue;
8151 UniquePtr<cmsx.intermediate.ConstantValue> literalValue;
8152 Match match(false);
8153 Match* parentMatch0 = &match;
8154 {
8155 long save = lexer.GetPos();
8156 Match match(false);
8157 Match* parentMatch1 = &match;
8158 {
8159 long save = lexer.GetPos();
8160 Match match(false);
8161 Match* parentMatch2 = &match;
8162 {
8163 long pos = lexer.GetPos();
8164 Match match = IntermediateCodeFileParser.IdValue(lexer, context, type);
8165 idValue.Reset(cast<cmsx.intermediate.Value*>(match.value));
8166 if (match.hit)
8167 {
8168 {
8169 #if (DEBUG)
8170 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TypedValue");
8171 #endif
8172 return Match(true, idValue.Release());
8173 }
8174 }
8175 *parentMatch2 = match;
8176 }
8177 *parentMatch1 = match;
8178 if (!match.hit)
8179 {
8180 Match match(false);
8181 Match* parentMatch3 = &match;
8182 lexer.SetPos(save);
8183 {
8184 Match match(false);
8185 Match* parentMatch4 = &match;
8186 {
8187 long pos = lexer.GetPos();
8188 Match match = IntermediateCodeFileParser.SymbolValue(lexer, context, type);
8189 symbolValue.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8190 if (match.hit)
8191 {
8192 {
8193 #if (DEBUG)
8194 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TypedValue");
8195 #endif
8196 return Match(true, symbolValue.Release());
8197 }
8198 }
8199 *parentMatch4 = match;
8200 }
8201 *parentMatch3 = match;
8202 }
8203 *parentMatch1 = match;
8204 }
8205 }
8206 *parentMatch0 = match;
8207 if (!match.hit)
8208 {
8209 Match match(false);
8210 Match* parentMatch5 = &match;
8211 lexer.SetPos(save);
8212 {
8213 Match match(false);
8214 Match* parentMatch6 = &match;
8215 {
8216 long pos = lexer.GetPos();
8217 Match match = IntermediateCodeFileParser.LiteralValue(lexer, context, type);
8218 literalValue.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8219 if (match.hit)
8220 {
8221 {
8222 #if (DEBUG)
8223 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TypedValue");
8224 #endif
8225 return Match(true, literalValue.Release());
8226 }
8227 }
8228 *parentMatch6 = match;
8229 }
8230 *parentMatch5 = match;
8231 }
8232 *parentMatch0 = match;
8233 }
8234 }
8235 #if (DEBUG)
8236 if (writeToLog)
8237 {
8238 if (match.hit)
8239 {
8240 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"TypedValue");
8241 }
8242 else
8243 {
8244 System.Lex.WriteFailureToLog(lexer, u"TypedValue");
8245 }
8246 }
8247 #endif
8248 if (!match.hit)
8249 {
8250 match.value = null;
8251 }
8252 return match;
8253 }
8254 public static Match IdValue(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Type* type)
8255 {
8256 #if (DEBUG)
8257 Span debugSpan;
8258 bool writeToLog = lexer.Log() != null;
8259 if (writeToLog)
8260 {
8261 debugSpan = lexer.GetSpan();
8262 System.Lex.WriteBeginRuleToLog(lexer, u"IdValue");
8263 }
8264 #endif
8265 Match match(false);
8266 Match* parentMatch0 = &match;
8267 {
8268 Match match(false);
8269 if (*lexer == DOLLAR)
8270 {
8271 ++lexer;
8272 match.hit = true;
8273 }
8274 *parentMatch0 = match;
8275 }
8276 if (match.hit)
8277 {
8278 Match match(false);
8279 Match* parentMatch1 = &match;
8280 {
8281 Match match(false);
8282 Match* parentMatch2 = &match;
8283 {
8284 long pos = lexer.GetPos();
8285 Span span = lexer.GetSpan();
8286 Match match(false);
8287 if (*lexer == NUMBER)
8288 {
8289 ++lexer;
8290 match.hit = true;
8291 }
8292 if (match.hit)
8293 {
8294 uint x = ParseUInt(ToUtf8(lexer.GetToken(pos).match.ToString()));
8295 {
8296 #if (DEBUG)
8297 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"IdValue");
8298 #endif
8299 return Match(true, context->currentFunction->MakeIdValue(span.line, x, type));
8300 }
8301 }
8302 *parentMatch2 = match;
8303 }
8304 *parentMatch1 = match;
8305 }
8306 *parentMatch0 = match;
8307 }
8308 #if (DEBUG)
8309 if (writeToLog)
8310 {
8311 if (match.hit)
8312 {
8313 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"IdValue");
8314 }
8315 else
8316 {
8317 System.Lex.WriteFailureToLog(lexer, u"IdValue");
8318 }
8319 }
8320 #endif
8321 if (!match.hit)
8322 {
8323 match.value = null;
8324 }
8325 return match;
8326 }
8327 public static Match SymbolValue(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Type* type)
8328 {
8329 #if (DEBUG)
8330 Span debugSpan;
8331 bool writeToLog = lexer.Log() != null;
8332 if (writeToLog)
8333 {
8334 debugSpan = lexer.GetSpan();
8335 System.Lex.WriteBeginRuleToLog(lexer, u"SymbolValue");
8336 }
8337 #endif
8338 Match match(false);
8339 Match* parentMatch0 = &match;
8340 {
8341 Match match(false);
8342 if (*lexer == AT)
8343 {
8344 ++lexer;
8345 match.hit = true;
8346 }
8347 *parentMatch0 = match;
8348 }
8349 if (match.hit)
8350 {
8351 Match match(false);
8352 Match* parentMatch1 = &match;
8353 {
8354 Match match(false);
8355 Match* parentMatch2 = &match;
8356 {
8357 long pos = lexer.GetPos();
8358 Span span = lexer.GetSpan();
8359 Match match(false);
8360 if (*lexer == ID)
8361 {
8362 ++lexer;
8363 match.hit = true;
8364 }
8365 if (match.hit)
8366 {
8367 {
8368 #if (DEBUG)
8369 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"SymbolValue");
8370 #endif
8371 return Match(true, context->MakeSymbolValue(span.line, ToUtf8(lexer.GetToken(pos).match.ToString()), type));
8372 }
8373 }
8374 *parentMatch2 = match;
8375 }
8376 *parentMatch1 = match;
8377 }
8378 *parentMatch0 = match;
8379 }
8380 #if (DEBUG)
8381 if (writeToLog)
8382 {
8383 if (match.hit)
8384 {
8385 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"SymbolValue");
8386 }
8387 else
8388 {
8389 System.Lex.WriteFailureToLog(lexer, u"SymbolValue");
8390 }
8391 }
8392 #endif
8393 if (!match.hit)
8394 {
8395 match.value = null;
8396 }
8397 return match;
8398 }
8399 public static Match LiteralValue(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.Type* type)
8400 {
8401 #if (DEBUG)
8402 Span debugSpan;
8403 bool writeToLog = lexer.Log() != null;
8404 if (writeToLog)
8405 {
8406 debugSpan = lexer.GetSpan();
8407 System.Lex.WriteBeginRuleToLog(lexer, u"LiteralValue");
8408 }
8409 #endif
8410 Match match(false);
8411 long pos = lexer.GetPos();
8412 Span span = lexer.GetSpan();
8413 switch (*lexer)
8414 {
8415 case TRUE:
8416 {
8417 ++lexer;
8418 if (type is cmsx.intermediate.BoolType*)
8419 {
8420 #if (DEBUG)
8421 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LiteralValue");
8422 #endif
8423 return Match(true, context->GetBoolType()->MakeBoolValue(true));
8424 }
8425 else context->MakeLiteralValue(span.line, ToUtf8(lexer.GetToken(pos).match.ToString()), type);
8426 break;
8427 }
8428 case FALSE:
8429 {
8430 ++lexer;
8431 if (type is cmsx.intermediate.BoolType*)
8432 {
8433 #if (DEBUG)
8434 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LiteralValue");
8435 #endif
8436 return Match(true, context->GetBoolType()->MakeBoolValue(false));
8437 }
8438 else context->MakeLiteralValue(span.line, ToUtf8(lexer.GetToken(pos).match.ToString()), type);
8439 break;
8440 }
8441 case NULL:
8442 {
8443 ++lexer;
8444 if (type is cmsx.intermediate.PtrType*)
8445 {
8446 #if (DEBUG)
8447 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LiteralValue");
8448 #endif
8449 return Match(true, type->DefaultValue());
8450 }
8451 else context->MakeLiteralValue(span.line, ToUtf8(lexer.GetToken(pos).match.ToString()), type);
8452 break;
8453 }
8454 case NUMBER:
8455 {
8456 ++lexer;
8457 {
8458 #if (DEBUG)
8459 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LiteralValue");
8460 #endif
8461 return Match(true, context->MakeLiteralValue(span.line, ToUtf8(lexer.GetToken(pos).match.ToString()), type));
8462 }
8463 break;
8464 }
8465 case ID:
8466 {
8467 ++lexer;
8468 {
8469 #if (DEBUG)
8470 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LiteralValue");
8471 #endif
8472 return Match(true, context->MakeLiteralValue(span.line, ToUtf8(lexer.GetToken(pos).match.ToString()), type));
8473 }
8474 break;
8475 }
8476 }
8477 #if (DEBUG)
8478 if (writeToLog)
8479 {
8480 if (match.hit)
8481 {
8482 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LiteralValue");
8483 }
8484 else
8485 {
8486 System.Lex.WriteFailureToLog(lexer, u"LiteralValue");
8487 }
8488 }
8489 #endif
8490 if (!match.hit)
8491 {
8492 match.value = null;
8493 }
8494 return match;
8495 }
8496 public static Match Constant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
8497 {
8498 #if (DEBUG)
8499 Span debugSpan;
8500 bool writeToLog = lexer.Log() != null;
8501 if (writeToLog)
8502 {
8503 debugSpan = lexer.GetSpan();
8504 System.Lex.WriteBeginRuleToLog(lexer, u"Constant");
8505 }
8506 #endif
8507 UniquePtr<cmsx.intermediate.ConstantValue> conversionConstant;
8508 UniquePtr<cmsx.intermediate.ConstantValue> clsIdConstant;
8509 UniquePtr<cmsx.intermediate.ConstantValue> ptrConstant;
8510 UniquePtr<cmsx.intermediate.ConstantValue> symbolConstant;
8511 UniquePtr<cmsx.intermediate.ConstantValue> boolConstant;
8512 UniquePtr<cmsx.intermediate.ConstantValue> sbyteConstant;
8513 UniquePtr<cmsx.intermediate.ConstantValue> byteConstant;
8514 UniquePtr<cmsx.intermediate.ConstantValue> shortConstant;
8515 UniquePtr<cmsx.intermediate.ConstantValue> ushortConstant;
8516 UniquePtr<cmsx.intermediate.ConstantValue> intConstant;
8517 UniquePtr<cmsx.intermediate.ConstantValue> uintConstant;
8518 UniquePtr<cmsx.intermediate.ConstantValue> longConstant;
8519 UniquePtr<cmsx.intermediate.ConstantValue> ulongConstant;
8520 UniquePtr<cmsx.intermediate.ConstantValue> floatConstant;
8521 UniquePtr<cmsx.intermediate.ConstantValue> doubleConstant;
8522 UniquePtr<cmsx.intermediate.ArrayValue> arrayConstant;
8523 UniquePtr<cmsx.intermediate.StructureValue> structureConstant;
8524 UniquePtr<cmsx.intermediate.StringValue> stringConstant;
8525 UniquePtr<cmsx.intermediate.StringArrayValue> stringArrayConstant;
8526 Match match(false);
8527 Match* parentMatch0 = &match;
8528 {
8529 long save = lexer.GetPos();
8530 Match match(false);
8531 Match* parentMatch1 = &match;
8532 {
8533 long save = lexer.GetPos();
8534 Match match(false);
8535 Match* parentMatch2 = &match;
8536 {
8537 long save = lexer.GetPos();
8538 Match match(false);
8539 Match* parentMatch3 = &match;
8540 {
8541 long save = lexer.GetPos();
8542 Match match(false);
8543 Match* parentMatch4 = &match;
8544 {
8545 long save = lexer.GetPos();
8546 Match match(false);
8547 Match* parentMatch5 = &match;
8548 {
8549 long save = lexer.GetPos();
8550 Match match(false);
8551 Match* parentMatch6 = &match;
8552 {
8553 long save = lexer.GetPos();
8554 Match match(false);
8555 Match* parentMatch7 = &match;
8556 {
8557 long save = lexer.GetPos();
8558 Match match(false);
8559 Match* parentMatch8 = &match;
8560 {
8561 long save = lexer.GetPos();
8562 Match match(false);
8563 Match* parentMatch9 = &match;
8564 {
8565 long save = lexer.GetPos();
8566 Match match(false);
8567 Match* parentMatch10 = &match;
8568 {
8569 long save = lexer.GetPos();
8570 Match match(false);
8571 Match* parentMatch11 = &match;
8572 {
8573 long save = lexer.GetPos();
8574 Match match(false);
8575 Match* parentMatch12 = &match;
8576 {
8577 long save = lexer.GetPos();
8578 Match match(false);
8579 Match* parentMatch13 = &match;
8580 {
8581 long save = lexer.GetPos();
8582 Match match(false);
8583 Match* parentMatch14 = &match;
8584 {
8585 long save = lexer.GetPos();
8586 Match match(false);
8587 Match* parentMatch15 = &match;
8588 {
8589 long save = lexer.GetPos();
8590 Match match(false);
8591 Match* parentMatch16 = &match;
8592 {
8593 long save = lexer.GetPos();
8594 Match match(false);
8595 Match* parentMatch17 = &match;
8596 {
8597 long save = lexer.GetPos();
8598 Match match(false);
8599 Match* parentMatch18 = &match;
8600 {
8601 long pos = lexer.GetPos();
8602 Match match = IntermediateCodeFileParser.ConversionConstant(lexer, context);
8603 conversionConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8604 if (match.hit)
8605 {
8606 {
8607 #if (DEBUG)
8608 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8609 #endif
8610 return Match(true, conversionConstant.Release());
8611 }
8612 }
8613 *parentMatch18 = match;
8614 }
8615 *parentMatch17 = match;
8616 if (!match.hit)
8617 {
8618 Match match(false);
8619 Match* parentMatch19 = &match;
8620 lexer.SetPos(save);
8621 {
8622 Match match(false);
8623 Match* parentMatch20 = &match;
8624 {
8625 long pos = lexer.GetPos();
8626 Match match = IntermediateCodeFileParser.ClsIdConstant(lexer, context);
8627 clsIdConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8628 if (match.hit)
8629 {
8630 {
8631 #if (DEBUG)
8632 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8633 #endif
8634 return Match(true, clsIdConstant.Release());
8635 }
8636 }
8637 *parentMatch20 = match;
8638 }
8639 *parentMatch19 = match;
8640 }
8641 *parentMatch17 = match;
8642 }
8643 }
8644 *parentMatch16 = match;
8645 if (!match.hit)
8646 {
8647 Match match(false);
8648 Match* parentMatch21 = &match;
8649 lexer.SetPos(save);
8650 {
8651 Match match(false);
8652 Match* parentMatch22 = &match;
8653 {
8654 long pos = lexer.GetPos();
8655 Match match = IntermediateCodeFileParser.PtrConstant(lexer, context);
8656 ptrConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8657 if (match.hit)
8658 {
8659 {
8660 #if (DEBUG)
8661 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8662 #endif
8663 return Match(true, ptrConstant.Release());
8664 }
8665 }
8666 *parentMatch22 = match;
8667 }
8668 *parentMatch21 = match;
8669 }
8670 *parentMatch16 = match;
8671 }
8672 }
8673 *parentMatch15 = match;
8674 if (!match.hit)
8675 {
8676 Match match(false);
8677 Match* parentMatch23 = &match;
8678 lexer.SetPos(save);
8679 {
8680 Match match(false);
8681 Match* parentMatch24 = &match;
8682 {
8683 long pos = lexer.GetPos();
8684 Match match = IntermediateCodeFileParser.SymbolConstant(lexer, context);
8685 symbolConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8686 if (match.hit)
8687 {
8688 {
8689 #if (DEBUG)
8690 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8691 #endif
8692 return Match(true, symbolConstant.Release());
8693 }
8694 }
8695 *parentMatch24 = match;
8696 }
8697 *parentMatch23 = match;
8698 }
8699 *parentMatch15 = match;
8700 }
8701 }
8702 *parentMatch14 = match;
8703 if (!match.hit)
8704 {
8705 Match match(false);
8706 Match* parentMatch25 = &match;
8707 lexer.SetPos(save);
8708 {
8709 Match match(false);
8710 Match* parentMatch26 = &match;
8711 {
8712 long pos = lexer.GetPos();
8713 Match match = IntermediateCodeFileParser.BoolConstant(lexer, context);
8714 boolConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8715 if (match.hit)
8716 {
8717 {
8718 #if (DEBUG)
8719 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8720 #endif
8721 return Match(true, boolConstant.Release());
8722 }
8723 }
8724 *parentMatch26 = match;
8725 }
8726 *parentMatch25 = match;
8727 }
8728 *parentMatch14 = match;
8729 }
8730 }
8731 *parentMatch13 = match;
8732 if (!match.hit)
8733 {
8734 Match match(false);
8735 Match* parentMatch27 = &match;
8736 lexer.SetPos(save);
8737 {
8738 Match match(false);
8739 Match* parentMatch28 = &match;
8740 {
8741 long pos = lexer.GetPos();
8742 Match match = IntermediateCodeFileParser.SByteConstant(lexer, context);
8743 sbyteConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8744 if (match.hit)
8745 {
8746 {
8747 #if (DEBUG)
8748 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8749 #endif
8750 return Match(true, sbyteConstant.Release());
8751 }
8752 }
8753 *parentMatch28 = match;
8754 }
8755 *parentMatch27 = match;
8756 }
8757 *parentMatch13 = match;
8758 }
8759 }
8760 *parentMatch12 = match;
8761 if (!match.hit)
8762 {
8763 Match match(false);
8764 Match* parentMatch29 = &match;
8765 lexer.SetPos(save);
8766 {
8767 Match match(false);
8768 Match* parentMatch30 = &match;
8769 {
8770 long pos = lexer.GetPos();
8771 Match match = IntermediateCodeFileParser.ByteConstant(lexer, context);
8772 byteConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8773 if (match.hit)
8774 {
8775 {
8776 #if (DEBUG)
8777 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8778 #endif
8779 return Match(true, byteConstant.Release());
8780 }
8781 }
8782 *parentMatch30 = match;
8783 }
8784 *parentMatch29 = match;
8785 }
8786 *parentMatch12 = match;
8787 }
8788 }
8789 *parentMatch11 = match;
8790 if (!match.hit)
8791 {
8792 Match match(false);
8793 Match* parentMatch31 = &match;
8794 lexer.SetPos(save);
8795 {
8796 Match match(false);
8797 Match* parentMatch32 = &match;
8798 {
8799 long pos = lexer.GetPos();
8800 Match match = IntermediateCodeFileParser.ShortConstant(lexer, context);
8801 shortConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8802 if (match.hit)
8803 {
8804 {
8805 #if (DEBUG)
8806 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8807 #endif
8808 return Match(true, shortConstant.Release());
8809 }
8810 }
8811 *parentMatch32 = match;
8812 }
8813 *parentMatch31 = match;
8814 }
8815 *parentMatch11 = match;
8816 }
8817 }
8818 *parentMatch10 = match;
8819 if (!match.hit)
8820 {
8821 Match match(false);
8822 Match* parentMatch33 = &match;
8823 lexer.SetPos(save);
8824 {
8825 Match match(false);
8826 Match* parentMatch34 = &match;
8827 {
8828 long pos = lexer.GetPos();
8829 Match match = IntermediateCodeFileParser.UShortConstant(lexer, context);
8830 ushortConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8831 if (match.hit)
8832 {
8833 {
8834 #if (DEBUG)
8835 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8836 #endif
8837 return Match(true, ushortConstant.Release());
8838 }
8839 }
8840 *parentMatch34 = match;
8841 }
8842 *parentMatch33 = match;
8843 }
8844 *parentMatch10 = match;
8845 }
8846 }
8847 *parentMatch9 = match;
8848 if (!match.hit)
8849 {
8850 Match match(false);
8851 Match* parentMatch35 = &match;
8852 lexer.SetPos(save);
8853 {
8854 Match match(false);
8855 Match* parentMatch36 = &match;
8856 {
8857 long pos = lexer.GetPos();
8858 Match match = IntermediateCodeFileParser.IntConstant(lexer, context);
8859 intConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8860 if (match.hit)
8861 {
8862 {
8863 #if (DEBUG)
8864 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8865 #endif
8866 return Match(true, intConstant.Release());
8867 }
8868 }
8869 *parentMatch36 = match;
8870 }
8871 *parentMatch35 = match;
8872 }
8873 *parentMatch9 = match;
8874 }
8875 }
8876 *parentMatch8 = match;
8877 if (!match.hit)
8878 {
8879 Match match(false);
8880 Match* parentMatch37 = &match;
8881 lexer.SetPos(save);
8882 {
8883 Match match(false);
8884 Match* parentMatch38 = &match;
8885 {
8886 long pos = lexer.GetPos();
8887 Match match = IntermediateCodeFileParser.UIntConstant(lexer, context);
8888 uintConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8889 if (match.hit)
8890 {
8891 {
8892 #if (DEBUG)
8893 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8894 #endif
8895 return Match(true, uintConstant.Release());
8896 }
8897 }
8898 *parentMatch38 = match;
8899 }
8900 *parentMatch37 = match;
8901 }
8902 *parentMatch8 = match;
8903 }
8904 }
8905 *parentMatch7 = match;
8906 if (!match.hit)
8907 {
8908 Match match(false);
8909 Match* parentMatch39 = &match;
8910 lexer.SetPos(save);
8911 {
8912 Match match(false);
8913 Match* parentMatch40 = &match;
8914 {
8915 long pos = lexer.GetPos();
8916 Match match = IntermediateCodeFileParser.LongConstant(lexer, context);
8917 longConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8918 if (match.hit)
8919 {
8920 {
8921 #if (DEBUG)
8922 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8923 #endif
8924 return Match(true, longConstant.Release());
8925 }
8926 }
8927 *parentMatch40 = match;
8928 }
8929 *parentMatch39 = match;
8930 }
8931 *parentMatch7 = match;
8932 }
8933 }
8934 *parentMatch6 = match;
8935 if (!match.hit)
8936 {
8937 Match match(false);
8938 Match* parentMatch41 = &match;
8939 lexer.SetPos(save);
8940 {
8941 Match match(false);
8942 Match* parentMatch42 = &match;
8943 {
8944 long pos = lexer.GetPos();
8945 Match match = IntermediateCodeFileParser.ULongConstant(lexer, context);
8946 ulongConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8947 if (match.hit)
8948 {
8949 {
8950 #if (DEBUG)
8951 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8952 #endif
8953 return Match(true, ulongConstant.Release());
8954 }
8955 }
8956 *parentMatch42 = match;
8957 }
8958 *parentMatch41 = match;
8959 }
8960 *parentMatch6 = match;
8961 }
8962 }
8963 *parentMatch5 = match;
8964 if (!match.hit)
8965 {
8966 Match match(false);
8967 Match* parentMatch43 = &match;
8968 lexer.SetPos(save);
8969 {
8970 Match match(false);
8971 Match* parentMatch44 = &match;
8972 {
8973 long pos = lexer.GetPos();
8974 Match match = IntermediateCodeFileParser.FloatConstant(lexer, context);
8975 floatConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
8976 if (match.hit)
8977 {
8978 {
8979 #if (DEBUG)
8980 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
8981 #endif
8982 return Match(true, floatConstant.Release());
8983 }
8984 }
8985 *parentMatch44 = match;
8986 }
8987 *parentMatch43 = match;
8988 }
8989 *parentMatch5 = match;
8990 }
8991 }
8992 *parentMatch4 = match;
8993 if (!match.hit)
8994 {
8995 Match match(false);
8996 Match* parentMatch45 = &match;
8997 lexer.SetPos(save);
8998 {
8999 Match match(false);
9000 Match* parentMatch46 = &match;
9001 {
9002 long pos = lexer.GetPos();
9003 Match match = IntermediateCodeFileParser.DoubleConstant(lexer, context);
9004 doubleConstant.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
9005 if (match.hit)
9006 {
9007 {
9008 #if (DEBUG)
9009 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
9010 #endif
9011 return Match(true, doubleConstant.Release());
9012 }
9013 }
9014 *parentMatch46 = match;
9015 }
9016 *parentMatch45 = match;
9017 }
9018 *parentMatch4 = match;
9019 }
9020 }
9021 *parentMatch3 = match;
9022 if (!match.hit)
9023 {
9024 Match match(false);
9025 Match* parentMatch47 = &match;
9026 lexer.SetPos(save);
9027 {
9028 Match match(false);
9029 Match* parentMatch48 = &match;
9030 {
9031 long pos = lexer.GetPos();
9032 Match match = IntermediateCodeFileParser.ArrayConstant(lexer, context);
9033 arrayConstant.Reset(cast<cmsx.intermediate.ArrayValue*>(match.value));
9034 if (match.hit)
9035 {
9036 {
9037 #if (DEBUG)
9038 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
9039 #endif
9040 return Match(true, arrayConstant.Release());
9041 }
9042 }
9043 *parentMatch48 = match;
9044 }
9045 *parentMatch47 = match;
9046 }
9047 *parentMatch3 = match;
9048 }
9049 }
9050 *parentMatch2 = match;
9051 if (!match.hit)
9052 {
9053 Match match(false);
9054 Match* parentMatch49 = &match;
9055 lexer.SetPos(save);
9056 {
9057 Match match(false);
9058 Match* parentMatch50 = &match;
9059 {
9060 long pos = lexer.GetPos();
9061 Match match = IntermediateCodeFileParser.StructureConstant(lexer, context);
9062 structureConstant.Reset(cast<cmsx.intermediate.StructureValue*>(match.value));
9063 if (match.hit)
9064 {
9065 {
9066 #if (DEBUG)
9067 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
9068 #endif
9069 return Match(true, structureConstant.Release());
9070 }
9071 }
9072 *parentMatch50 = match;
9073 }
9074 *parentMatch49 = match;
9075 }
9076 *parentMatch2 = match;
9077 }
9078 }
9079 *parentMatch1 = match;
9080 if (!match.hit)
9081 {
9082 Match match(false);
9083 Match* parentMatch51 = &match;
9084 lexer.SetPos(save);
9085 {
9086 Match match(false);
9087 Match* parentMatch52 = &match;
9088 {
9089 long pos = lexer.GetPos();
9090 Match match = IntermediateCodeFileParser.StringConstant(lexer, context);
9091 stringConstant.Reset(cast<cmsx.intermediate.StringValue*>(match.value));
9092 if (match.hit)
9093 {
9094 {
9095 #if (DEBUG)
9096 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
9097 #endif
9098 return Match(true, stringConstant.Release());
9099 }
9100 }
9101 *parentMatch52 = match;
9102 }
9103 *parentMatch51 = match;
9104 }
9105 *parentMatch1 = match;
9106 }
9107 }
9108 *parentMatch0 = match;
9109 if (!match.hit)
9110 {
9111 Match match(false);
9112 Match* parentMatch53 = &match;
9113 lexer.SetPos(save);
9114 {
9115 Match match(false);
9116 Match* parentMatch54 = &match;
9117 {
9118 long pos = lexer.GetPos();
9119 Match match = IntermediateCodeFileParser.StringArrayConstant(lexer, context);
9120 stringArrayConstant.Reset(cast<cmsx.intermediate.StringArrayValue*>(match.value));
9121 if (match.hit)
9122 {
9123 {
9124 #if (DEBUG)
9125 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
9126 #endif
9127 return Match(true, stringArrayConstant.Release());
9128 }
9129 }
9130 *parentMatch54 = match;
9131 }
9132 *parentMatch53 = match;
9133 }
9134 *parentMatch0 = match;
9135 }
9136 }
9137 #if (DEBUG)
9138 if (writeToLog)
9139 {
9140 if (match.hit)
9141 {
9142 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Constant");
9143 }
9144 else
9145 {
9146 System.Lex.WriteFailureToLog(lexer, u"Constant");
9147 }
9148 }
9149 #endif
9150 if (!match.hit)
9151 {
9152 match.value = null;
9153 }
9154 return match;
9155 }
9156 public static Match ConversionConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
9157 {
9158 #if (DEBUG)
9159 Span debugSpan;
9160 bool writeToLog = lexer.Log() != null;
9161 if (writeToLog)
9162 {
9163 debugSpan = lexer.GetSpan();
9164 System.Lex.WriteBeginRuleToLog(lexer, u"ConversionConstant");
9165 }
9166 #endif
9167 cmsx.intermediate.Type* targetType;
9168 UniquePtr<cmsx.intermediate.Type> t;
9169 UniquePtr<cmsx.intermediate.ConstantValue> from;
9170 Match match(false);
9171 Match* parentMatch0 = &match;
9172 {
9173 long pos = lexer.GetPos();
9174 Span span = lexer.GetSpan();
9175 Match match(false);
9176 Match* parentMatch1 = &match;
9177 {
9178 Match match(false);
9179 Match* parentMatch2 = &match;
9180 {
9181 Match match(false);
9182 Match* parentMatch3 = &match;
9183 {
9184 Match match(false);
9185 Match* parentMatch4 = &match;
9186 {
9187 Match match(false);
9188 Match* parentMatch5 = &match;
9189 {
9190 Match match(false);
9191 Match* parentMatch6 = &match;
9192 {
9193 long pos = lexer.GetPos();
9194 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
9195 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
9196 if (match.hit)
9197 {
9198 targetType = t.Release();
9199 }
9200 *parentMatch6 = match;
9201 }
9202 *parentMatch5 = match;
9203 }
9204 if (match.hit)
9205 {
9206 Match match(false);
9207 Match* parentMatch7 = &match;
9208 {
9209 Match match(false);
9210 if (*lexer == CONV)
9211 {
9212 ++lexer;
9213 match.hit = true;
9214 }
9215 *parentMatch7 = match;
9216 }
9217 *parentMatch5 = match;
9218 }
9219 *parentMatch4 = match;
9220 }
9221 if (match.hit)
9222 {
9223 Match match(false);
9224 Match* parentMatch8 = &match;
9225 {
9226 Match match(true);
9227 Match* parentMatch9 = &match;
9228 {
9229 System.Lex.Span span = lexer.GetSpan();
9230 Match match(false);
9231 if (*lexer == LPAREN)
9232 {
9233 ++lexer;
9234 match.hit = true;
9235 }
9236 if (match.hit)
9237 {
9238 *parentMatch9 = match;
9239 }
9240 else
9241 {
9242 lexer.ThrowExpectationFailure(span, GetTokenName(LPAREN));
9243 }
9244 }
9245 *parentMatch8 = match;
9246 }
9247 *parentMatch4 = match;
9248 }
9249 *parentMatch3 = match;
9250 }
9251 if (match.hit)
9252 {
9253 Match match(false);
9254 Match* parentMatch10 = &match;
9255 {
9256 Match match(true);
9257 Match* parentMatch11 = &match;
9258 {
9259 System.Lex.Span span = lexer.GetSpan();
9260 Match match = IntermediateCodeFileParser.Constant(lexer, context);
9261 from.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
9262 if (match.hit)
9263 {
9264 *parentMatch11 = match;
9265 }
9266 else
9267 {
9268 lexer.ThrowExpectationFailure(span, u"Constant");
9269 }
9270 }
9271 *parentMatch10 = match;
9272 }
9273 *parentMatch3 = match;
9274 }
9275 *parentMatch2 = match;
9276 }
9277 if (match.hit)
9278 {
9279 Match match(false);
9280 Match* parentMatch12 = &match;
9281 {
9282 Match match(true);
9283 Match* parentMatch13 = &match;
9284 {
9285 System.Lex.Span span = lexer.GetSpan();
9286 Match match(false);
9287 if (*lexer == RPAREN)
9288 {
9289 ++lexer;
9290 match.hit = true;
9291 }
9292 if (match.hit)
9293 {
9294 *parentMatch13 = match;
9295 }
9296 else
9297 {
9298 lexer.ThrowExpectationFailure(span, GetTokenName(RPAREN));
9299 }
9300 }
9301 *parentMatch12 = match;
9302 }
9303 *parentMatch2 = match;
9304 }
9305 *parentMatch1 = match;
9306 }
9307 if (match.hit)
9308 {
9309 {
9310 #if (DEBUG)
9311 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ConversionConstant");
9312 #endif
9313 return Match(true, context->MakeConversionValue(targetType, from.Release(), span.line));
9314 }
9315 }
9316 *parentMatch0 = match;
9317 }
9318 #if (DEBUG)
9319 if (writeToLog)
9320 {
9321 if (match.hit)
9322 {
9323 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ConversionConstant");
9324 }
9325 else
9326 {
9327 System.Lex.WriteFailureToLog(lexer, u"ConversionConstant");
9328 }
9329 }
9330 #endif
9331 if (!match.hit)
9332 {
9333 match.value = null;
9334 }
9335 return match;
9336 }
9337 public static Match ClsIdConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
9338 {
9339 #if (DEBUG)
9340 Span debugSpan;
9341 bool writeToLog = lexer.Log() != null;
9342 if (writeToLog)
9343 {
9344 debugSpan = lexer.GetSpan();
9345 System.Lex.WriteBeginRuleToLog(lexer, u"ClsIdConstant");
9346 }
9347 #endif
9348 cmsx.intermediate.Type* type;
9349 UniquePtr<cmsx.intermediate.Type> t;
9350 Match match(false);
9351 Match* parentMatch0 = &match;
9352 {
9353 Match match(false);
9354 Match* parentMatch1 = &match;
9355 {
9356 long pos = lexer.GetPos();
9357 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
9358 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
9359 if (match.hit)
9360 {
9361 type = t.Release();
9362 }
9363 *parentMatch1 = match;
9364 }
9365 *parentMatch0 = match;
9366 }
9367 if (match.hit)
9368 {
9369 Match match(false);
9370 Match* parentMatch2 = &match;
9371 {
9372 Match match(false);
9373 Match* parentMatch3 = &match;
9374 {
9375 long pos = lexer.GetPos();
9376 Span span = lexer.GetSpan();
9377 Match match(false);
9378 if (*lexer == CLSID)
9379 {
9380 ++lexer;
9381 match.hit = true;
9382 }
9383 if (match.hit)
9384 {
9385 {
9386 #if (DEBUG)
9387 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ClsIdConstant");
9388 #endif
9389 return Match(true, context->MakeClsIdValue(type, ToUtf8(lexer.GetToken(pos).match.ToString()), span.line));
9390 }
9391 }
9392 *parentMatch3 = match;
9393 }
9394 *parentMatch2 = match;
9395 }
9396 *parentMatch0 = match;
9397 }
9398 #if (DEBUG)
9399 if (writeToLog)
9400 {
9401 if (match.hit)
9402 {
9403 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ClsIdConstant");
9404 }
9405 else
9406 {
9407 System.Lex.WriteFailureToLog(lexer, u"ClsIdConstant");
9408 }
9409 }
9410 #endif
9411 if (!match.hit)
9412 {
9413 match.value = null;
9414 }
9415 return match;
9416 }
9417 public static Match PtrConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
9418 {
9419 #if (DEBUG)
9420 Span debugSpan;
9421 bool writeToLog = lexer.Log() != null;
9422 if (writeToLog)
9423 {
9424 debugSpan = lexer.GetSpan();
9425 System.Lex.WriteBeginRuleToLog(lexer, u"PtrConstant");
9426 }
9427 #endif
9428 cmsx.intermediate.Type* type;
9429 UniquePtr<cmsx.intermediate.Type> type1;
9430 UniquePtr<cmsx.intermediate.Type> type2;
9431 UniquePtr<cmsx.intermediate.ConstantValue> literalValue;
9432 Match match(false);
9433 Match* parentMatch0 = &match;
9434 {
9435 long save = lexer.GetPos();
9436 Match match(false);
9437 Match* parentMatch1 = &match;
9438 {
9439 long pos = lexer.GetPos();
9440 Match match(false);
9441 Match* parentMatch2 = &match;
9442 {
9443 Match match(false);
9444 Match* parentMatch3 = &match;
9445 {
9446 Match match(false);
9447 Match* parentMatch4 = &match;
9448 {
9449 long pos = lexer.GetPos();
9450 bool pass = true;
9451 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
9452 type1.Reset(cast<cmsx.intermediate.Type*>(match.value));
9453 if (match.hit)
9454 {
9455 type = type1.Release();
9456 pass = cmsx.intermediate.IsPtrType(type);
9457 }
9458 if (match.hit && !pass)
9459 {
9460 match = Match(false);
9461 }
9462 *parentMatch4 = match;
9463 }
9464 *parentMatch3 = match;
9465 }
9466 if (match.hit)
9467 {
9468 Match match(false);
9469 Match* parentMatch5 = &match;
9470 {
9471 Match match(false);
9472 if (*lexer == NULL)
9473 {
9474 ++lexer;
9475 match.hit = true;
9476 }
9477 *parentMatch5 = match;
9478 }
9479 *parentMatch3 = match;
9480 }
9481 *parentMatch2 = match;
9482 }
9483 if (match.hit)
9484 {
9485 {
9486 #if (DEBUG)
9487 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PtrConstant");
9488 #endif
9489 return Match(true, cast<cmsx.intermediate.PtrType*>(type)->DefaultValue());
9490 }
9491 }
9492 *parentMatch1 = match;
9493 }
9494 *parentMatch0 = match;
9495 if (!match.hit)
9496 {
9497 Match match(false);
9498 Match* parentMatch6 = &match;
9499 lexer.SetPos(save);
9500 {
9501 Match match(false);
9502 Match* parentMatch7 = &match;
9503 {
9504 long pos = lexer.GetPos();
9505 Match match(false);
9506 Match* parentMatch8 = &match;
9507 {
9508 Match match(false);
9509 Match* parentMatch9 = &match;
9510 {
9511 Match match(false);
9512 Match* parentMatch10 = &match;
9513 {
9514 long pos = lexer.GetPos();
9515 bool pass = true;
9516 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
9517 type2.Reset(cast<cmsx.intermediate.Type*>(match.value));
9518 if (match.hit)
9519 {
9520 type = type2.Release();
9521 pass = cmsx.intermediate.IsPtrType(type);
9522 }
9523 if (match.hit && !pass)
9524 {
9525 match = Match(false);
9526 }
9527 *parentMatch10 = match;
9528 }
9529 *parentMatch9 = match;
9530 }
9531 if (match.hit)
9532 {
9533 Match match(false);
9534 Match* parentMatch11 = &match;
9535 {
9536 Match match = IntermediateCodeFileParser.LiteralValue(lexer, context, type);
9537 literalValue.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
9538 *parentMatch11 = match;
9539 }
9540 *parentMatch9 = match;
9541 }
9542 *parentMatch8 = match;
9543 }
9544 if (match.hit)
9545 {
9546 {
9547 #if (DEBUG)
9548 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PtrConstant");
9549 #endif
9550 return Match(true, literalValue.Release());
9551 }
9552 }
9553 *parentMatch7 = match;
9554 }
9555 *parentMatch6 = match;
9556 }
9557 *parentMatch0 = match;
9558 }
9559 }
9560 #if (DEBUG)
9561 if (writeToLog)
9562 {
9563 if (match.hit)
9564 {
9565 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"PtrConstant");
9566 }
9567 else
9568 {
9569 System.Lex.WriteFailureToLog(lexer, u"PtrConstant");
9570 }
9571 }
9572 #endif
9573 if (!match.hit)
9574 {
9575 match.value = null;
9576 }
9577 return match;
9578 }
9579 public static Match SymbolConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
9580 {
9581 #if (DEBUG)
9582 Span debugSpan;
9583 bool writeToLog = lexer.Log() != null;
9584 if (writeToLog)
9585 {
9586 debugSpan = lexer.GetSpan();
9587 System.Lex.WriteBeginRuleToLog(lexer, u"SymbolConstant");
9588 }
9589 #endif
9590 cmsx.intermediate.Type* type;
9591 UniquePtr<cmsx.intermediate.Type> t;
9592 UniquePtr<cmsx.intermediate.ConstantValue> symbolValue;
9593 Match match(false);
9594 Match* parentMatch0 = &match;
9595 {
9596 Match match(false);
9597 Match* parentMatch1 = &match;
9598 {
9599 long pos = lexer.GetPos();
9600 Match match = IntermediateCodeFileParser.TypeExpr(lexer, context);
9601 t.Reset(cast<cmsx.intermediate.Type*>(match.value));
9602 if (match.hit)
9603 {
9604 type = t.Release();
9605 }
9606 *parentMatch1 = match;
9607 }
9608 *parentMatch0 = match;
9609 }
9610 if (match.hit)
9611 {
9612 Match match(false);
9613 Match* parentMatch2 = &match;
9614 {
9615 Match match(false);
9616 Match* parentMatch3 = &match;
9617 {
9618 long pos = lexer.GetPos();
9619 Match match = IntermediateCodeFileParser.SymbolValue(lexer, context, type);
9620 symbolValue.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
9621 if (match.hit)
9622 {
9623 {
9624 #if (DEBUG)
9625 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"SymbolConstant");
9626 #endif
9627 return Match(true, symbolValue.Release());
9628 }
9629 }
9630 *parentMatch3 = match;
9631 }
9632 *parentMatch2 = match;
9633 }
9634 *parentMatch0 = match;
9635 }
9636 #if (DEBUG)
9637 if (writeToLog)
9638 {
9639 if (match.hit)
9640 {
9641 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"SymbolConstant");
9642 }
9643 else
9644 {
9645 System.Lex.WriteFailureToLog(lexer, u"SymbolConstant");
9646 }
9647 }
9648 #endif
9649 if (!match.hit)
9650 {
9651 match.value = null;
9652 }
9653 return match;
9654 }
9655 public static Match BoolConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
9656 {
9657 #if (DEBUG)
9658 Span debugSpan;
9659 bool writeToLog = lexer.Log() != null;
9660 if (writeToLog)
9661 {
9662 debugSpan = lexer.GetSpan();
9663 System.Lex.WriteBeginRuleToLog(lexer, u"BoolConstant");
9664 }
9665 #endif
9666 Match match(false);
9667 Match* parentMatch0 = &match;
9668 {
9669 Match match(false);
9670 if (*lexer == BOOL)
9671 {
9672 ++lexer;
9673 match.hit = true;
9674 }
9675 *parentMatch0 = match;
9676 }
9677 if (match.hit)
9678 {
9679 Match match(false);
9680 Match* parentMatch1 = &match;
9681 {
9682 Match match(false);
9683 Match* parentMatch2 = &match;
9684 {
9685 long pos = lexer.GetPos();
9686 Span span = lexer.GetSpan();
9687 switch (*lexer)
9688 {
9689 case TRUE:
9690 {
9691 ++lexer;
9692 {
9693 #if (DEBUG)
9694 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BoolConstant");
9695 #endif
9696 return Match(true, context->GetBoolType()->MakeBoolValue(true));
9697 }
9698 break;
9699 }
9700 case FALSE:
9701 {
9702 ++lexer;
9703 {
9704 #if (DEBUG)
9705 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BoolConstant");
9706 #endif
9707 return Match(true, context->GetBoolType()->MakeBoolValue(false));
9708 }
9709 break;
9710 }
9711 }
9712 *parentMatch2 = match;
9713 }
9714 *parentMatch1 = match;
9715 }
9716 *parentMatch0 = match;
9717 }
9718 #if (DEBUG)
9719 if (writeToLog)
9720 {
9721 if (match.hit)
9722 {
9723 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"BoolConstant");
9724 }
9725 else
9726 {
9727 System.Lex.WriteFailureToLog(lexer, u"BoolConstant");
9728 }
9729 }
9730 #endif
9731 if (!match.hit)
9732 {
9733 match.value = null;
9734 }
9735 return match;
9736 }
9737 public static Match SByteConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
9738 {
9739 #if (DEBUG)
9740 Span debugSpan;
9741 bool writeToLog = lexer.Log() != null;
9742 if (writeToLog)
9743 {
9744 debugSpan = lexer.GetSpan();
9745 System.Lex.WriteBeginRuleToLog(lexer, u"SByteConstant");
9746 }
9747 #endif
9748 Match match(false);
9749 Match* parentMatch0 = &match;
9750 {
9751 Match match(false);
9752 if (*lexer == SBYTE)
9753 {
9754 ++lexer;
9755 match.hit = true;
9756 }
9757 *parentMatch0 = match;
9758 }
9759 if (match.hit)
9760 {
9761 Match match(false);
9762 Match* parentMatch1 = &match;
9763 {
9764 Match match(false);
9765 Match* parentMatch2 = &match;
9766 {
9767 long pos = lexer.GetPos();
9768 Match match(false);
9769 if (*lexer == NUMBER)
9770 {
9771 ++lexer;
9772 match.hit = true;
9773 }
9774 if (match.hit)
9775 {
9776 {
9777 #if (DEBUG)
9778 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"SByteConstant");
9779 #endif
9780 return Match(true, context->MakeSByteValue(context->GetSByteType(), ParseSByte(ToUtf8(lexer.GetToken(pos).match.ToString()))));
9781 }
9782 }
9783 *parentMatch2 = match;
9784 }
9785 *parentMatch1 = match;
9786 }
9787 *parentMatch0 = match;
9788 }
9789 #if (DEBUG)
9790 if (writeToLog)
9791 {
9792 if (match.hit)
9793 {
9794 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"SByteConstant");
9795 }
9796 else
9797 {
9798 System.Lex.WriteFailureToLog(lexer, u"SByteConstant");
9799 }
9800 }
9801 #endif
9802 if (!match.hit)
9803 {
9804 match.value = null;
9805 }
9806 return match;
9807 }
9808 public static Match ByteConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
9809 {
9810 #if (DEBUG)
9811 Span debugSpan;
9812 bool writeToLog = lexer.Log() != null;
9813 if (writeToLog)
9814 {
9815 debugSpan = lexer.GetSpan();
9816 System.Lex.WriteBeginRuleToLog(lexer, u"ByteConstant");
9817 }
9818 #endif
9819 Match match(false);
9820 Match* parentMatch0 = &match;
9821 {
9822 Match match(false);
9823 if (*lexer == BYTE)
9824 {
9825 ++lexer;
9826 match.hit = true;
9827 }
9828 *parentMatch0 = match;
9829 }
9830 if (match.hit)
9831 {
9832 Match match(false);
9833 Match* parentMatch1 = &match;
9834 {
9835 Match match(false);
9836 Match* parentMatch2 = &match;
9837 {
9838 long pos = lexer.GetPos();
9839 Match match(false);
9840 if (*lexer == NUMBER)
9841 {
9842 ++lexer;
9843 match.hit = true;
9844 }
9845 if (match.hit)
9846 {
9847 {
9848 #if (DEBUG)
9849 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ByteConstant");
9850 #endif
9851 return Match(true, context->MakeByteValue(context->GetByteType(), ParseByte(ToUtf8(lexer.GetToken(pos).match.ToString()))));
9852 }
9853 }
9854 *parentMatch2 = match;
9855 }
9856 *parentMatch1 = match;
9857 }
9858 *parentMatch0 = match;
9859 }
9860 #if (DEBUG)
9861 if (writeToLog)
9862 {
9863 if (match.hit)
9864 {
9865 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ByteConstant");
9866 }
9867 else
9868 {
9869 System.Lex.WriteFailureToLog(lexer, u"ByteConstant");
9870 }
9871 }
9872 #endif
9873 if (!match.hit)
9874 {
9875 match.value = null;
9876 }
9877 return match;
9878 }
9879 public static Match ShortConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
9880 {
9881 #if (DEBUG)
9882 Span debugSpan;
9883 bool writeToLog = lexer.Log() != null;
9884 if (writeToLog)
9885 {
9886 debugSpan = lexer.GetSpan();
9887 System.Lex.WriteBeginRuleToLog(lexer, u"ShortConstant");
9888 }
9889 #endif
9890 Match match(false);
9891 Match* parentMatch0 = &match;
9892 {
9893 Match match(false);
9894 if (*lexer == SHORT)
9895 {
9896 ++lexer;
9897 match.hit = true;
9898 }
9899 *parentMatch0 = match;
9900 }
9901 if (match.hit)
9902 {
9903 Match match(false);
9904 Match* parentMatch1 = &match;
9905 {
9906 Match match(false);
9907 Match* parentMatch2 = &match;
9908 {
9909 long pos = lexer.GetPos();
9910 Match match(false);
9911 if (*lexer == NUMBER)
9912 {
9913 ++lexer;
9914 match.hit = true;
9915 }
9916 if (match.hit)
9917 {
9918 {
9919 #if (DEBUG)
9920 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ShortConstant");
9921 #endif
9922 return Match(true, context->MakeShortValue(context->GetShortType(), ParseShort(ToUtf8(lexer.GetToken(pos).match.ToString()))));
9923 }
9924 }
9925 *parentMatch2 = match;
9926 }
9927 *parentMatch1 = match;
9928 }
9929 *parentMatch0 = match;
9930 }
9931 #if (DEBUG)
9932 if (writeToLog)
9933 {
9934 if (match.hit)
9935 {
9936 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ShortConstant");
9937 }
9938 else
9939 {
9940 System.Lex.WriteFailureToLog(lexer, u"ShortConstant");
9941 }
9942 }
9943 #endif
9944 if (!match.hit)
9945 {
9946 match.value = null;
9947 }
9948 return match;
9949 }
9950 public static Match UShortConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
9951 {
9952 #if (DEBUG)
9953 Span debugSpan;
9954 bool writeToLog = lexer.Log() != null;
9955 if (writeToLog)
9956 {
9957 debugSpan = lexer.GetSpan();
9958 System.Lex.WriteBeginRuleToLog(lexer, u"UShortConstant");
9959 }
9960 #endif
9961 Match match(false);
9962 Match* parentMatch0 = &match;
9963 {
9964 Match match(false);
9965 if (*lexer == USHORT)
9966 {
9967 ++lexer;
9968 match.hit = true;
9969 }
9970 *parentMatch0 = match;
9971 }
9972 if (match.hit)
9973 {
9974 Match match(false);
9975 Match* parentMatch1 = &match;
9976 {
9977 Match match(false);
9978 Match* parentMatch2 = &match;
9979 {
9980 long pos = lexer.GetPos();
9981 Match match(false);
9982 if (*lexer == NUMBER)
9983 {
9984 ++lexer;
9985 match.hit = true;
9986 }
9987 if (match.hit)
9988 {
9989 {
9990 #if (DEBUG)
9991 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UShortConstant");
9992 #endif
9993 return Match(true, context->MakeUShortValue(context->GetUShortType(), ParseUShort(ToUtf8(lexer.GetToken(pos).match.ToString()))));
9994 }
9995 }
9996 *parentMatch2 = match;
9997 }
9998 *parentMatch1 = match;
9999 }
10000 *parentMatch0 = match;
10001 }
10002 #if (DEBUG)
10003 if (writeToLog)
10004 {
10005 if (match.hit)
10006 {
10007 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UShortConstant");
10008 }
10009 else
10010 {
10011 System.Lex.WriteFailureToLog(lexer, u"UShortConstant");
10012 }
10013 }
10014 #endif
10015 if (!match.hit)
10016 {
10017 match.value = null;
10018 }
10019 return match;
10020 }
10021 public static Match IntConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
10022 {
10023 #if (DEBUG)
10024 Span debugSpan;
10025 bool writeToLog = lexer.Log() != null;
10026 if (writeToLog)
10027 {
10028 debugSpan = lexer.GetSpan();
10029 System.Lex.WriteBeginRuleToLog(lexer, u"IntConstant");
10030 }
10031 #endif
10032 Match match(false);
10033 Match* parentMatch0 = &match;
10034 {
10035 Match match(false);
10036 if (*lexer == INT)
10037 {
10038 ++lexer;
10039 match.hit = true;
10040 }
10041 *parentMatch0 = match;
10042 }
10043 if (match.hit)
10044 {
10045 Match match(false);
10046 Match* parentMatch1 = &match;
10047 {
10048 Match match(false);
10049 Match* parentMatch2 = &match;
10050 {
10051 long pos = lexer.GetPos();
10052 Match match(false);
10053 if (*lexer == NUMBER)
10054 {
10055 ++lexer;
10056 match.hit = true;
10057 }
10058 if (match.hit)
10059 {
10060 {
10061 #if (DEBUG)
10062 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"IntConstant");
10063 #endif
10064 return Match(true, context->MakeIntValue(context->GetIntType(), ParseInt(ToUtf8(lexer.GetToken(pos).match.ToString()))));
10065 }
10066 }
10067 *parentMatch2 = match;
10068 }
10069 *parentMatch1 = match;
10070 }
10071 *parentMatch0 = match;
10072 }
10073 #if (DEBUG)
10074 if (writeToLog)
10075 {
10076 if (match.hit)
10077 {
10078 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"IntConstant");
10079 }
10080 else
10081 {
10082 System.Lex.WriteFailureToLog(lexer, u"IntConstant");
10083 }
10084 }
10085 #endif
10086 if (!match.hit)
10087 {
10088 match.value = null;
10089 }
10090 return match;
10091 }
10092 public static Match UIntConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
10093 {
10094 #if (DEBUG)
10095 Span debugSpan;
10096 bool writeToLog = lexer.Log() != null;
10097 if (writeToLog)
10098 {
10099 debugSpan = lexer.GetSpan();
10100 System.Lex.WriteBeginRuleToLog(lexer, u"UIntConstant");
10101 }
10102 #endif
10103 Match match(false);
10104 Match* parentMatch0 = &match;
10105 {
10106 Match match(false);
10107 if (*lexer == UINT)
10108 {
10109 ++lexer;
10110 match.hit = true;
10111 }
10112 *parentMatch0 = match;
10113 }
10114 if (match.hit)
10115 {
10116 Match match(false);
10117 Match* parentMatch1 = &match;
10118 {
10119 Match match(false);
10120 Match* parentMatch2 = &match;
10121 {
10122 long pos = lexer.GetPos();
10123 Match match(false);
10124 if (*lexer == NUMBER)
10125 {
10126 ++lexer;
10127 match.hit = true;
10128 }
10129 if (match.hit)
10130 {
10131 {
10132 #if (DEBUG)
10133 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UIntConstant");
10134 #endif
10135 return Match(true, context->MakeUIntValue(context->GetUIntType(), ParseUInt(ToUtf8(lexer.GetToken(pos).match.ToString()))));
10136 }
10137 }
10138 *parentMatch2 = match;
10139 }
10140 *parentMatch1 = match;
10141 }
10142 *parentMatch0 = match;
10143 }
10144 #if (DEBUG)
10145 if (writeToLog)
10146 {
10147 if (match.hit)
10148 {
10149 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"UIntConstant");
10150 }
10151 else
10152 {
10153 System.Lex.WriteFailureToLog(lexer, u"UIntConstant");
10154 }
10155 }
10156 #endif
10157 if (!match.hit)
10158 {
10159 match.value = null;
10160 }
10161 return match;
10162 }
10163 public static Match LongConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
10164 {
10165 #if (DEBUG)
10166 Span debugSpan;
10167 bool writeToLog = lexer.Log() != null;
10168 if (writeToLog)
10169 {
10170 debugSpan = lexer.GetSpan();
10171 System.Lex.WriteBeginRuleToLog(lexer, u"LongConstant");
10172 }
10173 #endif
10174 Match match(false);
10175 Match* parentMatch0 = &match;
10176 {
10177 Match match(false);
10178 if (*lexer == LONG)
10179 {
10180 ++lexer;
10181 match.hit = true;
10182 }
10183 *parentMatch0 = match;
10184 }
10185 if (match.hit)
10186 {
10187 Match match(false);
10188 Match* parentMatch1 = &match;
10189 {
10190 Match match(false);
10191 Match* parentMatch2 = &match;
10192 {
10193 long pos = lexer.GetPos();
10194 Match match(false);
10195 if (*lexer == NUMBER)
10196 {
10197 ++lexer;
10198 match.hit = true;
10199 }
10200 if (match.hit)
10201 {
10202 {
10203 #if (DEBUG)
10204 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LongConstant");
10205 #endif
10206 return Match(true, context->MakeLongValue(context->GetLongType(), ParseLong(ToUtf8(lexer.GetToken(pos).match.ToString()))));
10207 }
10208 }
10209 *parentMatch2 = match;
10210 }
10211 *parentMatch1 = match;
10212 }
10213 *parentMatch0 = match;
10214 }
10215 #if (DEBUG)
10216 if (writeToLog)
10217 {
10218 if (match.hit)
10219 {
10220 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"LongConstant");
10221 }
10222 else
10223 {
10224 System.Lex.WriteFailureToLog(lexer, u"LongConstant");
10225 }
10226 }
10227 #endif
10228 if (!match.hit)
10229 {
10230 match.value = null;
10231 }
10232 return match;
10233 }
10234 public static Match ULongConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
10235 {
10236 #if (DEBUG)
10237 Span debugSpan;
10238 bool writeToLog = lexer.Log() != null;
10239 if (writeToLog)
10240 {
10241 debugSpan = lexer.GetSpan();
10242 System.Lex.WriteBeginRuleToLog(lexer, u"ULongConstant");
10243 }
10244 #endif
10245 Match match(false);
10246 Match* parentMatch0 = &match;
10247 {
10248 Match match(false);
10249 if (*lexer == ULONG)
10250 {
10251 ++lexer;
10252 match.hit = true;
10253 }
10254 *parentMatch0 = match;
10255 }
10256 if (match.hit)
10257 {
10258 Match match(false);
10259 Match* parentMatch1 = &match;
10260 {
10261 Match match(false);
10262 Match* parentMatch2 = &match;
10263 {
10264 long pos = lexer.GetPos();
10265 Match match(false);
10266 if (*lexer == NUMBER)
10267 {
10268 ++lexer;
10269 match.hit = true;
10270 }
10271 if (match.hit)
10272 {
10273 {
10274 #if (DEBUG)
10275 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ULongConstant");
10276 #endif
10277 return Match(true, context->MakeULongValue(context->GetULongType(), ParseULong(ToUtf8(lexer.GetToken(pos).match.ToString()))));
10278 }
10279 }
10280 *parentMatch2 = match;
10281 }
10282 *parentMatch1 = match;
10283 }
10284 *parentMatch0 = match;
10285 }
10286 #if (DEBUG)
10287 if (writeToLog)
10288 {
10289 if (match.hit)
10290 {
10291 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ULongConstant");
10292 }
10293 else
10294 {
10295 System.Lex.WriteFailureToLog(lexer, u"ULongConstant");
10296 }
10297 }
10298 #endif
10299 if (!match.hit)
10300 {
10301 match.value = null;
10302 }
10303 return match;
10304 }
10305 public static Match FloatConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
10306 {
10307 #if (DEBUG)
10308 Span debugSpan;
10309 bool writeToLog = lexer.Log() != null;
10310 if (writeToLog)
10311 {
10312 debugSpan = lexer.GetSpan();
10313 System.Lex.WriteBeginRuleToLog(lexer, u"FloatConstant");
10314 }
10315 #endif
10316 Match match(false);
10317 Match* parentMatch0 = &match;
10318 {
10319 Match match(false);
10320 if (*lexer == FLOAT)
10321 {
10322 ++lexer;
10323 match.hit = true;
10324 }
10325 *parentMatch0 = match;
10326 }
10327 if (match.hit)
10328 {
10329 Match match(false);
10330 Match* parentMatch1 = &match;
10331 {
10332 Match match(false);
10333 Match* parentMatch2 = &match;
10334 {
10335 long pos = lexer.GetPos();
10336 Match match(false);
10337 if (*lexer == NUMBER)
10338 {
10339 ++lexer;
10340 match.hit = true;
10341 }
10342 if (match.hit)
10343 {
10344 {
10345 #if (DEBUG)
10346 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FloatConstant");
10347 #endif
10348 return Match(true, context->MakeFloatValue(context->GetFloatType(), ParseFloat(ToUtf8(lexer.GetToken(pos).match.ToString()))));
10349 }
10350 }
10351 *parentMatch2 = match;
10352 }
10353 *parentMatch1 = match;
10354 }
10355 *parentMatch0 = match;
10356 }
10357 #if (DEBUG)
10358 if (writeToLog)
10359 {
10360 if (match.hit)
10361 {
10362 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"FloatConstant");
10363 }
10364 else
10365 {
10366 System.Lex.WriteFailureToLog(lexer, u"FloatConstant");
10367 }
10368 }
10369 #endif
10370 if (!match.hit)
10371 {
10372 match.value = null;
10373 }
10374 return match;
10375 }
10376 public static Match DoubleConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
10377 {
10378 #if (DEBUG)
10379 Span debugSpan;
10380 bool writeToLog = lexer.Log() != null;
10381 if (writeToLog)
10382 {
10383 debugSpan = lexer.GetSpan();
10384 System.Lex.WriteBeginRuleToLog(lexer, u"DoubleConstant");
10385 }
10386 #endif
10387 Match match(false);
10388 Match* parentMatch0 = &match;
10389 {
10390 Match match(false);
10391 if (*lexer == DOUBLE)
10392 {
10393 ++lexer;
10394 match.hit = true;
10395 }
10396 *parentMatch0 = match;
10397 }
10398 if (match.hit)
10399 {
10400 Match match(false);
10401 Match* parentMatch1 = &match;
10402 {
10403 Match match(false);
10404 Match* parentMatch2 = &match;
10405 {
10406 long pos = lexer.GetPos();
10407 Match match(false);
10408 if (*lexer == NUMBER)
10409 {
10410 ++lexer;
10411 match.hit = true;
10412 }
10413 if (match.hit)
10414 {
10415 {
10416 #if (DEBUG)
10417 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"DoubleConstant");
10418 #endif
10419 return Match(true, context->MakeDoubleValue(context->GetDoubleType(), ParseDouble(ToUtf8(lexer.GetToken(pos).match.ToString()))));
10420 }
10421 }
10422 *parentMatch2 = match;
10423 }
10424 *parentMatch1 = match;
10425 }
10426 *parentMatch0 = match;
10427 }
10428 #if (DEBUG)
10429 if (writeToLog)
10430 {
10431 if (match.hit)
10432 {
10433 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"DoubleConstant");
10434 }
10435 else
10436 {
10437 System.Lex.WriteFailureToLog(lexer, u"DoubleConstant");
10438 }
10439 }
10440 #endif
10441 if (!match.hit)
10442 {
10443 match.value = null;
10444 }
10445 return match;
10446 }
10447 public static Match ArrayConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
10448 {
10449 #if (DEBUG)
10450 Span debugSpan;
10451 bool writeToLog = lexer.Log() != null;
10452 if (writeToLog)
10453 {
10454 debugSpan = lexer.GetSpan();
10455 System.Lex.WriteBeginRuleToLog(lexer, u"ArrayConstant");
10456 }
10457 #endif
10458 cmsx.intermediate.ArrayValue* value;
10459 UniquePtr<cmsx.intermediate.ConstantValue> element;
10460 Match match(false);
10461 Match* parentMatch0 = &match;
10462 {
10463 long pos = lexer.GetPos();
10464 Match match(false);
10465 Match* parentMatch1 = &match;
10466 {
10467 Match match(false);
10468 Match* parentMatch2 = &match;
10469 {
10470 Match match(false);
10471 Match* parentMatch3 = &match;
10472 {
10473 Match match(false);
10474 Match* parentMatch4 = &match;
10475 {
10476 long pos = lexer.GetPos();
10477 Match match(false);
10478 if (*lexer == LBRACKET)
10479 {
10480 ++lexer;
10481 match.hit = true;
10482 }
10483 if (match.hit)
10484 {
10485 value = context->MakeArrayValue();
10486 }
10487 *parentMatch4 = match;
10488 }
10489 *parentMatch3 = match;
10490 }
10491 if (match.hit)
10492 {
10493 Match match(false);
10494 Match* parentMatch5 = &match;
10495 {
10496 Match match(true);
10497 long save = lexer.GetPos();
10498 Match* parentMatch6 = &match;
10499 {
10500 Match match(false);
10501 Match* parentMatch7 = &match;
10502 {
10503 Match match(false);
10504 Match* parentMatch8 = &match;
10505 {
10506 Match match(false);
10507 Match* parentMatch9 = &match;
10508 {
10509 long pos = lexer.GetPos();
10510 Match match = IntermediateCodeFileParser.Constant(lexer, context);
10511 element.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
10512 if (match.hit)
10513 {
10514 value->AddElement(element.Release());
10515 }
10516 *parentMatch9 = match;
10517 }
10518 *parentMatch8 = match;
10519 }
10520 if (match.hit)
10521 {
10522 Match match(false);
10523 Match* parentMatch10 = &match;
10524 {
10525 Match match(true);
10526 Match* parentMatch11 = &match;
10527 {
10528 while (true)
10529 {
10530 long save = lexer.GetPos();
10531 {
10532 Match match(false);
10533 Match* parentMatch12 = &match;
10534 {
10535 Match match(false);
10536 if (*lexer == COMMA)
10537 {
10538 ++lexer;
10539 match.hit = true;
10540 }
10541 *parentMatch12 = match;
10542 }
10543 if (match.hit)
10544 {
10545 Match match(false);
10546 Match* parentMatch13 = &match;
10547 {
10548 Match match(false);
10549 Match* parentMatch14 = &match;
10550 {
10551 long pos = lexer.GetPos();
10552 Match match = IntermediateCodeFileParser.Constant(lexer, context);
10553 element.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
10554 if (match.hit)
10555 {
10556 value->AddElement(element.Release());
10557 }
10558 *parentMatch14 = match;
10559 }
10560 *parentMatch13 = match;
10561 }
10562 *parentMatch12 = match;
10563 }
10564 if (match.hit)
10565 {
10566 *parentMatch11 = match;
10567 }
10568 else
10569 {
10570 lexer.SetPos(save);
10571 break;
10572 }
10573 }
10574 }
10575 }
10576 *parentMatch10 = match;
10577 }
10578 *parentMatch8 = match;
10579 }
10580 *parentMatch7 = match;
10581 }
10582 if (match.hit)
10583 {
10584 *parentMatch6 = match;
10585 }
10586 else
10587 {
10588 lexer.SetPos(save);
10589 }
10590 }
10591 *parentMatch5 = match;
10592 }
10593 *parentMatch3 = match;
10594 }
10595 *parentMatch2 = match;
10596 }
10597 if (match.hit)
10598 {
10599 Match match(false);
10600 Match* parentMatch15 = &match;
10601 {
10602 Match match(false);
10603 if (*lexer == RBRACKET)
10604 {
10605 ++lexer;
10606 match.hit = true;
10607 }
10608 *parentMatch15 = match;
10609 }
10610 *parentMatch2 = match;
10611 }
10612 *parentMatch1 = match;
10613 }
10614 if (match.hit)
10615 {
10616 {
10617 #if (DEBUG)
10618 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ArrayConstant");
10619 #endif
10620 return Match(true, value);
10621 }
10622 }
10623 *parentMatch0 = match;
10624 }
10625 #if (DEBUG)
10626 if (writeToLog)
10627 {
10628 if (match.hit)
10629 {
10630 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"ArrayConstant");
10631 }
10632 else
10633 {
10634 System.Lex.WriteFailureToLog(lexer, u"ArrayConstant");
10635 }
10636 }
10637 #endif
10638 if (!match.hit)
10639 {
10640 match.value = null;
10641 }
10642 return match;
10643 }
10644 public static Match StructureConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
10645 {
10646 #if (DEBUG)
10647 Span debugSpan;
10648 bool writeToLog = lexer.Log() != null;
10649 if (writeToLog)
10650 {
10651 debugSpan = lexer.GetSpan();
10652 System.Lex.WriteBeginRuleToLog(lexer, u"StructureConstant");
10653 }
10654 #endif
10655 cmsx.intermediate.StructureValue* value;
10656 UniquePtr<cmsx.intermediate.ConstantValue> member;
10657 Match match(false);
10658 Match* parentMatch0 = &match;
10659 {
10660 Match match(false);
10661 Match* parentMatch1 = &match;
10662 {
10663 Match match(false);
10664 Match* parentMatch2 = &match;
10665 {
10666 long pos = lexer.GetPos();
10667 Match match(false);
10668 if (*lexer == LBRACE)
10669 {
10670 ++lexer;
10671 match.hit = true;
10672 }
10673 if (match.hit)
10674 {
10675 value = context->MakeStructureValue();
10676 }
10677 *parentMatch2 = match;
10678 }
10679 *parentMatch1 = match;
10680 }
10681 if (match.hit)
10682 {
10683 Match match(false);
10684 Match* parentMatch3 = &match;
10685 {
10686 Match match(true);
10687 long save = lexer.GetPos();
10688 Match* parentMatch4 = &match;
10689 {
10690 Match match(false);
10691 Match* parentMatch5 = &match;
10692 {
10693 Match match(false);
10694 Match* parentMatch6 = &match;
10695 {
10696 Match match(false);
10697 Match* parentMatch7 = &match;
10698 {
10699 long pos = lexer.GetPos();
10700 Match match = IntermediateCodeFileParser.Constant(lexer, context);
10701 member.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
10702 if (match.hit)
10703 {
10704 value->AddMember(member.Release());
10705 }
10706 *parentMatch7 = match;
10707 }
10708 *parentMatch6 = match;
10709 }
10710 if (match.hit)
10711 {
10712 Match match(false);
10713 Match* parentMatch8 = &match;
10714 {
10715 Match match(true);
10716 Match* parentMatch9 = &match;
10717 {
10718 while (true)
10719 {
10720 long save = lexer.GetPos();
10721 {
10722 Match match(false);
10723 Match* parentMatch10 = &match;
10724 {
10725 Match match(false);
10726 if (*lexer == COMMA)
10727 {
10728 ++lexer;
10729 match.hit = true;
10730 }
10731 *parentMatch10 = match;
10732 }
10733 if (match.hit)
10734 {
10735 Match match(false);
10736 Match* parentMatch11 = &match;
10737 {
10738 Match match(false);
10739 Match* parentMatch12 = &match;
10740 {
10741 long pos = lexer.GetPos();
10742 Match match = IntermediateCodeFileParser.Constant(lexer, context);
10743 member.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
10744 if (match.hit)
10745 {
10746 value->AddMember(member.Release());
10747 }
10748 *parentMatch12 = match;
10749 }
10750 *parentMatch11 = match;
10751 }
10752 *parentMatch10 = match;
10753 }
10754 if (match.hit)
10755 {
10756 *parentMatch9 = match;
10757 }
10758 else
10759 {
10760 lexer.SetPos(save);
10761 break;
10762 }
10763 }
10764 }
10765 }
10766 *parentMatch8 = match;
10767 }
10768 *parentMatch6 = match;
10769 }
10770 *parentMatch5 = match;
10771 }
10772 if (match.hit)
10773 {
10774 *parentMatch4 = match;
10775 }
10776 else
10777 {
10778 lexer.SetPos(save);
10779 }
10780 }
10781 *parentMatch3 = match;
10782 }
10783 *parentMatch1 = match;
10784 }
10785 *parentMatch0 = match;
10786 }
10787 if (match.hit)
10788 {
10789 Match match(false);
10790 Match* parentMatch13 = &match;
10791 {
10792 Match match(false);
10793 Match* parentMatch14 = &match;
10794 {
10795 long pos = lexer.GetPos();
10796 Match match(true);
10797 Match* parentMatch15 = &match;
10798 {
10799 System.Lex.Span span = lexer.GetSpan();
10800 Match match(false);
10801 if (*lexer == RBRACE)
10802 {
10803 ++lexer;
10804 match.hit = true;
10805 }
10806 if (match.hit)
10807 {
10808 *parentMatch15 = match;
10809 }
10810 else
10811 {
10812 lexer.ThrowExpectationFailure(span, GetTokenName(RBRACE));
10813 }
10814 }
10815 if (match.hit)
10816 {
10817 {
10818 #if (DEBUG)
10819 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StructureConstant");
10820 #endif
10821 return Match(true, value);
10822 }
10823 }
10824 *parentMatch14 = match;
10825 }
10826 *parentMatch13 = match;
10827 }
10828 *parentMatch0 = match;
10829 }
10830 #if (DEBUG)
10831 if (writeToLog)
10832 {
10833 if (match.hit)
10834 {
10835 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StructureConstant");
10836 }
10837 else
10838 {
10839 System.Lex.WriteFailureToLog(lexer, u"StructureConstant");
10840 }
10841 }
10842 #endif
10843 if (!match.hit)
10844 {
10845 match.value = null;
10846 }
10847 return match;
10848 }
10849 public static Match StringConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
10850 {
10851 #if (DEBUG)
10852 Span debugSpan;
10853 bool writeToLog = lexer.Log() != null;
10854 if (writeToLog)
10855 {
10856 debugSpan = lexer.GetSpan();
10857 System.Lex.WriteBeginRuleToLog(lexer, u"StringConstant");
10858 }
10859 #endif
10860 Match match(false);
10861 Match* parentMatch0 = &match;
10862 {
10863 long pos = lexer.GetPos();
10864 Match match(false);
10865 if (*lexer == STRING)
10866 {
10867 ++lexer;
10868 match.hit = true;
10869 }
10870 if (match.hit)
10871 {
10872 {
10873 #if (DEBUG)
10874 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StringConstant");
10875 #endif
10876 return Match(true, context->MakeStringValue(ToUtf8(lexer.GetToken(pos).match.ToString())));
10877 }
10878 }
10879 *parentMatch0 = match;
10880 }
10881 #if (DEBUG)
10882 if (writeToLog)
10883 {
10884 if (match.hit)
10885 {
10886 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StringConstant");
10887 }
10888 else
10889 {
10890 System.Lex.WriteFailureToLog(lexer, u"StringConstant");
10891 }
10892 }
10893 #endif
10894 if (!match.hit)
10895 {
10896 match.value = null;
10897 }
10898 return match;
10899 }
10900 public static Match StringArrayConstant(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
10901 {
10902 #if (DEBUG)
10903 Span debugSpan;
10904 bool writeToLog = lexer.Log() != null;
10905 if (writeToLog)
10906 {
10907 debugSpan = lexer.GetSpan();
10908 System.Lex.WriteBeginRuleToLog(lexer, u"StringArrayConstant");
10909 }
10910 #endif
10911 cmsx.intermediate.StringArrayValue* value;
10912 UniquePtr<Value<char>> prefix;
10913 UniquePtr<cmsx.intermediate.ConstantValue> element;
10914 Match match(false);
10915 Match* parentMatch0 = &match;
10916 {
10917 Match match(false);
10918 Match* parentMatch1 = &match;
10919 {
10920 Match match(false);
10921 Match* parentMatch2 = &match;
10922 {
10923 Match match = IntermediateCodeFileParser.StringArrayPrefix(lexer);
10924 prefix.Reset(cast<Value<char>*>(match.value));
10925 *parentMatch2 = match;
10926 }
10927 if (match.hit)
10928 {
10929 Match match(false);
10930 Match* parentMatch3 = &match;
10931 {
10932 Match match(false);
10933 Match* parentMatch4 = &match;
10934 {
10935 long pos = lexer.GetPos();
10936 Match match(false);
10937 if (*lexer == LBRACKET)
10938 {
10939 ++lexer;
10940 match.hit = true;
10941 }
10942 if (match.hit)
10943 {
10944 value = context->MakeStringArrayValue(prefix->value);
10945 }
10946 *parentMatch4 = match;
10947 }
10948 *parentMatch3 = match;
10949 }
10950 *parentMatch2 = match;
10951 }
10952 *parentMatch1 = match;
10953 }
10954 if (match.hit)
10955 {
10956 Match match(false);
10957 Match* parentMatch5 = &match;
10958 {
10959 Match match(true);
10960 long save = lexer.GetPos();
10961 Match* parentMatch6 = &match;
10962 {
10963 Match match(false);
10964 Match* parentMatch7 = &match;
10965 {
10966 Match match(false);
10967 Match* parentMatch8 = &match;
10968 {
10969 Match match(false);
10970 Match* parentMatch9 = &match;
10971 {
10972 long pos = lexer.GetPos();
10973 Match match = IntermediateCodeFileParser.Constant(lexer, context);
10974 element.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
10975 if (match.hit)
10976 {
10977 value->AddElement(element.Release());
10978 }
10979 *parentMatch9 = match;
10980 }
10981 *parentMatch8 = match;
10982 }
10983 if (match.hit)
10984 {
10985 Match match(false);
10986 Match* parentMatch10 = &match;
10987 {
10988 Match match(true);
10989 Match* parentMatch11 = &match;
10990 {
10991 while (true)
10992 {
10993 long save = lexer.GetPos();
10994 {
10995 Match match(false);
10996 Match* parentMatch12 = &match;
10997 {
10998 Match match(false);
10999 if (*lexer == COMMA)
11000 {
11001 ++lexer;
11002 match.hit = true;
11003 }
11004 *parentMatch12 = match;
11005 }
11006 if (match.hit)
11007 {
11008 Match match(false);
11009 Match* parentMatch13 = &match;
11010 {
11011 Match match(false);
11012 Match* parentMatch14 = &match;
11013 {
11014 long pos = lexer.GetPos();
11015 Match match = IntermediateCodeFileParser.Constant(lexer, context);
11016 element.Reset(cast<cmsx.intermediate.ConstantValue*>(match.value));
11017 if (match.hit)
11018 {
11019 value->AddElement(element.Release());
11020 }
11021 *parentMatch14 = match;
11022 }
11023 *parentMatch13 = match;
11024 }
11025 *parentMatch12 = match;
11026 }
11027 if (match.hit)
11028 {
11029 *parentMatch11 = match;
11030 }
11031 else
11032 {
11033 lexer.SetPos(save);
11034 break;
11035 }
11036 }
11037 }
11038 }
11039 *parentMatch10 = match;
11040 }
11041 *parentMatch8 = match;
11042 }
11043 *parentMatch7 = match;
11044 }
11045 if (match.hit)
11046 {
11047 *parentMatch6 = match;
11048 }
11049 else
11050 {
11051 lexer.SetPos(save);
11052 }
11053 }
11054 *parentMatch5 = match;
11055 }
11056 *parentMatch1 = match;
11057 }
11058 *parentMatch0 = match;
11059 }
11060 if (match.hit)
11061 {
11062 Match match(false);
11063 Match* parentMatch15 = &match;
11064 {
11065 Match match(false);
11066 Match* parentMatch16 = &match;
11067 {
11068 long pos = lexer.GetPos();
11069 Match match(false);
11070 if (*lexer == RBRACKET)
11071 {
11072 ++lexer;
11073 match.hit = true;
11074 }
11075 if (match.hit)
11076 {
11077 {
11078 #if (DEBUG)
11079 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StringArrayConstant");
11080 #endif
11081 return Match(true, value);
11082 }
11083 }
11084 *parentMatch16 = match;
11085 }
11086 *parentMatch15 = match;
11087 }
11088 *parentMatch0 = match;
11089 }
11090 #if (DEBUG)
11091 if (writeToLog)
11092 {
11093 if (match.hit)
11094 {
11095 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StringArrayConstant");
11096 }
11097 else
11098 {
11099 System.Lex.WriteFailureToLog(lexer, u"StringArrayConstant");
11100 }
11101 }
11102 #endif
11103 if (!match.hit)
11104 {
11105 match.value = null;
11106 }
11107 return match;
11108 }
11109 public static Match StringArrayPrefix(IntermediateCodeLexer& lexer)
11110 {
11111 #if (DEBUG)
11112 Span debugSpan;
11113 bool writeToLog = lexer.Log() != null;
11114 if (writeToLog)
11115 {
11116 debugSpan = lexer.GetSpan();
11117 System.Lex.WriteBeginRuleToLog(lexer, u"StringArrayPrefix");
11118 }
11119 #endif
11120 Match match(false);
11121 Match* parentMatch0 = &match;
11122 {
11123 long pos = lexer.GetPos();
11124 bool pass = true;
11125 Match match(false);
11126 if (*lexer == ID)
11127 {
11128 ++lexer;
11129 match.hit = true;
11130 }
11131 if (match.hit)
11132 {
11133 string p = ToUtf8(lexer.GetToken(pos).match.ToString());
11134 pass = p == "w" || p == "u" || p == "b";
11135 if (pass)
11136 {
11137 #if (DEBUG)
11138 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StringArrayPrefix");
11139 #endif
11140 return Match(true, new Value<char>(p[0]));
11141 }
11142 }
11143 if (match.hit && !pass)
11144 {
11145 match = Match(false);
11146 }
11147 *parentMatch0 = match;
11148 }
11149 #if (DEBUG)
11150 if (writeToLog)
11151 {
11152 if (match.hit)
11153 {
11154 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"StringArrayPrefix");
11155 }
11156 else
11157 {
11158 System.Lex.WriteFailureToLog(lexer, u"StringArrayPrefix");
11159 }
11160 }
11161 #endif
11162 if (!match.hit)
11163 {
11164 match.value = null;
11165 }
11166 return match;
11167 }
11168 public static Match Metadata(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
11169 {
11170 #if (DEBUG)
11171 Span debugSpan;
11172 bool writeToLog = lexer.Log() != null;
11173 if (writeToLog)
11174 {
11175 debugSpan = lexer.GetSpan();
11176 System.Lex.WriteBeginRuleToLog(lexer, u"Metadata");
11177 }
11178 #endif
11179 cmsx.intermediate.MDStruct* mdStruct;
11180 UniquePtr<cmsx.intermediate.MDStruct> mds;
11181 Match match(false);
11182 Match* parentMatch0 = &match;
11183 {
11184 Match match(false);
11185 Match* parentMatch1 = &match;
11186 {
11187 Match match(false);
11188 Match* parentMatch2 = &match;
11189 {
11190 Match match(false);
11191 if (*lexer == METADATA)
11192 {
11193 ++lexer;
11194 match.hit = true;
11195 }
11196 *parentMatch2 = match;
11197 }
11198 if (match.hit)
11199 {
11200 Match match(false);
11201 Match* parentMatch3 = &match;
11202 {
11203 Match match(true);
11204 Match* parentMatch4 = &match;
11205 {
11206 System.Lex.Span span = lexer.GetSpan();
11207 Match match(false);
11208 if (*lexer == LBRACE)
11209 {
11210 ++lexer;
11211 match.hit = true;
11212 }
11213 if (match.hit)
11214 {
11215 *parentMatch4 = match;
11216 }
11217 else
11218 {
11219 lexer.ThrowExpectationFailure(span, GetTokenName(LBRACE));
11220 }
11221 }
11222 *parentMatch3 = match;
11223 }
11224 *parentMatch2 = match;
11225 }
11226 *parentMatch1 = match;
11227 }
11228 if (match.hit)
11229 {
11230 Match match(false);
11231 Match* parentMatch5 = &match;
11232 {
11233 Match match(true);
11234 Match* parentMatch6 = &match;
11235 {
11236 while (true)
11237 {
11238 long save = lexer.GetPos();
11239 {
11240 Match match(false);
11241 Match* parentMatch7 = &match;
11242 {
11243 Match match(false);
11244 Match* parentMatch8 = &match;
11245 {
11246 long pos = lexer.GetPos();
11247 Match match = IntermediateCodeFileParser.MDStruct(lexer, context);
11248 mds.Reset(cast<cmsx.intermediate.MDStruct*>(match.value));
11249 if (match.hit)
11250 {
11251 mdStruct = mds.Release();
11252 }
11253 *parentMatch8 = match;
11254 }
11255 *parentMatch7 = match;
11256 }
11257 if (match.hit)
11258 {
11259 *parentMatch6 = match;
11260 }
11261 else
11262 {
11263 lexer.SetPos(save);
11264 break;
11265 }
11266 }
11267 }
11268 }
11269 *parentMatch5 = match;
11270 }
11271 *parentMatch1 = match;
11272 }
11273 *parentMatch0 = match;
11274 }
11275 if (match.hit)
11276 {
11277 Match match(false);
11278 Match* parentMatch9 = &match;
11279 {
11280 Match match(true);
11281 Match* parentMatch10 = &match;
11282 {
11283 System.Lex.Span span = lexer.GetSpan();
11284 Match match(false);
11285 if (*lexer == RBRACE)
11286 {
11287 ++lexer;
11288 match.hit = true;
11289 }
11290 if (match.hit)
11291 {
11292 *parentMatch10 = match;
11293 }
11294 else
11295 {
11296 lexer.ThrowExpectationFailure(span, GetTokenName(RBRACE));
11297 }
11298 }
11299 *parentMatch9 = match;
11300 }
11301 *parentMatch0 = match;
11302 }
11303 #if (DEBUG)
11304 if (writeToLog)
11305 {
11306 if (match.hit)
11307 {
11308 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"Metadata");
11309 }
11310 else
11311 {
11312 System.Lex.WriteFailureToLog(lexer, u"Metadata");
11313 }
11314 }
11315 #endif
11316 if (!match.hit)
11317 {
11318 match.value = null;
11319 }
11320 return match;
11321 }
11322 public static Match MDItem(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
11323 {
11324 #if (DEBUG)
11325 Span debugSpan;
11326 bool writeToLog = lexer.Log() != null;
11327 if (writeToLog)
11328 {
11329 debugSpan = lexer.GetSpan();
11330 System.Lex.WriteBeginRuleToLog(lexer, u"MDItem");
11331 }
11332 #endif
11333 UniquePtr<cmsx.intermediate.MDBool> mdBool;
11334 UniquePtr<cmsx.intermediate.MDLong> mdLong;
11335 UniquePtr<cmsx.intermediate.MDString> mdString;
11336 UniquePtr<cmsx.intermediate.MDStructRef> mdStructRef;
11337 Match match(false);
11338 Match* parentMatch0 = &match;
11339 {
11340 long save = lexer.GetPos();
11341 Match match(false);
11342 Match* parentMatch1 = &match;
11343 {
11344 long save = lexer.GetPos();
11345 Match match(false);
11346 Match* parentMatch2 = &match;
11347 {
11348 long save = lexer.GetPos();
11349 Match match(false);
11350 Match* parentMatch3 = &match;
11351 {
11352 long pos = lexer.GetPos();
11353 Match match = IntermediateCodeFileParser.MDBool(lexer, context);
11354 mdBool.Reset(cast<cmsx.intermediate.MDBool*>(match.value));
11355 if (match.hit)
11356 {
11357 {
11358 #if (DEBUG)
11359 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDItem");
11360 #endif
11361 return Match(true, mdBool.Release());
11362 }
11363 }
11364 *parentMatch3 = match;
11365 }
11366 *parentMatch2 = match;
11367 if (!match.hit)
11368 {
11369 Match match(false);
11370 Match* parentMatch4 = &match;
11371 lexer.SetPos(save);
11372 {
11373 Match match(false);
11374 Match* parentMatch5 = &match;
11375 {
11376 long pos = lexer.GetPos();
11377 Match match = IntermediateCodeFileParser.MDLong(lexer, context);
11378 mdLong.Reset(cast<cmsx.intermediate.MDLong*>(match.value));
11379 if (match.hit)
11380 {
11381 {
11382 #if (DEBUG)
11383 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDItem");
11384 #endif
11385 return Match(true, mdLong.Release());
11386 }
11387 }
11388 *parentMatch5 = match;
11389 }
11390 *parentMatch4 = match;
11391 }
11392 *parentMatch2 = match;
11393 }
11394 }
11395 *parentMatch1 = match;
11396 if (!match.hit)
11397 {
11398 Match match(false);
11399 Match* parentMatch6 = &match;
11400 lexer.SetPos(save);
11401 {
11402 Match match(false);
11403 Match* parentMatch7 = &match;
11404 {
11405 long pos = lexer.GetPos();
11406 Match match = IntermediateCodeFileParser.MDString(lexer, context);
11407 mdString.Reset(cast<cmsx.intermediate.MDString*>(match.value));
11408 if (match.hit)
11409 {
11410 {
11411 #if (DEBUG)
11412 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDItem");
11413 #endif
11414 return Match(true, mdString.Release());
11415 }
11416 }
11417 *parentMatch7 = match;
11418 }
11419 *parentMatch6 = match;
11420 }
11421 *parentMatch1 = match;
11422 }
11423 }
11424 *parentMatch0 = match;
11425 if (!match.hit)
11426 {
11427 Match match(false);
11428 Match* parentMatch8 = &match;
11429 lexer.SetPos(save);
11430 {
11431 Match match(false);
11432 Match* parentMatch9 = &match;
11433 {
11434 long pos = lexer.GetPos();
11435 Match match = IntermediateCodeFileParser.MDStructRef(lexer, context);
11436 mdStructRef.Reset(cast<cmsx.intermediate.MDStructRef*>(match.value));
11437 if (match.hit)
11438 {
11439 {
11440 #if (DEBUG)
11441 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDItem");
11442 #endif
11443 return Match(true, mdStructRef.Release());
11444 }
11445 }
11446 *parentMatch9 = match;
11447 }
11448 *parentMatch8 = match;
11449 }
11450 *parentMatch0 = match;
11451 }
11452 }
11453 #if (DEBUG)
11454 if (writeToLog)
11455 {
11456 if (match.hit)
11457 {
11458 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDItem");
11459 }
11460 else
11461 {
11462 System.Lex.WriteFailureToLog(lexer, u"MDItem");
11463 }
11464 }
11465 #endif
11466 if (!match.hit)
11467 {
11468 match.value = null;
11469 }
11470 return match;
11471 }
11472 public static Match MDBool(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
11473 {
11474 #if (DEBUG)
11475 Span debugSpan;
11476 bool writeToLog = lexer.Log() != null;
11477 if (writeToLog)
11478 {
11479 debugSpan = lexer.GetSpan();
11480 System.Lex.WriteBeginRuleToLog(lexer, u"MDBool");
11481 }
11482 #endif
11483 Match match(false);
11484 long pos = lexer.GetPos();
11485 Span span = lexer.GetSpan();
11486 switch (*lexer)
11487 {
11488 case TRUE:
11489 {
11490 ++lexer;
11491 {
11492 #if (DEBUG)
11493 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDBool");
11494 #endif
11495 return Match(true, context->CreateMDBool(true));
11496 }
11497 break;
11498 }
11499 case FALSE:
11500 {
11501 ++lexer;
11502 {
11503 #if (DEBUG)
11504 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDBool");
11505 #endif
11506 return Match(true, context->CreateMDBool(false));
11507 }
11508 break;
11509 }
11510 }
11511 #if (DEBUG)
11512 if (writeToLog)
11513 {
11514 if (match.hit)
11515 {
11516 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDBool");
11517 }
11518 else
11519 {
11520 System.Lex.WriteFailureToLog(lexer, u"MDBool");
11521 }
11522 }
11523 #endif
11524 if (!match.hit)
11525 {
11526 match.value = null;
11527 }
11528 return match;
11529 }
11530 public static Match MDLong(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
11531 {
11532 #if (DEBUG)
11533 Span debugSpan;
11534 bool writeToLog = lexer.Log() != null;
11535 if (writeToLog)
11536 {
11537 debugSpan = lexer.GetSpan();
11538 System.Lex.WriteBeginRuleToLog(lexer, u"MDLong");
11539 }
11540 #endif
11541 Match match(false);
11542 Match* parentMatch0 = &match;
11543 {
11544 long pos = lexer.GetPos();
11545 Match match(false);
11546 if (*lexer == NUMBER)
11547 {
11548 ++lexer;
11549 match.hit = true;
11550 }
11551 if (match.hit)
11552 {
11553 {
11554 #if (DEBUG)
11555 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDLong");
11556 #endif
11557 return Match(true, context->CreateMDLong(ParseLong(ToUtf8(lexer.GetToken(pos).match.ToString()))));
11558 }
11559 }
11560 *parentMatch0 = match;
11561 }
11562 #if (DEBUG)
11563 if (writeToLog)
11564 {
11565 if (match.hit)
11566 {
11567 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDLong");
11568 }
11569 else
11570 {
11571 System.Lex.WriteFailureToLog(lexer, u"MDLong");
11572 }
11573 }
11574 #endif
11575 if (!match.hit)
11576 {
11577 match.value = null;
11578 }
11579 return match;
11580 }
11581 public static Match MDString(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
11582 {
11583 #if (DEBUG)
11584 Span debugSpan;
11585 bool writeToLog = lexer.Log() != null;
11586 if (writeToLog)
11587 {
11588 debugSpan = lexer.GetSpan();
11589 System.Lex.WriteBeginRuleToLog(lexer, u"MDString");
11590 }
11591 #endif
11592 Match match(false);
11593 Match* parentMatch0 = &match;
11594 {
11595 long pos = lexer.GetPos();
11596 Match match(false);
11597 if (*lexer == STRING)
11598 {
11599 ++lexer;
11600 match.hit = true;
11601 }
11602 if (match.hit)
11603 {
11604 {
11605 #if (DEBUG)
11606 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDString");
11607 #endif
11608 return Match(true, context->CreateMDString(ToUtf8(lexer.GetToken(pos).match.ToString())));
11609 }
11610 }
11611 *parentMatch0 = match;
11612 }
11613 #if (DEBUG)
11614 if (writeToLog)
11615 {
11616 if (match.hit)
11617 {
11618 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDString");
11619 }
11620 else
11621 {
11622 System.Lex.WriteFailureToLog(lexer, u"MDString");
11623 }
11624 }
11625 #endif
11626 if (!match.hit)
11627 {
11628 match.value = null;
11629 }
11630 return match;
11631 }
11632 public static Match MDStructRef(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
11633 {
11634 #if (DEBUG)
11635 Span debugSpan;
11636 bool writeToLog = lexer.Log() != null;
11637 if (writeToLog)
11638 {
11639 debugSpan = lexer.GetSpan();
11640 System.Lex.WriteBeginRuleToLog(lexer, u"MDStructRef");
11641 }
11642 #endif
11643 Match match(false);
11644 Match* parentMatch0 = &match;
11645 {
11646 Match match(false);
11647 if (*lexer == EXCLAMATION)
11648 {
11649 ++lexer;
11650 match.hit = true;
11651 }
11652 *parentMatch0 = match;
11653 }
11654 if (match.hit)
11655 {
11656 Match match(false);
11657 Match* parentMatch1 = &match;
11658 {
11659 Match match(false);
11660 Match* parentMatch2 = &match;
11661 {
11662 long pos = lexer.GetPos();
11663 Match match(false);
11664 if (*lexer == NUMBER)
11665 {
11666 ++lexer;
11667 match.hit = true;
11668 }
11669 if (match.hit)
11670 {
11671 {
11672 #if (DEBUG)
11673 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDStructRef");
11674 #endif
11675 return Match(true, context->CreateMDStructRef(ParseInt(ToUtf8(lexer.GetToken(pos).match.ToString()))));
11676 }
11677 }
11678 *parentMatch2 = match;
11679 }
11680 *parentMatch1 = match;
11681 }
11682 *parentMatch0 = match;
11683 }
11684 #if (DEBUG)
11685 if (writeToLog)
11686 {
11687 if (match.hit)
11688 {
11689 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDStructRef");
11690 }
11691 else
11692 {
11693 System.Lex.WriteFailureToLog(lexer, u"MDStructRef");
11694 }
11695 }
11696 #endif
11697 if (!match.hit)
11698 {
11699 match.value = null;
11700 }
11701 return match;
11702 }
11703 public static Match MDStruct(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context)
11704 {
11705 #if (DEBUG)
11706 Span debugSpan;
11707 bool writeToLog = lexer.Log() != null;
11708 if (writeToLog)
11709 {
11710 debugSpan = lexer.GetSpan();
11711 System.Lex.WriteBeginRuleToLog(lexer, u"MDStruct");
11712 }
11713 #endif
11714 cmsx.intermediate.MDStruct* value;
11715 Match match(false);
11716 Match* parentMatch0 = &match;
11717 {
11718 long pos = lexer.GetPos();
11719 Match match(false);
11720 Match* parentMatch1 = &match;
11721 {
11722 Match match(false);
11723 Match* parentMatch2 = &match;
11724 {
11725 Match match(false);
11726 Match* parentMatch3 = &match;
11727 {
11728 Match match(false);
11729 Match* parentMatch4 = &match;
11730 {
11731 Match match(false);
11732 Match* parentMatch5 = &match;
11733 {
11734 Match match(false);
11735 Match* parentMatch6 = &match;
11736 {
11737 Match match(false);
11738 if (*lexer == EXCLAMATION)
11739 {
11740 ++lexer;
11741 match.hit = true;
11742 }
11743 *parentMatch6 = match;
11744 }
11745 if (match.hit)
11746 {
11747 Match match(false);
11748 Match* parentMatch7 = &match;
11749 {
11750 Match match(false);
11751 Match* parentMatch8 = &match;
11752 {
11753 long pos = lexer.GetPos();
11754 Match match(false);
11755 if (*lexer == NUMBER)
11756 {
11757 ++lexer;
11758 match.hit = true;
11759 }
11760 if (match.hit)
11761 {
11762 value = context->CreateMDStruct(ParseInt(ToUtf8(lexer.GetToken(pos).match.ToString())));
11763 }
11764 *parentMatch8 = match;
11765 }
11766 *parentMatch7 = match;
11767 }
11768 *parentMatch6 = match;
11769 }
11770 *parentMatch5 = match;
11771 }
11772 if (match.hit)
11773 {
11774 Match match(false);
11775 Match* parentMatch9 = &match;
11776 {
11777 Match match(false);
11778 if (*lexer == ASSIGN)
11779 {
11780 ++lexer;
11781 match.hit = true;
11782 }
11783 *parentMatch9 = match;
11784 }
11785 *parentMatch5 = match;
11786 }
11787 *parentMatch4 = match;
11788 }
11789 if (match.hit)
11790 {
11791 Match match(false);
11792 Match* parentMatch10 = &match;
11793 {
11794 Match match(false);
11795 if (*lexer == LBRACE)
11796 {
11797 ++lexer;
11798 match.hit = true;
11799 }
11800 *parentMatch10 = match;
11801 }
11802 *parentMatch4 = match;
11803 }
11804 *parentMatch3 = match;
11805 }
11806 if (match.hit)
11807 {
11808 Match match(false);
11809 Match* parentMatch11 = &match;
11810 {
11811 Match match(true);
11812 long save = lexer.GetPos();
11813 Match* parentMatch12 = &match;
11814 {
11815 Match match(false);
11816 Match* parentMatch13 = &match;
11817 {
11818 Match match(false);
11819 Match* parentMatch14 = &match;
11820 {
11821 Match match = IntermediateCodeFileParser.MDField(lexer, context, value);
11822 *parentMatch14 = match;
11823 }
11824 if (match.hit)
11825 {
11826 Match match(false);
11827 Match* parentMatch15 = &match;
11828 {
11829 Match match(true);
11830 Match* parentMatch16 = &match;
11831 {
11832 while (true)
11833 {
11834 long save = lexer.GetPos();
11835 {
11836 Match match(false);
11837 Match* parentMatch17 = &match;
11838 {
11839 Match match(false);
11840 if (*lexer == COMMA)
11841 {
11842 ++lexer;
11843 match.hit = true;
11844 }
11845 *parentMatch17 = match;
11846 }
11847 if (match.hit)
11848 {
11849 Match match(false);
11850 Match* parentMatch18 = &match;
11851 {
11852 Match match = IntermediateCodeFileParser.MDField(lexer, context, value);
11853 *parentMatch18 = match;
11854 }
11855 *parentMatch17 = match;
11856 }
11857 if (match.hit)
11858 {
11859 *parentMatch16 = match;
11860 }
11861 else
11862 {
11863 lexer.SetPos(save);
11864 break;
11865 }
11866 }
11867 }
11868 }
11869 *parentMatch15 = match;
11870 }
11871 *parentMatch14 = match;
11872 }
11873 *parentMatch13 = match;
11874 }
11875 if (match.hit)
11876 {
11877 *parentMatch12 = match;
11878 }
11879 else
11880 {
11881 lexer.SetPos(save);
11882 }
11883 }
11884 *parentMatch11 = match;
11885 }
11886 *parentMatch3 = match;
11887 }
11888 *parentMatch2 = match;
11889 }
11890 if (match.hit)
11891 {
11892 Match match(false);
11893 Match* parentMatch19 = &match;
11894 {
11895 Match match(false);
11896 if (*lexer == RBRACE)
11897 {
11898 ++lexer;
11899 match.hit = true;
11900 }
11901 *parentMatch19 = match;
11902 }
11903 *parentMatch2 = match;
11904 }
11905 *parentMatch1 = match;
11906 }
11907 if (match.hit)
11908 {
11909 {
11910 #if (DEBUG)
11911 if (writeToLog) System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDStruct");
11912 #endif
11913 return Match(true, value);
11914 }
11915 }
11916 *parentMatch0 = match;
11917 }
11918 #if (DEBUG)
11919 if (writeToLog)
11920 {
11921 if (match.hit)
11922 {
11923 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDStruct");
11924 }
11925 else
11926 {
11927 System.Lex.WriteFailureToLog(lexer, u"MDStruct");
11928 }
11929 }
11930 #endif
11931 if (!match.hit)
11932 {
11933 match.value = null;
11934 }
11935 return match;
11936 }
11937 public static Match MDField(IntermediateCodeLexer& lexer, cmsx.intermediate.Context* context, cmsx.intermediate.MDStruct* parent)
11938 {
11939 #if (DEBUG)
11940 Span debugSpan;
11941 bool writeToLog = lexer.Log() != null;
11942 if (writeToLog)
11943 {
11944 debugSpan = lexer.GetSpan();
11945 System.Lex.WriteBeginRuleToLog(lexer, u"MDField");
11946 }
11947 #endif
11948 string fieldName;
11949 UniquePtr<cmsx.intermediate.MDItem> item;
11950 Match match(false);
11951 Match* parentMatch0 = &match;
11952 {
11953 long pos = lexer.GetPos();
11954 Match match(false);
11955 Match* parentMatch1 = &match;
11956 {
11957 Match match(false);
11958 Match* parentMatch2 = &match;
11959 {
11960 Match match(false);
11961 Match* parentMatch3 = &match;
11962 {
11963 Match match(false);
11964 Match* parentMatch4 = &match;
11965 {
11966 long pos = lexer.GetPos();
11967 Match match(false);
11968 if (*lexer == ID)
11969 {
11970 ++lexer;
11971 match.hit = true;
11972 }
11973 if (match.hit)
11974 {
11975 fieldName = ToUtf8(lexer.GetToken(pos).match.ToString());
11976 }
11977 *parentMatch4 = match;
11978 }
11979 *parentMatch3 = match;
11980 }
11981 if (match.hit)
11982 {
11983 Match match(false);
11984 Match* parentMatch5 = &match;
11985 {
11986 Match match(false);
11987 if (*lexer == COLON)
11988 {
11989 ++lexer;
11990 match.hit = true;
11991 }
11992 *parentMatch5 = match;
11993 }
11994 *parentMatch3 = match;
11995 }
11996 *parentMatch2 = match;
11997 }
11998 if (match.hit)
11999 {
12000 Match match(false);
12001 Match* parentMatch6 = &match;
12002 {
12003 Match match = IntermediateCodeFileParser.MDItem(lexer, context);
12004 item.Reset(cast<cmsx.intermediate.MDItem*>(match.value));
12005 *parentMatch6 = match;
12006 }
12007 *parentMatch2 = match;
12008 }
12009 *parentMatch1 = match;
12010 }
12011 if (match.hit)
12012 {
12013 parent->AddItem(fieldName, item.Release());
12014 }
12015 *parentMatch0 = match;
12016 }
12017 #if (DEBUG)
12018 if (writeToLog)
12019 {
12020 if (match.hit)
12021 {
12022 System.Lex.WriteSuccessToLog(lexer, debugSpan, u"MDField");
12023 }
12024 else
12025 {
12026 System.Lex.WriteFailureToLog(lexer, u"MDField");
12027 }
12028 }
12029 #endif
12030 if (!match.hit)
12031 {
12032 match.value = null;
12033 }
12034 return match;
12035 }
12036 }