/jEdit/tags/jedit-4-2-pre4/bsh/Parser.java
Java | 2298 lines | 2096 code | 62 blank | 140 comment | 265 complexity | 5bf1ebd4005fc0aade8cb6d68d86bf40 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
Large files files are truncated, but you can click here to view the full file
1/* Generated By:JJTree&JavaCC: Do not edit this line. Parser.java */
2package bsh;
3
4import java.io.*;
5import java.util.Vector;
6
7/**
8 This is the BeanShell parser. It is used internally by the Interpreter
9 class (which is probably what you are looking for). The parser knows
10 only how to parse the structure of the language, it does not understand
11 names, commands, etc.
12 <p>
13 You can use the Parser from the command line to do basic structural
14 validation of BeanShell files without actually executing them. e.g.
15 <code><pre>
16 java bsh.Parser [ -p ] file [ file ] [ ... ]
17 </pre></code>
18 <p>
19 The -p option causes the abstract syntax to be printed.
20 <p>
21
22 From code you'd use the Parser like this:
23 <p
24 <code><pre>
25 Parser parser = new Parser(in);
26 while( !(eof=parser.Line()) ) {
27 SimpleNode node = parser.popNode();
28 // use the node, etc. (See bsh.BSH* classes)
29 }
30 </pre></code>
31*/
32public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants, ParserConstants {/*@bgen(jjtree)*/
33 protected JJTParserState jjtree = new JJTParserState();boolean retainComments = false;
34
35 public void setRetainComments( boolean b ) {
36 retainComments = b;
37 }
38
39 void jjtreeOpenNodeScope(Node n) {
40 ((SimpleNode)n).firstToken = getToken(1);
41 }
42
43 void jjtreeCloseNodeScope(Node n) {
44 ((SimpleNode)n).lastToken = getToken(0);
45 }
46
47 /**
48 Re-initialize the input stream and token source.
49 */
50 void reInitInput( Reader in ) {
51 ReInit(in);
52 }
53
54 public SimpleNode popNode()
55 {
56 if ( jjtree.nodeArity() > 0) // number of child nodes
57 return (SimpleNode)jjtree.popNode();
58 else
59 return null;
60 }
61
62 /**
63 Explicitly re-initialize just the token reader.
64 This seems to be necessary to avoid certain looping errors when
65 reading bogus input. See Interpreter.
66 */
67 void reInitTokenInput( Reader in ) {
68 jj_input_stream.ReInit( in,
69 jj_input_stream.getEndLine(),
70 jj_input_stream.getEndColumn() );
71 }
72
73 public static void main( String [] args )
74 throws IOException, ParseException
75 {
76 boolean print = false;
77 int i=0;
78 if ( args[0].equals("-p") ) {
79 i++;
80 print=true;
81 }
82 for(; i< args.length; i++) {
83 Reader in = new FileReader(args[i]);
84 Parser parser = new Parser(in);
85 parser.setRetainComments(true);
86 while( !parser.Line()/*eof*/ )
87 if ( print )
88 System.out.println( parser.popNode() );
89 }
90 }
91
92 /**
93 Lookahead for the enhanced for statement.
94 Expect "for" "(" and then see whether we hit ":" or a ";" first.
95 */
96 boolean isRegularForStatement()
97 {
98 int curTok = 1;
99 Token tok;
100 tok = getToken(curTok++);
101 if ( tok.kind != FOR ) return false;
102 tok = getToken(curTok++);
103 if ( tok.kind != LPAREN ) return false;
104 while (true)
105 {
106 tok = getToken(curTok++);
107 switch (tok.kind) {
108 case COLON:
109 return false;
110 case SEMICOLON:
111 return true;
112 case EOF:
113 return false;
114 }
115 }
116 }
117
118 /**
119 Lookahead to determine whether a method has a return type.
120
121 // Case 1 - primitive or void
122 [ void, boolean, char, ... ] foo() { }
123 byte [] foo() { }
124
125 // Case 2 - simple type name
126 Foo foo () { }
127 Foo [] foo () { }
128
129 // Case 3 - compound type name
130 foo.Foo foo () { }
131 foo.Foo [] foo () { }
132
133 // Case 4 - Parameterized return type?
134 // ??
135
136 // Case N - no type
137 foo () { }
138 */
139 /*
140 Note: it's important not to read ahead tokens (e.g. tok2) unless
141 previous ones match. We're used in lookaheads and if we have to wait
142 for tokens that couldn't match it messes up interactivity on the
143 command line.
144 */
145 boolean methodHasReturnType()
146 {
147 Token tok1 = getToken(1), tok2=null;
148
149 // Case 1
150 if ( tok1.kind == VOID || tok1.kind == BOOLEAN || tok1.kind == CHAR
151 || tok1.kind == BYTE || tok1.kind == SHORT || tok1.kind == INT
152 || tok1.kind == LONG || tok1.kind == FLOAT || tok1.kind == DOUBLE
153 )
154 return true;
155
156 // Case 2
157 if ( tok1.kind == IDENTIFIER && (tok2=getToken(2)).kind == LBRACKET )
158 return true;
159 if ( tok1.kind == IDENTIFIER && tok2.kind == IDENTIFIER
160 && getToken(3).kind == LPAREN )
161 return true;
162
163 // Case 3
164 if ( tok1.kind == IDENTIFIER && tok2.kind == DOT )
165 return true;
166
167 // Case N
168 return false;
169 }
170
171 /**
172 Generate a ParseException with the specified message, pointing to the
173 current token.
174 The auto-generated Parser.generateParseException() method does not
175 provide line number info, therefore we do this.
176 */
177 ParseException createParseException( String message )
178 {
179 Token errortok = token;
180 int line = errortok.beginLine, column = errortok.beginColumn;
181 String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image;
182 return new ParseException( "Parse error at line " + line
183 + ", column " + column + " : " + message );
184 }
185
186/*
187 Thanks to Sreenivasa Viswanadha for suggesting how to get rid of expensive
188 lookahead here.
189*/
190 final public boolean Line() throws ParseException {
191 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
192 case 0:
193 jj_consume_token(0);
194 Interpreter.debug("End of File!");
195 {if (true) return true;}
196 break;
197 default:
198 if (jj_2_1(1)) {
199 BlockStatement();
200 {if (true) return false;}
201 } else {
202 jj_consume_token(-1);
203 throw new ParseException();
204 }
205 }
206 throw new Error("Missing return statement in function");
207 }
208
209/*****************************************
210 * THE JAVA LANGUAGE GRAMMAR STARTS HERE *
211 *****************************************/
212
213/*
214 Gather modifiers for a class, method, or field.
215 I lookahead is true then we are being called as part of a lookahead and we
216 should not enforce any rules. Otherwise we validate based on context
217 (field, method, class)
218*/
219 final public Modifiers Modifiers(int context, boolean lookahead) throws ParseException {
220 Modifiers mods = null;
221 label_1:
222 while (true) {
223 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
224 case ABSTRACT:
225 case FINAL:
226 case NATIVE:
227 case PRIVATE:
228 case PROTECTED:
229 case PUBLIC:
230 case STATIC:
231 case STRICTFP:
232 case SYNCHRONIZED:
233 case TRANSIENT:
234 case VOLATILE:
235 ;
236 break;
237 default:
238 break label_1;
239 }
240 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
241 case PRIVATE:
242 jj_consume_token(PRIVATE);
243 break;
244 case PROTECTED:
245 jj_consume_token(PROTECTED);
246 break;
247 case PUBLIC:
248 jj_consume_token(PUBLIC);
249 break;
250 case SYNCHRONIZED:
251 jj_consume_token(SYNCHRONIZED);
252 break;
253 case FINAL:
254 jj_consume_token(FINAL);
255 break;
256 case NATIVE:
257 jj_consume_token(NATIVE);
258 break;
259 case TRANSIENT:
260 jj_consume_token(TRANSIENT);
261 break;
262 case VOLATILE:
263 jj_consume_token(VOLATILE);
264 break;
265 case ABSTRACT:
266 jj_consume_token(ABSTRACT);
267 break;
268 case STATIC:
269 jj_consume_token(STATIC);
270 break;
271 case STRICTFP:
272 jj_consume_token(STRICTFP);
273 break;
274 default:
275 jj_consume_token(-1);
276 throw new ParseException();
277 }
278 if ( !lookahead )
279 try {
280 if ( mods == null ) mods = new Modifiers();
281 mods.addModifier( context, getToken(0).image );
282 } catch ( IllegalStateException e ) {
283 {if (true) throw createParseException( e.getMessage() );}
284 }
285 }
286 {if (true) return mods;}
287 throw new Error("Missing return statement in function");
288 }
289
290/**
291*/
292 final public void ClassDeclaration() throws ParseException {
293 /*@bgen(jjtree) ClassDeclaration */
294 BSHClassDeclaration jjtn000 = new BSHClassDeclaration(JJTCLASSDECLARATION);
295 boolean jjtc000 = true;
296 jjtree.openNodeScope(jjtn000);
297 jjtreeOpenNodeScope(jjtn000);Modifiers mods;
298 Token t;
299 int numInterfaces;
300 try {
301 mods = Modifiers(Modifiers.CLASS, false);
302 jj_consume_token(CLASS);
303 t = jj_consume_token(IDENTIFIER);
304 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
305 case EXTENDS:
306 jj_consume_token(EXTENDS);
307 AmbiguousName();
308 jjtn000.extend = true;
309 break;
310 default:
311 ;
312 }
313 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
314 case IMPLEMENTS:
315 jj_consume_token(IMPLEMENTS);
316 numInterfaces = NameList();
317 jjtn000.numInterfaces=numInterfaces;
318 break;
319 default:
320 ;
321 }
322 Block();
323 jjtree.closeNodeScope(jjtn000, true);
324 jjtc000 = false;
325 jjtreeCloseNodeScope(jjtn000);
326 jjtn000.modifiers = mods;
327 jjtn000.name = t.image;
328 } catch (Throwable jjte000) {
329 if (jjtc000) {
330 jjtree.clearNodeScope(jjtn000);
331 jjtc000 = false;
332 } else {
333 jjtree.popNode();
334 }
335 if (jjte000 instanceof RuntimeException) {
336 {if (true) throw (RuntimeException)jjte000;}
337 }
338 if (jjte000 instanceof ParseException) {
339 {if (true) throw (ParseException)jjte000;}
340 }
341 {if (true) throw (Error)jjte000;}
342 } finally {
343 if (jjtc000) {
344 jjtree.closeNodeScope(jjtn000, true);
345 jjtreeCloseNodeScope(jjtn000);
346 }
347 }
348 }
349
350 final public void MethodDeclaration() throws ParseException {
351 /*@bgen(jjtree) MethodDeclaration */
352 BSHMethodDeclaration jjtn000 = new BSHMethodDeclaration(JJTMETHODDECLARATION);
353 boolean jjtc000 = true;
354 jjtree.openNodeScope(jjtn000);
355 jjtreeOpenNodeScope(jjtn000);Token t = null;
356 Modifiers mods;
357 int count;
358 try {
359 mods = Modifiers(Modifiers.METHOD, false);
360 jjtn000.modifiers = mods;
361 if (methodHasReturnType()) {
362 ReturnType();
363 } else {
364 ;
365 }
366 t = jj_consume_token(IDENTIFIER);
367 jjtn000.name = t.image;
368 FormalParameters();
369 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
370 case THROWS:
371 jj_consume_token(THROWS);
372 count = NameList();
373 jjtn000.numThrows=count;
374 break;
375 default:
376 ;
377 }
378 Block();
379 } catch (Throwable jjte000) {
380 if (jjtc000) {
381 jjtree.clearNodeScope(jjtn000);
382 jjtc000 = false;
383 } else {
384 jjtree.popNode();
385 }
386 if (jjte000 instanceof RuntimeException) {
387 {if (true) throw (RuntimeException)jjte000;}
388 }
389 if (jjte000 instanceof ParseException) {
390 {if (true) throw (ParseException)jjte000;}
391 }
392 {if (true) throw (Error)jjte000;}
393 } finally {
394 if (jjtc000) {
395 jjtree.closeNodeScope(jjtn000, true);
396 jjtreeCloseNodeScope(jjtn000);
397 }
398 }
399 }
400
401/**
402 It's tempting to collapse this to one like like so:
403
404 [ LOOKAHEAD( { methodHasReturnType() } ) ReturnType() ]
405 <IDENTIFIER> FormalParameters() "{"
406
407 However this doesn't work because nested lookaheads are not evaluated
408 during lookahead!
409 http://www.engr.mun.ca/~theo/JavaCC-FAQ/javacc-faq.htm#tth_sEc4.9
410*/
411 final public void MethodDeclarationLookahead() throws ParseException {
412 Modifiers(Modifiers.METHOD, true);
413 if (methodHasReturnType()) {
414 ReturnType();
415 jj_consume_token(IDENTIFIER);
416 FormalParameters();
417 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
418 case THROWS:
419 jj_consume_token(THROWS);
420 NameList();
421 break;
422 default:
423 ;
424 }
425 jj_consume_token(LBRACE);
426 } else {
427 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
428 case IDENTIFIER:
429 jj_consume_token(IDENTIFIER);
430 FormalParameters();
431 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
432 case THROWS:
433 jj_consume_token(THROWS);
434 NameList();
435 break;
436 default:
437 ;
438 }
439 jj_consume_token(LBRACE);
440 break;
441 default:
442 jj_consume_token(-1);
443 throw new ParseException();
444 }
445 }
446 }
447
448 final public void ImportDeclaration() throws ParseException {
449 /*@bgen(jjtree) ImportDeclaration */
450 BSHImportDeclaration jjtn000 = new BSHImportDeclaration(JJTIMPORTDECLARATION);
451 boolean jjtc000 = true;
452 jjtree.openNodeScope(jjtn000);
453 jjtreeOpenNodeScope(jjtn000);Token t = null;
454 try {
455 if (jj_2_2(2)) {
456 jj_consume_token(IMPORT);
457 AmbiguousName();
458 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
459 case DOT:
460 t = jj_consume_token(DOT);
461 jj_consume_token(STAR);
462 break;
463 default:
464 ;
465 }
466 jj_consume_token(SEMICOLON);
467 jjtree.closeNodeScope(jjtn000, true);
468 jjtc000 = false;
469 jjtreeCloseNodeScope(jjtn000);
470 if ( t != null )
471 jjtn000.importPackage = true;
472 } else {
473 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
474 case IMPORT:
475 jj_consume_token(IMPORT);
476 jj_consume_token(STAR);
477 jj_consume_token(SEMICOLON);
478 jjtree.closeNodeScope(jjtn000, true);
479 jjtc000 = false;
480 jjtreeCloseNodeScope(jjtn000);
481 jjtn000.superImport = true;
482 break;
483 default:
484 jj_consume_token(-1);
485 throw new ParseException();
486 }
487 }
488 } catch (Throwable jjte000) {
489 if (jjtc000) {
490 jjtree.clearNodeScope(jjtn000);
491 jjtc000 = false;
492 } else {
493 jjtree.popNode();
494 }
495 if (jjte000 instanceof RuntimeException) {
496 {if (true) throw (RuntimeException)jjte000;}
497 }
498 if (jjte000 instanceof ParseException) {
499 {if (true) throw (ParseException)jjte000;}
500 }
501 {if (true) throw (Error)jjte000;}
502 } finally {
503 if (jjtc000) {
504 jjtree.closeNodeScope(jjtn000, true);
505 jjtreeCloseNodeScope(jjtn000);
506 }
507 }
508 }
509
510 final public void VariableDeclarator() throws ParseException {
511 /*@bgen(jjtree) VariableDeclarator */
512 BSHVariableDeclarator jjtn000 = new BSHVariableDeclarator(JJTVARIABLEDECLARATOR);
513 boolean jjtc000 = true;
514 jjtree.openNodeScope(jjtn000);
515 jjtreeOpenNodeScope(jjtn000);Token t;
516 Modifiers mods;
517 try {
518 t = jj_consume_token(IDENTIFIER);
519 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
520 case ASSIGN:
521 jj_consume_token(ASSIGN);
522 VariableInitializer();
523 break;
524 default:
525 ;
526 }
527 jjtree.closeNodeScope(jjtn000, true);
528 jjtc000 = false;
529 jjtreeCloseNodeScope(jjtn000);
530 jjtn000.name = t.image;
531 } catch (Throwable jjte000) {
532 if (jjtc000) {
533 jjtree.clearNodeScope(jjtn000);
534 jjtc000 = false;
535 } else {
536 jjtree.popNode();
537 }
538 if (jjte000 instanceof RuntimeException) {
539 {if (true) throw (RuntimeException)jjte000;}
540 }
541 if (jjte000 instanceof ParseException) {
542 {if (true) throw (ParseException)jjte000;}
543 }
544 {if (true) throw (Error)jjte000;}
545 } finally {
546 if (jjtc000) {
547 jjtree.closeNodeScope(jjtn000, true);
548 jjtreeCloseNodeScope(jjtn000);
549 }
550 }
551 }
552
553/*
554Can get rid of this if we ignore postfix array dimensions in declarations.
555I don't like them and I don't want to deal with them right now.
556
557void VariableDeclaratorId() #VariableDeclaratorId :
558{ Token t; }
559{
560 t=<IDENTIFIER> { jjtThis.name = t.image; }
561 ( "[" "]" { jjtThis.addUndefinedDimension(); } )*
562}
563*/
564 final public void VariableInitializer() throws ParseException {
565 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
566 case LBRACE:
567 ArrayInitializer();
568 break;
569 case BOOLEAN:
570 case BYTE:
571 case CHAR:
572 case DOUBLE:
573 case FALSE:
574 case FLOAT:
575 case INT:
576 case LONG:
577 case NEW:
578 case NULL:
579 case SHORT:
580 case TRUE:
581 case VOID:
582 case INTEGER_LITERAL:
583 case FLOATING_POINT_LITERAL:
584 case CHARACTER_LITERAL:
585 case STRING_LITERAL:
586 case IDENTIFIER:
587 case LPAREN:
588 case BANG:
589 case TILDE:
590 case INCR:
591 case DECR:
592 case PLUS:
593 case MINUS:
594 Expression();
595 break;
596 default:
597 jj_consume_token(-1);
598 throw new ParseException();
599 }
600 }
601
602 final public void ArrayInitializer() throws ParseException {
603 /*@bgen(jjtree) ArrayInitializer */
604 BSHArrayInitializer jjtn000 = new BSHArrayInitializer(JJTARRAYINITIALIZER);
605 boolean jjtc000 = true;
606 jjtree.openNodeScope(jjtn000);
607 jjtreeOpenNodeScope(jjtn000);
608 try {
609 jj_consume_token(LBRACE);
610 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
611 case BOOLEAN:
612 case BYTE:
613 case CHAR:
614 case DOUBLE:
615 case FALSE:
616 case FLOAT:
617 case INT:
618 case LONG:
619 case NEW:
620 case NULL:
621 case SHORT:
622 case TRUE:
623 case VOID:
624 case INTEGER_LITERAL:
625 case FLOATING_POINT_LITERAL:
626 case CHARACTER_LITERAL:
627 case STRING_LITERAL:
628 case IDENTIFIER:
629 case LPAREN:
630 case LBRACE:
631 case BANG:
632 case TILDE:
633 case INCR:
634 case DECR:
635 case PLUS:
636 case MINUS:
637 VariableInitializer();
638 label_2:
639 while (true) {
640 if (jj_2_3(2)) {
641 ;
642 } else {
643 break label_2;
644 }
645 jj_consume_token(COMMA);
646 VariableInitializer();
647 }
648 break;
649 default:
650 ;
651 }
652 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
653 case COMMA:
654 jj_consume_token(COMMA);
655 break;
656 default:
657 ;
658 }
659 jj_consume_token(RBRACE);
660 } catch (Throwable jjte000) {
661 if (jjtc000) {
662 jjtree.clearNodeScope(jjtn000);
663 jjtc000 = false;
664 } else {
665 jjtree.popNode();
666 }
667 if (jjte000 instanceof RuntimeException) {
668 {if (true) throw (RuntimeException)jjte000;}
669 }
670 if (jjte000 instanceof ParseException) {
671 {if (true) throw (ParseException)jjte000;}
672 }
673 {if (true) throw (Error)jjte000;}
674 } finally {
675 if (jjtc000) {
676 jjtree.closeNodeScope(jjtn000, true);
677 jjtreeCloseNodeScope(jjtn000);
678 }
679 }
680 }
681
682 final public void FormalParameters() throws ParseException {
683 /*@bgen(jjtree) FormalParameters */
684 BSHFormalParameters jjtn000 = new BSHFormalParameters(JJTFORMALPARAMETERS);
685 boolean jjtc000 = true;
686 jjtree.openNodeScope(jjtn000);
687 jjtreeOpenNodeScope(jjtn000);
688 try {
689 jj_consume_token(LPAREN);
690 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
691 case BOOLEAN:
692 case BYTE:
693 case CHAR:
694 case DOUBLE:
695 case FLOAT:
696 case INT:
697 case LONG:
698 case SHORT:
699 case IDENTIFIER:
700 FormalParameter();
701 label_3:
702 while (true) {
703 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
704 case COMMA:
705 ;
706 break;
707 default:
708 break label_3;
709 }
710 jj_consume_token(COMMA);
711 FormalParameter();
712 }
713 break;
714 default:
715 ;
716 }
717 jj_consume_token(RPAREN);
718 } catch (Throwable jjte000) {
719 if (jjtc000) {
720 jjtree.clearNodeScope(jjtn000);
721 jjtc000 = false;
722 } else {
723 jjtree.popNode();
724 }
725 if (jjte000 instanceof RuntimeException) {
726 {if (true) throw (RuntimeException)jjte000;}
727 }
728 if (jjte000 instanceof ParseException) {
729 {if (true) throw (ParseException)jjte000;}
730 }
731 {if (true) throw (Error)jjte000;}
732 } finally {
733 if (jjtc000) {
734 jjtree.closeNodeScope(jjtn000, true);
735 jjtreeCloseNodeScope(jjtn000);
736 }
737 }
738 }
739
740 final public void FormalParameter() throws ParseException {
741 /*@bgen(jjtree) FormalParameter */
742 BSHFormalParameter jjtn000 = new BSHFormalParameter(JJTFORMALPARAMETER);
743 boolean jjtc000 = true;
744 jjtree.openNodeScope(jjtn000);
745 jjtreeOpenNodeScope(jjtn000);Token t;
746 try {
747 if (jj_2_4(2)) {
748 Type();
749 t = jj_consume_token(IDENTIFIER);
750 jjtree.closeNodeScope(jjtn000, true);
751 jjtc000 = false;
752 jjtreeCloseNodeScope(jjtn000);
753 jjtn000.name = t.image;
754 } else {
755 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
756 case IDENTIFIER:
757 t = jj_consume_token(IDENTIFIER);
758 jjtree.closeNodeScope(jjtn000, true);
759 jjtc000 = false;
760 jjtreeCloseNodeScope(jjtn000);
761 jjtn000.name = t.image;
762 break;
763 default:
764 jj_consume_token(-1);
765 throw new ParseException();
766 }
767 }
768 } catch (Throwable jjte000) {
769 if (jjtc000) {
770 jjtree.clearNodeScope(jjtn000);
771 jjtc000 = false;
772 } else {
773 jjtree.popNode();
774 }
775 if (jjte000 instanceof RuntimeException) {
776 {if (true) throw (RuntimeException)jjte000;}
777 }
778 if (jjte000 instanceof ParseException) {
779 {if (true) throw (ParseException)jjte000;}
780 }
781 {if (true) throw (Error)jjte000;}
782 } finally {
783 if (jjtc000) {
784 jjtree.closeNodeScope(jjtn000, true);
785 jjtreeCloseNodeScope(jjtn000);
786 }
787 }
788 }
789
790/*
791 Type, name and expression syntax follows.
792*/
793 final public void Type() throws ParseException {
794 /*@bgen(jjtree) Type */
795 BSHType jjtn000 = new BSHType(JJTTYPE);
796 boolean jjtc000 = true;
797 jjtree.openNodeScope(jjtn000);
798 jjtreeOpenNodeScope(jjtn000);
799 try {
800 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
801 case BOOLEAN:
802 case BYTE:
803 case CHAR:
804 case DOUBLE:
805 case FLOAT:
806 case INT:
807 case LONG:
808 case SHORT:
809 PrimitiveType();
810 break;
811 case IDENTIFIER:
812 AmbiguousName();
813 break;
814 default:
815 jj_consume_token(-1);
816 throw new ParseException();
817 }
818 label_4:
819 while (true) {
820 if (jj_2_5(2)) {
821 ;
822 } else {
823 break label_4;
824 }
825 jj_consume_token(LBRACKET);
826 jj_consume_token(RBRACKET);
827 jjtn000.addArrayDimension();
828 }
829 } catch (Throwable jjte000) {
830 if (jjtc000) {
831 jjtree.clearNodeScope(jjtn000);
832 jjtc000 = false;
833 } else {
834 jjtree.popNode();
835 }
836 if (jjte000 instanceof RuntimeException) {
837 {if (true) throw (RuntimeException)jjte000;}
838 }
839 if (jjte000 instanceof ParseException) {
840 {if (true) throw (ParseException)jjte000;}
841 }
842 {if (true) throw (Error)jjte000;}
843 } finally {
844 if (jjtc000) {
845 jjtree.closeNodeScope(jjtn000, true);
846 jjtreeCloseNodeScope(jjtn000);
847 }
848 }
849 }
850
851/*
852 Originally called ResultType in the grammar
853*/
854 final public void ReturnType() throws ParseException {
855 /*@bgen(jjtree) ReturnType */
856 BSHReturnType jjtn000 = new BSHReturnType(JJTRETURNTYPE);
857 boolean jjtc000 = true;
858 jjtree.openNodeScope(jjtn000);
859 jjtreeOpenNodeScope(jjtn000);
860 try {
861 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
862 case VOID:
863 jj_consume_token(VOID);
864 jjtree.closeNodeScope(jjtn000, true);
865 jjtc000 = false;
866 jjtreeCloseNodeScope(jjtn000);
867 jjtn000.isVoid = true;
868 break;
869 case BOOLEAN:
870 case BYTE:
871 case CHAR:
872 case DOUBLE:
873 case FLOAT:
874 case INT:
875 case LONG:
876 case SHORT:
877 case IDENTIFIER:
878 Type();
879 break;
880 default:
881 jj_consume_token(-1);
882 throw new ParseException();
883 }
884 } catch (Throwable jjte000) {
885 if (jjtc000) {
886 jjtree.clearNodeScope(jjtn000);
887 jjtc000 = false;
888 } else {
889 jjtree.popNode();
890 }
891 if (jjte000 instanceof RuntimeException) {
892 {if (true) throw (RuntimeException)jjte000;}
893 }
894 if (jjte000 instanceof ParseException) {
895 {if (true) throw (ParseException)jjte000;}
896 }
897 {if (true) throw (Error)jjte000;}
898 } finally {
899 if (jjtc000) {
900 jjtree.closeNodeScope(jjtn000, true);
901 jjtreeCloseNodeScope(jjtn000);
902 }
903 }
904 }
905
906 final public void PrimitiveType() throws ParseException {
907 /*@bgen(jjtree) PrimitiveType */
908 BSHPrimitiveType jjtn000 = new BSHPrimitiveType(JJTPRIMITIVETYPE);
909 boolean jjtc000 = true;
910 jjtree.openNodeScope(jjtn000);
911 jjtreeOpenNodeScope(jjtn000);
912 try {
913 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
914 case BOOLEAN:
915 jj_consume_token(BOOLEAN);
916 jjtree.closeNodeScope(jjtn000, true);
917 jjtc000 = false;
918 jjtreeCloseNodeScope(jjtn000);
919 jjtn000.type = Boolean.TYPE;
920 break;
921 case CHAR:
922 jj_consume_token(CHAR);
923 jjtree.closeNodeScope(jjtn000, true);
924 jjtc000 = false;
925 jjtreeCloseNodeScope(jjtn000);
926 jjtn000.type = Character.TYPE;
927 break;
928 case BYTE:
929 jj_consume_token(BYTE);
930 jjtree.closeNodeScope(jjtn000, true);
931 jjtc000 = false;
932 jjtreeCloseNodeScope(jjtn000);
933 jjtn000.type = Byte.TYPE;
934 break;
935 case SHORT:
936 jj_consume_token(SHORT);
937 jjtree.closeNodeScope(jjtn000, true);
938 jjtc000 = false;
939 jjtreeCloseNodeScope(jjtn000);
940 jjtn000.type = Short.TYPE;
941 break;
942 case INT:
943 jj_consume_token(INT);
944 jjtree.closeNodeScope(jjtn000, true);
945 jjtc000 = false;
946 jjtreeCloseNodeScope(jjtn000);
947 jjtn000.type = Integer.TYPE;
948 break;
949 case LONG:
950 jj_consume_token(LONG);
951 jjtree.closeNodeScope(jjtn000, true);
952 jjtc000 = false;
953 jjtreeCloseNodeScope(jjtn000);
954 jjtn000.type = Long.TYPE;
955 break;
956 case FLOAT:
957 jj_consume_token(FLOAT);
958 jjtree.closeNodeScope(jjtn000, true);
959 jjtc000 = false;
960 jjtreeCloseNodeScope(jjtn000);
961 jjtn000.type = Float.TYPE;
962 break;
963 case DOUBLE:
964 jj_consume_token(DOUBLE);
965 jjtree.closeNodeScope(jjtn000, true);
966 jjtc000 = false;
967 jjtreeCloseNodeScope(jjtn000);
968 jjtn000.type = Double.TYPE;
969 break;
970 default:
971 jj_consume_token(-1);
972 throw new ParseException();
973 }
974 } finally {
975 if (jjtc000) {
976 jjtree.closeNodeScope(jjtn000, true);
977 jjtreeCloseNodeScope(jjtn000);
978 }
979 }
980 }
981
982 final public void AmbiguousName() throws ParseException {
983 /*@bgen(jjtree) AmbiguousName */
984 BSHAmbiguousName jjtn000 = new BSHAmbiguousName(JJTAMBIGUOUSNAME);
985 boolean jjtc000 = true;
986 jjtree.openNodeScope(jjtn000);
987 jjtreeOpenNodeScope(jjtn000);Token t;
988 StringBuffer s;
989 try {
990 t = jj_consume_token(IDENTIFIER);
991 s = new StringBuffer(t.image);
992 label_5:
993 while (true) {
994 if (jj_2_6(2)) {
995 ;
996 } else {
997 break label_5;
998 }
999 jj_consume_token(DOT);
1000 t = jj_consume_token(IDENTIFIER);
1001 s.append("."+t.image);
1002 }
1003 jjtree.closeNodeScope(jjtn000, true);
1004 jjtc000 = false;
1005 jjtreeCloseNodeScope(jjtn000);
1006 jjtn000.text = s.toString();
1007 } finally {
1008 if (jjtc000) {
1009 jjtree.closeNodeScope(jjtn000, true);
1010 jjtreeCloseNodeScope(jjtn000);
1011 }
1012 }
1013 }
1014
1015 final public int NameList() throws ParseException {
1016 int count = 0;
1017 AmbiguousName();
1018 ++count;
1019 label_6:
1020 while (true) {
1021 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1022 case COMMA:
1023 ;
1024 break;
1025 default:
1026 break label_6;
1027 }
1028 jj_consume_token(COMMA);
1029 AmbiguousName();
1030 ++count;
1031 }
1032 {if (true) return count;}
1033 throw new Error("Missing return statement in function");
1034 }
1035
1036/*
1037 * Expression syntax follows.
1038 */
1039 final public void Expression() throws ParseException {
1040 if (jj_2_7(2147483647)) {
1041 Assignment();
1042 } else {
1043 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1044 case BOOLEAN:
1045 case BYTE:
1046 case CHAR:
1047 case DOUBLE:
1048 case FALSE:
1049 case FLOAT:
1050 case INT:
1051 case LONG:
1052 case NEW:
1053 case NULL:
1054 case SHORT:
1055 case TRUE:
1056 case VOID:
1057 case INTEGER_LITERAL:
1058 case FLOATING_POINT_LITERAL:
1059 case CHARACTER_LITERAL:
1060 case STRING_LITERAL:
1061 case IDENTIFIER:
1062 case LPAREN:
1063 case BANG:
1064 case TILDE:
1065 case INCR:
1066 case DECR:
1067 case PLUS:
1068 case MINUS:
1069 ConditionalExpression();
1070 break;
1071 default:
1072 jj_consume_token(-1);
1073 throw new ParseException();
1074 }
1075 }
1076 }
1077
1078 final public void Assignment() throws ParseException {
1079 /*@bgen(jjtree) Assignment */
1080 BSHAssignment jjtn000 = new BSHAssignment(JJTASSIGNMENT);
1081 boolean jjtc000 = true;
1082 jjtree.openNodeScope(jjtn000);
1083 jjtreeOpenNodeScope(jjtn000);int op ;
1084 try {
1085 PrimaryExpression();
1086 op = AssignmentOperator();
1087 jjtn000.operator = op;
1088 Expression();
1089 } catch (Throwable jjte000) {
1090 if (jjtc000) {
1091 jjtree.clearNodeScope(jjtn000);
1092 jjtc000 = false;
1093 } else {
1094 jjtree.popNode();
1095 }
1096 if (jjte000 instanceof RuntimeException) {
1097 {if (true) throw (RuntimeException)jjte000;}
1098 }
1099 if (jjte000 instanceof ParseException) {
1100 {if (true) throw (ParseException)jjte000;}
1101 }
1102 {if (true) throw (Error)jjte000;}
1103 } finally {
1104 if (jjtc000) {
1105 jjtree.closeNodeScope(jjtn000, true);
1106 jjtreeCloseNodeScope(jjtn000);
1107 }
1108 }
1109 }
1110
1111 final public int AssignmentOperator() throws ParseException {
1112 Token t;
1113 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1114 case ASSIGN:
1115 jj_consume_token(ASSIGN);
1116 break;
1117 case STARASSIGN:
1118 jj_consume_token(STARASSIGN);
1119 break;
1120 case SLASHASSIGN:
1121 jj_consume_token(SLASHASSIGN);
1122 break;
1123 case MODASSIGN:
1124 jj_consume_token(MODASSIGN);
1125 break;
1126 case PLUSASSIGN:
1127 jj_consume_token(PLUSASSIGN);
1128 break;
1129 case MINUSASSIGN:
1130 jj_consume_token(MINUSASSIGN);
1131 break;
1132 case ANDASSIGN:
1133 jj_consume_token(ANDASSIGN);
1134 break;
1135 case XORASSIGN:
1136 jj_consume_token(XORASSIGN);
1137 break;
1138 case ORASSIGN:
1139 jj_consume_token(ORASSIGN);
1140 break;
1141 case LSHIFTASSIGN:
1142 jj_consume_token(LSHIFTASSIGN);
1143 break;
1144 case LSHIFTASSIGNX:
1145 jj_consume_token(LSHIFTASSIGNX);
1146 break;
1147 case RSIGNEDSHIFTASSIGN:
1148 jj_consume_token(RSIGNEDSHIFTASSIGN);
1149 break;
1150 case RSIGNEDSHIFTASSIGNX:
1151 jj_consume_token(RSIGNEDSHIFTASSIGNX);
1152 break;
1153 case RUNSIGNEDSHIFTASSIGN:
1154 jj_consume_token(RUNSIGNEDSHIFTASSIGN);
1155 break;
1156 case RUNSIGNEDSHIFTASSIGNX:
1157 jj_consume_token(RUNSIGNEDSHIFTASSIGNX);
1158 break;
1159 default:
1160 jj_consume_token(-1);
1161 throw new ParseException();
1162 }
1163 t = getToken(0);
1164 {if (true) return t.kind;}
1165 throw new Error("Missing return statement in function");
1166 }
1167
1168 final public void ConditionalExpression() throws ParseException {
1169 ConditionalOrExpression();
1170 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1171 case HOOK:
1172 jj_consume_token(HOOK);
1173 Expression();
1174 jj_consume_token(COLON);
1175 BSHTernaryExpression jjtn001 = new BSHTernaryExpression(JJTTERNARYEXPRESSION);
1176 boolean jjtc001 = true;
1177 jjtree.openNodeScope(jjtn001);
1178 jjtreeOpenNodeScope(jjtn001);
1179 try {
1180 ConditionalExpression();
1181 } catch (Throwable jjte001) {
1182 if (jjtc001) {
1183 jjtree.clearNodeScope(jjtn001);
1184 jjtc001 = false;
1185 } else {
1186 jjtree.popNode();
1187 }
1188 if (jjte001 instanceof RuntimeException) {
1189 {if (true) throw (RuntimeException)jjte001;}
1190 }
1191 if (jjte001 instanceof ParseException) {
1192 {if (true) throw (ParseException)jjte001;}
1193 }
1194 {if (true) throw (Error)jjte001;}
1195 } finally {
1196 if (jjtc001) {
1197 jjtree.closeNodeScope(jjtn001, 3);
1198 jjtreeCloseNodeScope(jjtn001);
1199 }
1200 }
1201 break;
1202 default:
1203 ;
1204 }
1205 }
1206
1207 final public void ConditionalOrExpression() throws ParseException {
1208 Token t=null;
1209 ConditionalAndExpression();
1210 label_7:
1211 while (true) {
1212 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1213 case BOOL_OR:
1214 case BOOL_ORX:
1215 ;
1216 break;
1217 default:
1218 break label_7;
1219 }
1220 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1221 case BOOL_OR:
1222 t = jj_consume_token(BOOL_OR);
1223 break;
1224 case BOOL_ORX:
1225 t = jj_consume_token(BOOL_ORX);
1226 break;
1227 default:
1228 jj_consume_token(-1);
1229 throw new ParseException();
1230 }
1231 ConditionalAndExpression();
1232 BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
1233 boolean jjtc001 = true;
1234 jjtree.openNodeScope(jjtn001);
1235 jjtreeOpenNodeScope(jjtn001);
1236 try {
1237 jjtree.closeNodeScope(jjtn001, 2);
1238 jjtc001 = false;
1239 jjtreeCloseNodeScope(jjtn001);
1240 jjtn001.kind = t.kind;
1241 } finally {
1242 if (jjtc001) {
1243 jjtree.closeNodeScope(jjtn001, 2);
1244 jjtreeCloseNodeScope(jjtn001);
1245 }
1246 }
1247 }
1248 }
1249
1250 final public void ConditionalAndExpression() throws ParseException {
1251 Token t=null;
1252 InclusiveOrExpression();
1253 label_8:
1254 while (true) {
1255 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1256 case BOOL_AND:
1257 case BOOL_ANDX:
1258 ;
1259 break;
1260 default:
1261 break label_8;
1262 }
1263 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1264 case BOOL_AND:
1265 t = jj_consume_token(BOOL_AND);
1266 break;
1267 case BOOL_ANDX:
1268 t = jj_consume_token(BOOL_ANDX);
1269 break;
1270 default:
1271 jj_consume_token(-1);
1272 throw new ParseException();
1273 }
1274 InclusiveOrExpression();
1275 BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
1276 boolean jjtc001 = true;
1277 jjtree.openNodeScope(jjtn001);
1278 jjtreeOpenNodeScope(jjtn001);
1279 try {
1280 jjtree.closeNodeScope(jjtn001, 2);
1281 jjtc001 = false;
1282 jjtreeCloseNodeScope(jjtn001);
1283 jjtn001.kind = t.kind;
1284 } finally {
1285 if (jjtc001) {
1286 jjtree.closeNodeScope(jjtn001, 2);
1287 jjtreeCloseNodeScope(jjtn001);
1288 }
1289 }
1290 }
1291 }
1292
1293 final public void InclusiveOrExpression() throws ParseException {
1294 Token t=null;
1295 ExclusiveOrExpression();
1296 label_9:
1297 while (true) {
1298 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1299 case BIT_OR:
1300 case BIT_ORX:
1301 ;
1302 break;
1303 default:
1304 break label_9;
1305 }
1306 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1307 case BIT_OR:
1308 t = jj_consume_token(BIT_OR);
1309 break;
1310 case BIT_ORX:
1311 t = jj_consume_token(BIT_ORX);
1312 break;
1313 default:
1314 jj_consume_token(-1);
1315 throw new ParseException();
1316 }
1317 ExclusiveOrExpression();
1318 BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
1319 boolean jjtc001 = true;
1320 jjtree.openNodeScope(jjtn001);
1321 jjtreeOpenNodeScope(jjtn001);
1322 try {
1323 jjtree.closeNodeScope(jjtn001, 2);
1324 jjtc001 = false;
1325 jjtreeCloseNodeScope(jjtn001);
1326 jjtn001.kind = t.kind;
1327 } finally {
1328 if (jjtc001) {
1329 jjtree.closeNodeScope(jjtn001, 2);
1330 jjtreeCloseNodeScope(jjtn001);
1331 }
1332 }
1333 }
1334 }
1335
1336 final public void ExclusiveOrExpression() throws ParseException {
1337 Token t=null;
1338 AndExpression();
1339 label_10:
1340 while (true) {
1341 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1342 case XOR:
1343 ;
1344 break;
1345 default:
1346 break label_10;
1347 }
1348 t = jj_consume_token(XOR);
1349 AndExpression();
1350 BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
1351 boolean jjtc001 = true;
1352 jjtree.openNodeScope(jjtn001);
1353 jjtreeOpenNodeScope(jjtn001);
1354 try {
1355 jjtree.closeNodeScope(jjtn001, 2);
1356 jjtc001 = false;
1357 jjtreeCloseNodeScope(jjtn001);
1358 jjtn001.kind = t.kind;
1359 } finally {
1360 if (jjtc001) {
1361 jjtree.closeNodeScope(jjtn001, 2);
1362 jjtreeCloseNodeScope(jjtn001);
1363 }
1364 }
1365 }
1366 }
1367
1368 final public void AndExpression() throws ParseException {
1369 Token t=null;
1370 EqualityExpression();
1371 label_11:
1372 while (true) {
1373 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1374 case BIT_AND:
1375 case BIT_ANDX:
1376 ;
1377 break;
1378 default:
1379 break label_11;
1380 }
1381 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1382 case BIT_AND:
1383 t = jj_consume_token(BIT_AND);
1384 break;
1385 case BIT_ANDX:
1386 t = jj_consume_token(BIT_ANDX);
1387 break;
1388 default:
1389 jj_consume_token(-1);
1390 throw new ParseException();
1391 }
1392 EqualityExpression();
1393 BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
1394 boolean jjtc001 = true;
1395 jjtree.openNodeScope(jjtn001);
1396 jjtreeOpenNodeScope(jjtn001);
1397 try {
1398 jjtree.closeNodeScope(jjtn001, 2);
1399 jjtc001 = false;
1400 jjtreeCloseNodeScope(jjtn001);
1401 jjtn001.kind = t.kind;
1402 } finally {
1403 if (jjtc001) {
1404 jjtree.closeNodeScope(jjtn001, 2);
1405 jjtreeCloseNodeScope(jjtn001);
1406 }
1407 }
1408 }
1409 }
1410
1411 final public void EqualityExpression() throws ParseException {
1412 Token t = null;
1413 InstanceOfExpression();
1414 label_12:
1415 while (true) {
1416 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1417 case EQ:
1418 case NE:
1419 ;
1420 break;
1421 default:
1422 break label_12;
1423 }
1424 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1425 case EQ:
1426 t = jj_consume_token(EQ);
1427 break;
1428 case NE:
1429 t = jj_consume_token(NE);
1430 break;
1431 default:
1432 jj_consume_token(-1);
1433 throw new ParseException();
1434 }
1435 InstanceOfExpression();
1436 BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
1437 boolean jjtc001 = true;
1438 jjtree.openNodeScope(jjtn001);
1439 jjtreeOpenNodeScope(jjtn001);
1440 try {
1441 jjtree.closeNodeScope(jjtn001, 2);
1442 jjtc001 = false;
1443 jjtreeCloseNodeScope(jjtn001);
1444 jjtn001.kind = t.kind;
1445 } finally {
1446 if (jjtc001) {
1447 jjtree.closeNodeScope(jjtn001, 2);
1448 jjtreeCloseNodeScope(jjtn001);
1449 }
1450 }
1451 }
1452 }
1453
1454 final public void InstanceOfExpression() throws ParseException {
1455 Token t = null;
1456 RelationalExpression();
1457 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1458 case INSTANCEOF:
1459 t = jj_consume_token(INSTANCEOF);
1460 Type();
1461 BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
1462 boolean jjtc001 = true;
1463 jjtree.openNodeScope(jjtn001);
1464 jjtreeOpenNodeScope(jjtn001);
1465 try {
1466 jjtree.closeNodeScope(jjtn001, 2);
1467 jjtc001 = false;
1468 jjtreeCloseNodeScope(jjtn001);
1469 jjtn001.kind = t.kind;
1470 } finally {
1471 if (jjtc001) {
1472 jjtree.closeNodeScope(jjtn001, 2);
1473 jjtreeCloseNodeScope(jjtn001);
1474 }
1475 }
1476 break;
1477 default:
1478 ;
1479 }
1480 }
1481
1482 final public void RelationalExpression() throws ParseException {
1483 Token t = null;
1484 ShiftExpression();
1485 label_13:
1486 while (true) {
1487 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1488 case GT:
1489 case GTX:
1490 case LT:
1491 case LTX:
1492 case LE:
1493 case LEX:
1494 case GE:
1495 case GEX:
1496 ;
1497 break;
1498 default:
1499 break label_13;
1500 }
1501 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1502 case LT:
1503 t = jj_consume_token(LT);
1504 break;
1505 case LTX:
1506 t = jj_consume_token(LTX);
1507 break;
1508 case GT:
1509 t = jj_consume_token(GT);
1510 break;
1511 case GTX:
1512 t = jj_consume_token(GTX);
1513 break;
1514 case LE:
1515 t = jj_consume_token(LE);
1516 break;
1517 case LEX:
1518 t = jj_consume_token(LEX);
1519 break;
1520 case GE:
1521 t = jj_consume_token(GE);
1522 break;
1523 case GEX:
1524 t = jj_consume_token(GEX);
1525 break;
1526 default:
1527 jj_consume_token(-1);
1528 throw new ParseException();
1529 }
1530 ShiftExpression();
1531 BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
1532 boolean jjtc001 = true;
1533 jjtree.openNodeScope(jjtn001);
1534 jjtreeOpenNodeScope(jjtn001);
1535 try {
1536 jjtree.closeNodeScope(jjtn001, 2);
1537 jjtc001 = false;
1538 jjtreeCloseNodeScope(jjtn001);
1539 jjtn001.kind = t.kind;
1540 } finally {
1541 if (jjtc001) {
1542 jjtree.closeNodeScope(jjtn001, 2);
1543 jjtreeCloseNodeScope(jjtn001);
1544 }
1545 }
1546 }
1547 }
1548
1549 final public void ShiftExpression() throws ParseException {
1550 Token t = null;
1551 AdditiveExpression();
1552 label_14:
1553 while (true) {
1554 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1555 case LSHIFT:
1556 case LSHIFTX:
1557 case RSIGNEDSHIFT:
1558 case RSIGNEDSHIFTX:
1559 case RUNSIGNEDSHIFT:
1560 case RUNSIGNEDSHIFTX:
1561 ;
1562 break;
1563 default:
1564 break label_14;
1565 }
1566 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1567 case LSHIFT:
1568 t = jj_consume_token(LSHIFT);
1569 break;
1570 case LSHIFTX:
1571 t = jj_consume_token(LSHIFTX);
1572 break;
1573 case RSIGNEDSHIFT:
1574 t = jj_consume_token(RSIGNEDSHIFT);
1575 break;
1576 case RSIGNEDSHIFTX:
1577 t = jj_consume_token(RSIGNEDSHIFTX);
1578 break;
1579 case RUNSIGNEDSHIFT:
1580 t = jj_consume_token(RUNSIGNEDSHIFT);
1581 break;
1582 case RUNSIGNEDSHIFTX:
1583 t = jj_consume_token(RUNSIGNEDSHIFTX);
1584 break;
1585 default:
1586 jj_consume_token(-1);
1587 throw new ParseException();
1588 }
1589 AdditiveExpression();
1590 BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
1591 boolean jjtc001 = true;
1592 jjtree.openNodeScope(jjtn001);
1593 jjtreeOpenNodeScope(jjtn001);
1594 try {
1595 jjtree.closeNodeScope(jjtn001, 2);
1596 jjtc001 = false;
1597 jjtreeCloseNodeScope(jjtn001);
1598 jjtn001.kind = t.kind;
1599 } finally {
1600 if (jjtc001) {
1601 jjtree.closeNodeScope(jjtn001, 2);
1602 jjtreeCloseNodeScope(jjtn001);
1603 }
1604 }
1605 }
1606 }
1607
1608 final public void AdditiveExpression() throws ParseException {
1609 Token t = null;
1610 MultiplicativeExpression();
1611 label_15:
1612 while (true) {
1613 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1614 case PLUS:
1615 case MINUS:
1616 ;
1617 break;
1618 default:
1619 break label_15;
1620 }
1621 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1622 case PLUS:
1623 t = jj_consume_token(PLUS);
1624 break;
1625 case MINUS:
1626 t = jj_consume_token(MINUS);
1627 break;
1628 default:
1629 jj_consume_token(-1);
1630 throw new ParseException();
1631 }
1632 MultiplicativeExpression();
1633 BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
1634 boolean jjtc001 = true;
1635 jjtree.openNodeScope(jjtn001);
1636 jjtreeOpenNodeScope(jjtn001);
1637 try {
1638 jjtree.closeNodeScope(jjtn001, 2);
1639 jjtc001 = false;
1640 jjtreeCloseNodeScope(jjtn001);
1641 jjtn001.kind = t.kind;
1642 } finally {
1643 if (jjtc001) {
1644 jjtree.closeNodeScope(jjtn001, 2);
1645 jjtreeCloseNodeScope(jjtn001);
1646 }
1647 }
1648 }
1649 }
1650
1651 final public void MultiplicativeExpression() throws ParseException {
1652 Token t = null;
1653 UnaryExpression();
1654 label_16:
1655 while (true) {
1656 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1657 case STAR:
1658 case SLASH:
1659 case MOD:
1660 ;
1661 break;
1662 default:
1663 break label_16;
1664 }
1665 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1666 case STAR:
1667 t = jj_consume_token(STAR);
1668 break;
1669 case SLASH:
1670 t = jj_consume_token(SLASH);
1671 break;
1672 case MOD:
1673 t = jj_consume_token(MOD);
1674 break;
1675 default:
1676 jj_consume_token(-1);
1677 throw new ParseException();
1678 }
1679 UnaryExpression();
1680 BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
1681 boolean jjtc001 = true;
1682 jjtree.openNodeScope(jjtn001);
1683 jjtreeOpenNodeScope(jjtn001);
1684 try {
1685 jjtree.closeNodeScope(jjtn001, 2);
1686 jjtc001 = false;
1687 jjtreeCloseNodeScope(jjtn001);
1688 jjtn001.kind = t.kind;
1689 } finally {
1690 if (jjtc001) {
1691 jjtree.closeNodeScope(jjtn001, 2);
1692 jjtreeCloseNodeScope(jjtn001);
1693 }
1694 }
1695 }
1696 }
1697
1698 final public void UnaryExpression() throws ParseException {
1699 Token t = null;
1700 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1701 case PLUS:
1702 case MINUS:
1703 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1704 case PLUS:
1705 t = jj_consume_token(PLUS);
1706 break;
1707 case MINUS:
1708 t = jj_consume_token(MINUS);
1709 break;
1710 default:
1711 jj_consume_token(-1);
1712 throw new ParseException();
1713 }
1714 UnaryExpression();
1715 BSHUnaryExpression jjtn001 = new BSHUnaryExpression(JJTUNARYEXPRESSION);
1716 boolean jjtc001 = true;
1717 jjtree.openNodeScope(jjtn001);
1718 jjtreeOpenNodeScope(jjtn001);
1719 try {
1720 jjtree.closeNodeScope(jjtn001, 1);
1721 jjtc001 = false;
1722 jjtreeCloseNodeScope(jjtn001);
1723 jjtn001.kind = t.kind;
1724 } finally {
1725 if (jjtc001) {
1726 jjtree.closeNodeScope(jjtn001, 1);
1727 jjtreeCloseNodeScope(jjtn001);
1728 }
1729 }
1730 break;
1731 case INCR:
1732 PreIncrementExpression();
1733 break;
1734 case DECR:
1735 PreDecrementExpression();
1736 break;
1737 case BOOLEAN:
1738 case BYTE:
1739 case CHAR:
1740 case DOUBLE:
1741 case FALSE:
1742 case FLOAT:
1743 case INT:
1744 case LONG:
1745 case NEW:
1746 case NULL:
1747 case SHORT:
1748 case TRUE:
1749 case VOID:
1750 case INTEGER_LITERAL:
1751 case FLOATING_POINT_LITERAL:
1752 case CHARACTER_LITERAL:
1753 case STRING_LITERAL:
1754 case IDENTIFIER:
1755 case LPAREN:
1756 case BANG:
1757 case TILDE:
1758 UnaryExpressionNotPlusMinus();
1759 break;
1760 default:
1761 jj_consume_token(-1);
1762 throw new ParseException();
1763 }
1764 }
1765
1766 final public void PreIncrementExpression() throws ParseException {
1767 Token t = null;
1768 t = jj_consume_token(INCR);
1769 …
Large files files are truncated, but you can click here to view the full file