-
Notifications
You must be signed in to change notification settings - Fork 0
/
MiniJavaParser.java
1953 lines (1802 loc) · 50.9 KB
/
MiniJavaParser.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Generated By:JavaCC: Do not edit this line. MiniJavaParser.java */
import syntaxtree.*;
import java.util.Vector;
public class MiniJavaParser implements MiniJavaParserConstants {
final public Goal Goal() throws ParseException {
MainClass n0;
NodeListOptional n1 = new NodeListOptional();
TypeDeclaration n2;
NodeToken n3;
Token n4;
n0 = MainClass();
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CLASS:
;
break;
default:
jj_la1[0] = jj_gen;
break label_1;
}
n2 = TypeDeclaration();
n1.addNode(n2);
}
n1.nodes.trimToSize();
n4 = jj_consume_token(0);
n4.beginColumn++; n4.endColumn++;
n3 = JTBToolkit.makeNodeToken(n4);
{if (true) return new Goal(n0,n1,n3);}
throw new Error("Missing return statement in function");
}
final public MainClass MainClass() throws ParseException {
NodeToken n0;
Token n1;
Identifier n2;
NodeToken n3;
Token n4;
NodeToken n5;
Token n6;
NodeToken n7;
Token n8;
NodeToken n9;
Token n10;
NodeToken n11;
Token n12;
NodeToken n13;
Token n14;
NodeToken n15;
Token n16;
NodeToken n17;
Token n18;
NodeToken n19;
Token n20;
Identifier n21;
NodeToken n22;
Token n23;
NodeToken n24;
Token n25;
NodeListOptional n26 = new NodeListOptional();
VarDeclaration n27;
NodeListOptional n28 = new NodeListOptional();
Statement n29;
NodeToken n30;
Token n31;
NodeToken n32;
Token n33;
n1 = jj_consume_token(CLASS);
n0 = JTBToolkit.makeNodeToken(n1);
n2 = Identifier();
n4 = jj_consume_token(LBRACE);
n3 = JTBToolkit.makeNodeToken(n4);
n6 = jj_consume_token(PUBLIC);
n5 = JTBToolkit.makeNodeToken(n6);
n8 = jj_consume_token(STATIC);
n7 = JTBToolkit.makeNodeToken(n8);
n10 = jj_consume_token(VOID);
n9 = JTBToolkit.makeNodeToken(n10);
n12 = jj_consume_token(MAIN);
n11 = JTBToolkit.makeNodeToken(n12);
n14 = jj_consume_token(LPAREN);
n13 = JTBToolkit.makeNodeToken(n14);
n16 = jj_consume_token(STRING);
n15 = JTBToolkit.makeNodeToken(n16);
n18 = jj_consume_token(LSQPAREN);
n17 = JTBToolkit.makeNodeToken(n18);
n20 = jj_consume_token(RSQPAREN);
n19 = JTBToolkit.makeNodeToken(n20);
n21 = Identifier();
n23 = jj_consume_token(RPAREN);
n22 = JTBToolkit.makeNodeToken(n23);
n25 = jj_consume_token(LBRACE);
n24 = JTBToolkit.makeNodeToken(n25);
label_2:
while (true) {
if (jj_2_1(2)) {
;
} else {
break label_2;
}
n27 = VarDeclaration();
n26.addNode(n27);
}
n26.nodes.trimToSize();
label_3:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LBRACE:
case IF:
case WHILE:
case PRINT:
case IDENTIFIER:
;
break;
default:
jj_la1[1] = jj_gen;
break label_3;
}
n29 = Statement();
n28.addNode(n29);
}
n28.nodes.trimToSize();
n31 = jj_consume_token(RBRACE);
n30 = JTBToolkit.makeNodeToken(n31);
n33 = jj_consume_token(RBRACE);
n32 = JTBToolkit.makeNodeToken(n33);
{if (true) return new MainClass(n0,n2,n3,n5,n7,n9,n11,n13,n15,n17,n19,n21,n22,n24,n26,n28,n30,n32);}
throw new Error("Missing return statement in function");
}
final public TypeDeclaration TypeDeclaration() throws ParseException {
NodeChoice n0;
ClassDeclaration n1;
ClassExtendsDeclaration n2;
if (jj_2_2(3)) {
n1 = ClassDeclaration();
n0 = new NodeChoice(n1, 0);
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CLASS:
n2 = ClassExtendsDeclaration();
n0 = new NodeChoice(n2, 1);
break;
default:
jj_la1[2] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if (true) return new TypeDeclaration(n0);}
throw new Error("Missing return statement in function");
}
final public ClassDeclaration ClassDeclaration() throws ParseException {
NodeToken n0;
Token n1;
Identifier n2;
NodeToken n3;
Token n4;
NodeListOptional n5 = new NodeListOptional();
VarDeclaration n6;
NodeListOptional n7 = new NodeListOptional();
MethodDeclaration n8;
NodeToken n9;
Token n10;
n1 = jj_consume_token(CLASS);
n0 = JTBToolkit.makeNodeToken(n1);
n2 = Identifier();
n4 = jj_consume_token(LBRACE);
n3 = JTBToolkit.makeNodeToken(n4);
label_4:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BOOLEAN:
case INTEGER:
case IDENTIFIER:
;
break;
default:
jj_la1[3] = jj_gen;
break label_4;
}
n6 = VarDeclaration();
n5.addNode(n6);
}
n5.nodes.trimToSize();
label_5:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PUBLIC:
;
break;
default:
jj_la1[4] = jj_gen;
break label_5;
}
n8 = MethodDeclaration();
n7.addNode(n8);
}
n7.nodes.trimToSize();
n10 = jj_consume_token(RBRACE);
n9 = JTBToolkit.makeNodeToken(n10);
{if (true) return new ClassDeclaration(n0,n2,n3,n5,n7,n9);}
throw new Error("Missing return statement in function");
}
final public ClassExtendsDeclaration ClassExtendsDeclaration() throws ParseException {
NodeToken n0;
Token n1;
Identifier n2;
NodeToken n3;
Token n4;
Identifier n5;
NodeToken n6;
Token n7;
NodeListOptional n8 = new NodeListOptional();
VarDeclaration n9;
NodeListOptional n10 = new NodeListOptional();
MethodDeclaration n11;
NodeToken n12;
Token n13;
n1 = jj_consume_token(CLASS);
n0 = JTBToolkit.makeNodeToken(n1);
n2 = Identifier();
n4 = jj_consume_token(EXTENDS);
n3 = JTBToolkit.makeNodeToken(n4);
n5 = Identifier();
n7 = jj_consume_token(LBRACE);
n6 = JTBToolkit.makeNodeToken(n7);
label_6:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BOOLEAN:
case INTEGER:
case IDENTIFIER:
;
break;
default:
jj_la1[5] = jj_gen;
break label_6;
}
n9 = VarDeclaration();
n8.addNode(n9);
}
n8.nodes.trimToSize();
label_7:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PUBLIC:
;
break;
default:
jj_la1[6] = jj_gen;
break label_7;
}
n11 = MethodDeclaration();
n10.addNode(n11);
}
n10.nodes.trimToSize();
n13 = jj_consume_token(RBRACE);
n12 = JTBToolkit.makeNodeToken(n13);
{if (true) return new ClassExtendsDeclaration(n0,n2,n3,n5,n6,n8,n10,n12);}
throw new Error("Missing return statement in function");
}
final public VarDeclaration VarDeclaration() throws ParseException {
Type n0;
Identifier n1;
NodeToken n2;
Token n3;
n0 = Type();
n1 = Identifier();
n3 = jj_consume_token(SEMICOLON);
n2 = JTBToolkit.makeNodeToken(n3);
{if (true) return new VarDeclaration(n0,n1,n2);}
throw new Error("Missing return statement in function");
}
final public MethodDeclaration MethodDeclaration() throws ParseException {
NodeToken n0;
Token n1;
Type n2;
Identifier n3;
NodeToken n4;
Token n5;
NodeOptional n6 = new NodeOptional();
FormalParameterList n7;
NodeToken n8;
Token n9;
NodeToken n10;
Token n11;
NodeListOptional n12 = new NodeListOptional();
VarDeclaration n13;
NodeListOptional n14 = new NodeListOptional();
Statement n15;
NodeToken n16;
Token n17;
Expression n18;
NodeToken n19;
Token n20;
NodeToken n21;
Token n22;
n1 = jj_consume_token(PUBLIC);
n0 = JTBToolkit.makeNodeToken(n1);
n2 = Type();
n3 = Identifier();
n5 = jj_consume_token(LPAREN);
n4 = JTBToolkit.makeNodeToken(n5);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BOOLEAN:
case INTEGER:
case IDENTIFIER:
n7 = FormalParameterList();
n6.addNode(n7);
break;
default:
jj_la1[7] = jj_gen;
;
}
n9 = jj_consume_token(RPAREN);
n8 = JTBToolkit.makeNodeToken(n9);
n11 = jj_consume_token(LBRACE);
n10 = JTBToolkit.makeNodeToken(n11);
label_8:
while (true) {
if (jj_2_3(2)) {
;
} else {
break label_8;
}
n13 = VarDeclaration();
n12.addNode(n13);
}
n12.nodes.trimToSize();
label_9:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LBRACE:
case IF:
case WHILE:
case PRINT:
case IDENTIFIER:
;
break;
default:
jj_la1[8] = jj_gen;
break label_9;
}
n15 = Statement();
n14.addNode(n15);
}
n14.nodes.trimToSize();
n17 = jj_consume_token(RETURN);
n16 = JTBToolkit.makeNodeToken(n17);
n18 = Expression();
n20 = jj_consume_token(SEMICOLON);
n19 = JTBToolkit.makeNodeToken(n20);
n22 = jj_consume_token(RBRACE);
n21 = JTBToolkit.makeNodeToken(n22);
{if (true) return new MethodDeclaration(n0,n2,n3,n4,n6,n8,n10,n12,n14,n16,n18,n19,n21);}
throw new Error("Missing return statement in function");
}
final public FormalParameterList FormalParameterList() throws ParseException {
FormalParameter n0;
FormalParameterTail n1;
n0 = FormalParameter();
n1 = FormalParameterTail();
{if (true) return new FormalParameterList(n0,n1);}
throw new Error("Missing return statement in function");
}
final public FormalParameter FormalParameter() throws ParseException {
Type n0;
Identifier n1;
n0 = Type();
n1 = Identifier();
{if (true) return new FormalParameter(n0,n1);}
throw new Error("Missing return statement in function");
}
final public FormalParameterTail FormalParameterTail() throws ParseException {
NodeListOptional n0 = new NodeListOptional();
FormalParameterTerm n1;
label_10:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 47:
;
break;
default:
jj_la1[9] = jj_gen;
break label_10;
}
n1 = FormalParameterTerm();
n0.addNode(n1);
}
n0.nodes.trimToSize();
{if (true) return new FormalParameterTail(n0);}
throw new Error("Missing return statement in function");
}
final public FormalParameterTerm FormalParameterTerm() throws ParseException {
NodeToken n0;
Token n1;
FormalParameter n2;
n1 = jj_consume_token(47);
n0 = JTBToolkit.makeNodeToken(n1);
n2 = FormalParameter();
{if (true) return new FormalParameterTerm(n0,n2);}
throw new Error("Missing return statement in function");
}
final public Type Type() throws ParseException {
NodeChoice n0;
ArrayType n1;
BooleanType n2;
IntegerType n3;
Identifier n4;
if (jj_2_4(3)) {
n1 = ArrayType();
n0 = new NodeChoice(n1, 0);
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BOOLEAN:
n2 = BooleanType();
n0 = new NodeChoice(n2, 1);
break;
case INTEGER:
n3 = IntegerType();
n0 = new NodeChoice(n3, 2);
break;
case IDENTIFIER:
n4 = Identifier();
n0 = new NodeChoice(n4, 3);
break;
default:
jj_la1[10] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if (true) return new Type(n0);}
throw new Error("Missing return statement in function");
}
final public ArrayType ArrayType() throws ParseException {
NodeToken n0;
Token n1;
NodeToken n2;
Token n3;
NodeToken n4;
Token n5;
n1 = jj_consume_token(INTEGER);
n0 = JTBToolkit.makeNodeToken(n1);
n3 = jj_consume_token(LSQPAREN);
n2 = JTBToolkit.makeNodeToken(n3);
n5 = jj_consume_token(RSQPAREN);
n4 = JTBToolkit.makeNodeToken(n5);
{if (true) return new ArrayType(n0,n2,n4);}
throw new Error("Missing return statement in function");
}
final public BooleanType BooleanType() throws ParseException {
NodeToken n0;
Token n1;
n1 = jj_consume_token(BOOLEAN);
n0 = JTBToolkit.makeNodeToken(n1);
{if (true) return new BooleanType(n0);}
throw new Error("Missing return statement in function");
}
final public IntegerType IntegerType() throws ParseException {
NodeToken n0;
Token n1;
n1 = jj_consume_token(INTEGER);
n0 = JTBToolkit.makeNodeToken(n1);
{if (true) return new IntegerType(n0);}
throw new Error("Missing return statement in function");
}
final public Statement Statement() throws ParseException {
NodeChoice n0;
Block n1;
AssignmentStatement n2;
ArrayAssignmentStatement n3;
IfStatement n4;
WhileStatement n5;
PrintStatement n6;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LBRACE:
n1 = Block();
n0 = new NodeChoice(n1, 0);
break;
default:
jj_la1[11] = jj_gen;
if (jj_2_5(2)) {
n2 = AssignmentStatement();
n0 = new NodeChoice(n2, 1);
} else if (jj_2_6(2)) {
n3 = ArrayAssignmentStatement();
n0 = new NodeChoice(n3, 2);
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IF:
n4 = IfStatement();
n0 = new NodeChoice(n4, 3);
break;
case WHILE:
n5 = WhileStatement();
n0 = new NodeChoice(n5, 4);
break;
case PRINT:
n6 = PrintStatement();
n0 = new NodeChoice(n6, 5);
break;
default:
jj_la1[12] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
{if (true) return new Statement(n0);}
throw new Error("Missing return statement in function");
}
final public Block Block() throws ParseException {
NodeToken n0;
Token n1;
NodeListOptional n2 = new NodeListOptional();
Statement n3;
NodeToken n4;
Token n5;
n1 = jj_consume_token(LBRACE);
n0 = JTBToolkit.makeNodeToken(n1);
label_11:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LBRACE:
case IF:
case WHILE:
case PRINT:
case IDENTIFIER:
;
break;
default:
jj_la1[13] = jj_gen;
break label_11;
}
n3 = Statement();
n2.addNode(n3);
}
n2.nodes.trimToSize();
n5 = jj_consume_token(RBRACE);
n4 = JTBToolkit.makeNodeToken(n5);
{if (true) return new Block(n0,n2,n4);}
throw new Error("Missing return statement in function");
}
final public AssignmentStatement AssignmentStatement() throws ParseException {
Identifier n0;
NodeToken n1;
Token n2;
Expression n3;
NodeToken n4;
Token n5;
n0 = Identifier();
n2 = jj_consume_token(ASSIGN);
n1 = JTBToolkit.makeNodeToken(n2);
n3 = Expression();
n5 = jj_consume_token(SEMICOLON);
n4 = JTBToolkit.makeNodeToken(n5);
{if (true) return new AssignmentStatement(n0,n1,n3,n4);}
throw new Error("Missing return statement in function");
}
final public ArrayAssignmentStatement ArrayAssignmentStatement() throws ParseException {
Identifier n0;
NodeToken n1;
Token n2;
Expression n3;
NodeToken n4;
Token n5;
NodeToken n6;
Token n7;
Expression n8;
NodeToken n9;
Token n10;
n0 = Identifier();
n2 = jj_consume_token(LSQPAREN);
n1 = JTBToolkit.makeNodeToken(n2);
n3 = Expression();
n5 = jj_consume_token(RSQPAREN);
n4 = JTBToolkit.makeNodeToken(n5);
n7 = jj_consume_token(ASSIGN);
n6 = JTBToolkit.makeNodeToken(n7);
n8 = Expression();
n10 = jj_consume_token(SEMICOLON);
n9 = JTBToolkit.makeNodeToken(n10);
{if (true) return new ArrayAssignmentStatement(n0,n1,n3,n4,n6,n8,n9);}
throw new Error("Missing return statement in function");
}
final public IfStatement IfStatement() throws ParseException {
NodeToken n0;
Token n1;
NodeToken n2;
Token n3;
Expression n4;
NodeToken n5;
Token n6;
Statement n7;
NodeToken n8;
Token n9;
Statement n10;
n1 = jj_consume_token(IF);
n0 = JTBToolkit.makeNodeToken(n1);
n3 = jj_consume_token(LPAREN);
n2 = JTBToolkit.makeNodeToken(n3);
n4 = Expression();
n6 = jj_consume_token(RPAREN);
n5 = JTBToolkit.makeNodeToken(n6);
n7 = Statement();
n9 = jj_consume_token(ELSE);
n8 = JTBToolkit.makeNodeToken(n9);
n10 = Statement();
{if (true) return new IfStatement(n0,n2,n4,n5,n7,n8,n10);}
throw new Error("Missing return statement in function");
}
final public WhileStatement WhileStatement() throws ParseException {
NodeToken n0;
Token n1;
NodeToken n2;
Token n3;
Expression n4;
NodeToken n5;
Token n6;
Statement n7;
n1 = jj_consume_token(WHILE);
n0 = JTBToolkit.makeNodeToken(n1);
n3 = jj_consume_token(LPAREN);
n2 = JTBToolkit.makeNodeToken(n3);
n4 = Expression();
n6 = jj_consume_token(RPAREN);
n5 = JTBToolkit.makeNodeToken(n6);
n7 = Statement();
{if (true) return new WhileStatement(n0,n2,n4,n5,n7);}
throw new Error("Missing return statement in function");
}
final public PrintStatement PrintStatement() throws ParseException {
NodeToken n0;
Token n1;
NodeToken n2;
Token n3;
Expression n4;
NodeToken n5;
Token n6;
NodeToken n7;
Token n8;
n1 = jj_consume_token(PRINT);
n0 = JTBToolkit.makeNodeToken(n1);
n3 = jj_consume_token(LPAREN);
n2 = JTBToolkit.makeNodeToken(n3);
n4 = Expression();
n6 = jj_consume_token(RPAREN);
n5 = JTBToolkit.makeNodeToken(n6);
n8 = jj_consume_token(SEMICOLON);
n7 = JTBToolkit.makeNodeToken(n8);
{if (true) return new PrintStatement(n0,n2,n4,n5,n7);}
throw new Error("Missing return statement in function");
}
final public Expression Expression() throws ParseException {
NodeChoice n0;
AndExpression n1;
CompareExpression n2;
PlusExpression n3;
MinusExpression n4;
TimesExpression n5;
ArrayLookup n6;
ArrayLength n7;
MessageSend n8;
PrimaryExpression n9;
if (jj_2_7(2147483647)) {
n1 = AndExpression();
n0 = new NodeChoice(n1, 0);
} else if (jj_2_8(2147483647)) {
n2 = CompareExpression();
n0 = new NodeChoice(n2, 1);
} else if (jj_2_9(2147483647)) {
n3 = PlusExpression();
n0 = new NodeChoice(n3, 2);
} else if (jj_2_10(2147483647)) {
n4 = MinusExpression();
n0 = new NodeChoice(n4, 3);
} else if (jj_2_11(2147483647)) {
n5 = TimesExpression();
n0 = new NodeChoice(n5, 4);
} else if (jj_2_12(2147483647)) {
n6 = ArrayLookup();
n0 = new NodeChoice(n6, 5);
} else if (jj_2_13(2147483647)) {
n7 = ArrayLength();
n0 = new NodeChoice(n7, 6);
} else if (jj_2_14(2147483647)) {
n8 = MessageSend();
n0 = new NodeChoice(n8, 7);
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LPAREN:
case NOT:
case FALSE:
case NEW:
case THIS:
case TRUE:
case INTEGER_LITERAL:
case IDENTIFIER:
n9 = PrimaryExpression();
n0 = new NodeChoice(n9, 8);
break;
default:
jj_la1[14] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if (true) return new Expression(n0);}
throw new Error("Missing return statement in function");
}
final public AndExpression AndExpression() throws ParseException {
PrimaryExpression n0;
NodeToken n1;
Token n2;
PrimaryExpression n3;
n0 = PrimaryExpression();
n2 = jj_consume_token(AND);
n1 = JTBToolkit.makeNodeToken(n2);
n3 = PrimaryExpression();
{if (true) return new AndExpression(n0,n1,n3);}
throw new Error("Missing return statement in function");
}
final public CompareExpression CompareExpression() throws ParseException {
PrimaryExpression n0;
NodeToken n1;
Token n2;
PrimaryExpression n3;
n0 = PrimaryExpression();
n2 = jj_consume_token(LT);
n1 = JTBToolkit.makeNodeToken(n2);
n3 = PrimaryExpression();
{if (true) return new CompareExpression(n0,n1,n3);}
throw new Error("Missing return statement in function");
}
final public PlusExpression PlusExpression() throws ParseException {
PrimaryExpression n0;
NodeToken n1;
Token n2;
PrimaryExpression n3;
n0 = PrimaryExpression();
n2 = jj_consume_token(PLUS);
n1 = JTBToolkit.makeNodeToken(n2);
n3 = PrimaryExpression();
{if (true) return new PlusExpression(n0,n1,n3);}
throw new Error("Missing return statement in function");
}
final public MinusExpression MinusExpression() throws ParseException {
PrimaryExpression n0;
NodeToken n1;
Token n2;
PrimaryExpression n3;
n0 = PrimaryExpression();
n2 = jj_consume_token(MINUS);
n1 = JTBToolkit.makeNodeToken(n2);
n3 = PrimaryExpression();
{if (true) return new MinusExpression(n0,n1,n3);}
throw new Error("Missing return statement in function");
}
final public TimesExpression TimesExpression() throws ParseException {
PrimaryExpression n0;
NodeToken n1;
Token n2;
PrimaryExpression n3;
n0 = PrimaryExpression();
n2 = jj_consume_token(48);
n1 = JTBToolkit.makeNodeToken(n2);
n3 = PrimaryExpression();
{if (true) return new TimesExpression(n0,n1,n3);}
throw new Error("Missing return statement in function");
}
final public ArrayLookup ArrayLookup() throws ParseException {
PrimaryExpression n0;
NodeToken n1;
Token n2;
PrimaryExpression n3;
NodeToken n4;
Token n5;
n0 = PrimaryExpression();
n2 = jj_consume_token(LSQPAREN);
n1 = JTBToolkit.makeNodeToken(n2);
n3 = PrimaryExpression();
n5 = jj_consume_token(RSQPAREN);
n4 = JTBToolkit.makeNodeToken(n5);
{if (true) return new ArrayLookup(n0,n1,n3,n4);}
throw new Error("Missing return statement in function");
}
final public ArrayLength ArrayLength() throws ParseException {
PrimaryExpression n0;
NodeToken n1;
Token n2;
NodeToken n3;
Token n4;
n0 = PrimaryExpression();
n2 = jj_consume_token(DOT);
n1 = JTBToolkit.makeNodeToken(n2);
n4 = jj_consume_token(LENGTH);
n3 = JTBToolkit.makeNodeToken(n4);
{if (true) return new ArrayLength(n0,n1,n3);}
throw new Error("Missing return statement in function");
}
final public MessageSend MessageSend() throws ParseException {
PrimaryExpression n0;
NodeToken n1;
Token n2;
Identifier n3;
NodeToken n4;
Token n5;
NodeOptional n6 = new NodeOptional();
ExpressionList n7;
NodeToken n8;
Token n9;
n0 = PrimaryExpression();
n2 = jj_consume_token(DOT);
n1 = JTBToolkit.makeNodeToken(n2);
n3 = Identifier();
n5 = jj_consume_token(LPAREN);
n4 = JTBToolkit.makeNodeToken(n5);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LPAREN:
case NOT:
case FALSE:
case NEW:
case THIS:
case TRUE:
case INTEGER_LITERAL:
case IDENTIFIER:
n7 = ExpressionList();
n6.addNode(n7);
break;
default:
jj_la1[15] = jj_gen;
;
}
n9 = jj_consume_token(RPAREN);
n8 = JTBToolkit.makeNodeToken(n9);
{if (true) return new MessageSend(n0,n1,n3,n4,n6,n8);}
throw new Error("Missing return statement in function");
}
final public ExpressionList ExpressionList() throws ParseException {
Expression n0;
ExpressionTail n1;
n0 = Expression();
n1 = ExpressionTail();
{if (true) return new ExpressionList(n0,n1);}
throw new Error("Missing return statement in function");
}
final public ExpressionTail ExpressionTail() throws ParseException {
NodeListOptional n0 = new NodeListOptional();
ExpressionTerm n1;
label_12:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 47:
;
break;
default:
jj_la1[16] = jj_gen;
break label_12;
}
n1 = ExpressionTerm();
n0.addNode(n1);
}
n0.nodes.trimToSize();
{if (true) return new ExpressionTail(n0);}
throw new Error("Missing return statement in function");
}
final public ExpressionTerm ExpressionTerm() throws ParseException {
NodeToken n0;
Token n1;
Expression n2;
n1 = jj_consume_token(47);
n0 = JTBToolkit.makeNodeToken(n1);
n2 = Expression();
{if (true) return new ExpressionTerm(n0,n2);}
throw new Error("Missing return statement in function");
}
final public PrimaryExpression PrimaryExpression() throws ParseException {
NodeChoice n0;
IntegerLiteral n1;
TrueLiteral n2;
FalseLiteral n3;
Identifier n4;
ThisExpression n5;
ArrayAllocationExpression n6;
AllocationExpression n7;
NotExpression n8;
BracketExpression n9;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case INTEGER_LITERAL:
n1 = IntegerLiteral();
n0 = new NodeChoice(n1, 0);
break;
case TRUE:
n2 = TrueLiteral();
n0 = new NodeChoice(n2, 1);
break;
case FALSE:
n3 = FalseLiteral();
n0 = new NodeChoice(n3, 2);
break;
case IDENTIFIER:
n4 = Identifier();
n0 = new NodeChoice(n4, 3);
break;
case THIS:
n5 = ThisExpression();
n0 = new NodeChoice(n5, 4);
break;
default:
jj_la1[17] = jj_gen;
if (jj_2_15(3)) {
n6 = ArrayAllocationExpression();
n0 = new NodeChoice(n6, 5);
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NEW:
n7 = AllocationExpression();
n0 = new NodeChoice(n7, 6);
break;
case NOT:
n8 = NotExpression();
n0 = new NodeChoice(n8, 7);
break;
case LPAREN:
n9 = BracketExpression();
n0 = new NodeChoice(n9, 8);
break;
default:
jj_la1[18] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
{if (true) return new PrimaryExpression(n0);}
throw new Error("Missing return statement in function");
}
final public IntegerLiteral IntegerLiteral() throws ParseException {
NodeToken n0;
Token n1;
n1 = jj_consume_token(INTEGER_LITERAL);
n0 = JTBToolkit.makeNodeToken(n1);
{if (true) return new IntegerLiteral(n0);}
throw new Error("Missing return statement in function");
}
final public TrueLiteral TrueLiteral() throws ParseException {
NodeToken n0;
Token n1;
n1 = jj_consume_token(TRUE);
n0 = JTBToolkit.makeNodeToken(n1);
{if (true) return new TrueLiteral(n0);}
throw new Error("Missing return statement in function");
}
final public FalseLiteral FalseLiteral() throws ParseException {
NodeToken n0;
Token n1;
n1 = jj_consume_token(FALSE);
n0 = JTBToolkit.makeNodeToken(n1);
{if (true) return new FalseLiteral(n0);}
throw new Error("Missing return statement in function");