/jEdit/tags/jedit-4-0-pre3/bsh/bsh.jj
# · Unknown · 2424 lines · 2326 code · 98 blank · 0 comment · 0 complexity · 14b9f04c54708cbbdde889850c34c04e MD5 · raw file
- /*@bgen(jjtree) Generated By:JJTree: Do not edit this line. src/bsh/bsh.jj */
- /*@egen*//*****************************************************************************
- * *
- * This file is part of the BeanShell Java Scripting distribution. *
- * Documentation and updates may be found at http://www.beanshell.org/ *
- * *
- * Sun Public License Notice: *
- * *
- * The contents of this file are subject to the Sun Public License Version *
- * 1.0 (the "License"); you may not use this file except in compliance with *
- * the License. A copy of the License is available at http://www.sun.com *
- * *
- * The Original Code is BeanShell. The Initial Developer of the Original *
- * Code is Pat Niemeyer. Portions created by Pat Niemeyer are Copyright *
- * (C) 2000. All Rights Reserved. *
- * *
- * GNU Public License Notice: *
- * *
- * Alternatively, the contents of this file may be used under the terms of *
- * the GNU Lesser General Public License (the "LGPL"), in which case the *
- * provisions of LGPL are applicable instead of those above. If you wish to *
- * allow use of your version of this file only under the terms of the LGPL *
- * and not to allow others to use your version of this file under the SPL, *
- * indicate your decision by deleting the provisions above and replace *
- * them with the notice and other provisions required by the LGPL. If you *
- * do not delete the provisions above, a recipient may use your version of *
- * this file under either the SPL or the LGPL. *
- * *
- * Patrick Niemeyer (pat@pat.net) *
- * Author of Learning Java, O'Reilly & Associates *
- * http://www.pat.net/~pat/ *
- * *
- *****************************************************************************/
- /*
- Notes:
- There is probably a lot of room for improvement in here.
- All of the syntactic lookaheads have been commented with:
- SYNTACTIC_LOOKAHEAD
- These are probably expensive and we may want to start weeding them out
- where possible.
- */
- options {
- JAVA_UNICODE_ESCAPE=true;
- STATIC=false;
- /* Print grammar debugging info as we parse
- DEBUG_PARSER=true; */
- /* Print detailed lookahead debugging info
- DEBUG_LOOKAHEAD=true; */
- }
- PARSER_BEGIN(Parser)
- package bsh;
- import java.io.Reader;
- class Parser/*@bgen(jjtree)*/implements ParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/
- protected JJTParserState jjtree = new JJTParserState();
- /*@egen*/
- void jjtreeOpenNodeScope(Node n) {
- ((SimpleNode)n).firstToken = getToken(1);
- }
- void jjtreeCloseNodeScope(Node n) {
- ((SimpleNode)n).lastToken = getToken(0);
- }
- /**
- Re-initialize the input stream and token source.
- */
- void reInitInput( Reader in ) {
- ReInit(in);
- }
- /**
- Explicitly re-initialize just the token reader.
- This seems to be necessary to avoid certain looping errors when
- reading bogus input. See Interpreter.
- */
- void reInitTokenInput( Reader in ) {
- jj_input_stream.ReInit( in,
- jj_input_stream.getEndLine(),
- jj_input_stream.getEndColumn() );
- }
- }
- PARSER_END(Parser)
- SKIP : /* WHITE SPACE */
- {
- " " | "\t" | "\r" | "\f"
- | "\n"
- | < NONPRINTABLE: (["\u0000"-" ", "\u0080"-"\u00ff"])+ >
- }
- SPECIAL_TOKEN : /* COMMENTS */
- {
- /*
- Single line comments fail on the last line of a file with no terminating
- linefeed. I thought the <EOF> would fix that, but no...
- <SINGLE_LINE_COMMENT: "//" (~["\n","\r"])* "<EOF>"|("\n"|"\r"|"\r\n")>
- */
- <SINGLE_LINE_COMMENT: "//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")>
- | <HASH_BANG_COMMENT: "#!" (~["\n","\r"])* ("\n"|"\r"|"\r\n")>
- | <FORMAL_COMMENT: "/**" (~["*"])* "*" ("*" | (~["*","/"] (~["*"])* "*"))* "/">
- | <MULTI_LINE_COMMENT: "/*" (~["*"])* "*" ("*" | (~["*","/"] (~["*"])* "*"))* "/">
- }
- TOKEN : /* RESERVED WORDS AND LITERALS */
- {
- < BOOLEAN: "boolean" >
- | < BREAK: "break" >
- | < CLASS: "class" >
- | < BYTE: "byte" >
- | < CASE: "case" >
- | < CATCH: "catch" >
- | < CHAR: "char" >
- | < CONST: "const" >
- | < CONTINUE: "continue" >
- | < _DEFAULT: "default" >
- | < DO: "do" >
- | < DOUBLE: "double" >
- | < ELSE: "else" >
- | < FALSE: "false" >
- | < FINAL: "final" >
- | < FINALLY: "finally" >
- | < FLOAT: "float" >
- | < FOR: "for" >
- | < GOTO: "goto" >
- | < IF: "if" >
- | < IMPORT: "import" >
- | < INSTANCEOF: "instanceof" >
- | < INT: "int" >
- | < INTERFACE: "interface" >
- | < LONG: "long" >
- | < NEW: "new" >
- | < NULL: "null" >
- | < PRIVATE: "private" >
- | < PROTECTED: "protected" >
- | < PUBLIC: "public" >
- | < RETURN: "return" >
- | < SHORT: "short" >
- | < STATIC: "static" >
- | < SWITCH: "switch" >
- | < THROW: "throw" >
- | < TRUE: "true" >
- | < TRY: "try" >
- | < VOID: "void" >
- | < WHILE: "while" >
- }
- TOKEN : /* LITERALS */
- {
- < INTEGER_LITERAL:
- <DECIMAL_LITERAL> (["l","L"])?
- | <HEX_LITERAL> (["l","L"])?
- | <OCTAL_LITERAL> (["l","L"])?
- >
- |
- < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
- |
- < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
- |
- < #OCTAL_LITERAL: "0" (["0"-"7"])* >
- |
- < FLOATING_POINT_LITERAL:
- (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
- | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
- | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
- | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
- >
- |
- < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
- |
- < CHARACTER_LITERAL:
- "'"
- ( (~["'","\\","\n","\r"])
- | ("\\"
- ( ["n","t","b","r","f","\\","'","\""]
- | ["0"-"7"] ( ["0"-"7"] )?
- | ["0"-"3"] ["0"-"7"] ["0"-"7"]
- )
- )
- )
- "'"
- >
- |
- < STRING_LITERAL:
- "\""
- ( (~["\"","\\","\n","\r"])
- | ("\\"
- ( ["n","t","b","r","f","\\","'","\""]
- | ["0"-"7"] ( ["0"-"7"] )?
- | ["0"-"3"] ["0"-"7"] ["0"-"7"]
- )
- )
- )*
- "\""
- >
- }
- TOKEN : /* IDENTIFIERS */
- {
- < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
- |
- < #LETTER:
- [
- "$",
- "A"-"Z",
- "_",
- "a"-"z",
- "\u00c0"-"\u00d6",
- "\u00d8"-"\u00f6",
- "\u00f8"-"\u00ff",
- "\u0100"-"\u1fff",
- "\u3040"-"\u318f",
- "\u3300"-"\u337f",
- "\u3400"-"\u3d2d",
- "\u4e00"-"\u9fff",
- "\uf900"-"\ufaff"
- ]
- >
- |
- < #DIGIT:
- [
- "0"-"9",
- "\u0660"-"\u0669",
- "\u06f0"-"\u06f9",
- "\u0966"-"\u096f",
- "\u09e6"-"\u09ef",
- "\u0a66"-"\u0a6f",
- "\u0ae6"-"\u0aef",
- "\u0b66"-"\u0b6f",
- "\u0be7"-"\u0bef",
- "\u0c66"-"\u0c6f",
- "\u0ce6"-"\u0cef",
- "\u0d66"-"\u0d6f",
- "\u0e50"-"\u0e59",
- "\u0ed0"-"\u0ed9",
- "\u1040"-"\u1049"
- ]
- >
- }
- TOKEN : /* SEPARATORS */
- {
- < LPAREN: "(" >
- | < RPAREN: ")" >
- | < LBRACE: "{" >
- | < RBRACE: "}" >
- | < LBRACKET: "[" >
- | < RBRACKET: "]" >
- | < SEMICOLON: ";" >
- | < COMMA: "," >
- | < DOT: "." >
- }
- TOKEN : /* OPERATORS */
- {
- < ASSIGN: "=" >
- | < GT: ">" >
- | < GTX: "@gt" >
- | < LT: "<" >
- | < LTX: "@lt" >
- | < BANG: "!" >
- | < TILDE: "~" >
- | < HOOK: "?" >
- | < COLON: ":" >
- | < EQ: "==" >
- | < LE: "<=" >
- | < LEX: "@lteq" >
- | < GE: ">=" >
- | < GEX: "@gteq" >
- | < NE: "!=" >
- | < BOOL_OR: "||" >
- | < BOOL_ORX: "@or" >
- | < BOOL_AND: "&&" >
- | < BOOL_ANDX: "@and" >
- | < INCR: "++" >
- | < DECR: "--" >
- | < PLUS: "+" >
- | < MINUS: "-" >
- | < STAR: "*" >
- | < SLASH: "/" >
- | < BIT_AND: "&" >
- | < BIT_ANDX: "@bitwise_and" >
- | < BIT_OR: "|" >
- | < BIT_ORX: "@bitwise_or" >
- | < XOR: "^" >
- | < MOD: "%" >
- | < LSHIFT: "<<" >
- | < LSHIFTX: "@left_shift" >
- | < RSIGNEDSHIFT: ">>" >
- | < RSIGNEDSHIFTX: "@right_shift" >
- | < RUNSIGNEDSHIFT: ">>>" >
- | < RUNSIGNEDSHIFTX: "@right_unsigned_shift" >
- | < PLUSASSIGN: "+=" >
- | < MINUSASSIGN: "-=" >
- | < STARASSIGN: "*=" >
- | < SLASHASSIGN: "/=" >
- | < ANDASSIGN: "&=" >
- | < ANDASSIGNX: "@and_assign" >
- | < ORASSIGN: "|=" >
- | < ORASSIGNX: "@or_assign" >
- | < XORASSIGN: "^=" >
- | < MODASSIGN: "%=" >
- | < LSHIFTASSIGN: "<<=" >
- | < LSHIFTASSIGNX: "@left_shift_assign" >
- | < RSIGNEDSHIFTASSIGN: ">>=" >
- | < RSIGNEDSHIFTASSIGNX: "@right_shift_assign" >
- | < RUNSIGNEDSHIFTASSIGN: ">>>=" >
- | < RUNSIGNEDSHIFTASSIGNX: "@right_unsigned_shift_assign" >
- }
- boolean Line() :
- {}
- {
- <EOF> {
- Interpreter.debug("End of File!");
- return true;
- }
- |
- (
- /*
- SYNTACTIC_LOOKAHEAD
- I'm guessing this is expensive, but I don't know how to work around
- it... Is there another syntactic indication that we are working
- through an expression as opposed to a statement?
- What is the difference? Well, some statements don't require a
- semicolon and they don't return vlues... We could probably broaden
- bsh to allow everything to return a value, but the semi-colon thing
- is tougher. You don't want to have to say if ( foo ) { } ;
- Maybe we can invert ths and enumerate all of those types of
- statements in a special lookahead that's cheaper??
- */
- LOOKAHEAD( Expression() ";" )
- Expression() ";"
- |
- BlockStatement()
- )
- {
- return false;
- }
- }
- /*****************************************
- * THE JAVA LANGUAGE GRAMMAR STARTS HERE *
- *****************************************/
- void MethodDeclaration() :
- {/*@bgen(jjtree) MethodDeclaration */
- BSHMethodDeclaration jjtn000 = new BSHMethodDeclaration(JJTMETHODDECLARATION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ Token t = null; }
- {/*@bgen(jjtree) MethodDeclaration */
- try {
- /*@egen*/
- // SYNTACTIC_LOOKAHEAD
- // this one seems cheap enough
- LOOKAHEAD( MethodDeclarationTypeLookahead() )
- ReturnType() t = <IDENTIFIER> { jjtn000.name = t.image; }
- FormalParameters() Block()
- |
- t = <IDENTIFIER> { jjtn000.name = t.image; }
- FormalParameters() Block()/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void MethodDeclarationLookahead() : { }
- {
- // SYNTACTIC_LOOKAHEAD
- // this one seems cheap enough
- LOOKAHEAD( MethodDeclarationTypeLookahead() )
- ReturnType() <IDENTIFIER> FormalParameters() "{"
- |
- <IDENTIFIER> FormalParameters() "{"
- }
- void MethodDeclarationTypeLookahead() : { }
- {
- ReturnType() <IDENTIFIER> "("
- }
- void ImportDeclaration() :
- {/*@bgen(jjtree) ImportDeclaration */
- BSHImportDeclaration jjtn000 = new BSHImportDeclaration(JJTIMPORTDECLARATION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/
- Token t = null;
- }
- {/*@bgen(jjtree) ImportDeclaration */
- try {
- /*@egen*/
- LOOKAHEAD( 2 )
- "import" AmbiguousName() [ t = "." "*" ] ";"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- if ( t != null )
- jjtn000.importPackage = true;
- }
- |
- // bsh super import statement
- "import" "*" ";"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.superImport = true;
- }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void VariableDeclarator() :
- {/*@bgen(jjtree) VariableDeclarator */
- BSHVariableDeclarator jjtn000 = new BSHVariableDeclarator(JJTVARIABLEDECLARATOR);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ Token t; }
- {/*@bgen(jjtree) VariableDeclarator */
- try {
- /*@egen*/
- t=<IDENTIFIER> [ "=" VariableInitializer() ]/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.name = t.image; }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- /*
- Can get rid of this if we ignore postfix array dimensions in declarations.
- I don't like them and I don't want to deal with them right now.
- void VariableDeclaratorId() #VariableDeclaratorId :
- { Token t; }
- {
- t=<IDENTIFIER> { jjtThis.name = t.image; }
- ( "[" "]" { jjtThis.addArrayDimension(); } )*
- }
- */
- void VariableInitializer() :
- {}
- {
- ArrayInitializer()
- |
- Expression()
- }
- void ArrayInitializer() :
- {/*@bgen(jjtree) ArrayInitializer */
- BSHArrayInitializer jjtn000 = new BSHArrayInitializer(JJTARRAYINITIALIZER);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/}
- {/*@bgen(jjtree) ArrayInitializer */
- try {
- /*@egen*/
- "{" [ VariableInitializer()
- ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}"/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void FormalParameters() :
- {/*@bgen(jjtree) FormalParameters */
- BSHFormalParameters jjtn000 = new BSHFormalParameters(JJTFORMALPARAMETERS);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/}
- {/*@bgen(jjtree) FormalParameters */
- try {
- /*@egen*/
- "(" [ FormalParameter() ( "," FormalParameter() )* ] ")"/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- /*
- void FormalParameter() #FormalParameter :
- { Token t; }
- {
- // added [] to Type for bsh. Removed [ final ] - is that legal?
- [ LOOKAHEAD(2) Type() ] t=<IDENTIFIER> { jjtThis.name = t.image; }
- }
- */
- void FormalParameter() :
- {/*@bgen(jjtree) FormalParameter */
- BSHFormalParameter jjtn000 = new BSHFormalParameter(JJTFORMALPARAMETER);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ Token t; }
- {/*@bgen(jjtree) FormalParameter */
- try {
- /*@egen*/
- // added [] to Type for bsh. Removed [ final ] - is that legal?
- LOOKAHEAD(2) Type() t=<IDENTIFIER>/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.name = t.image; }
- |
- t=<IDENTIFIER>/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.name = t.image; }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- /*
- Type, name and expression syntax follows.
- */
- void Type() :
- {/*@bgen(jjtree) Type */
- BSHType jjtn000 = new BSHType(JJTTYPE);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ }
- {/*@bgen(jjtree) Type */
- try {
- /*@egen*/
- /*
- The embedded lookahead is (was?) necessary to disambiguate for
- PrimaryPrefix. ( )* is a choice point. It took me a while to
- figure out where to put that. This stuff is annoying.
- */
- ( PrimitiveType() | AmbiguousName() )
- ( LOOKAHEAD(2) "[" "]" { jjtn000.addArrayDimension(); } )*/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- /*
- Originally called ResultType in the grammar
- */
- void ReturnType() :
- {/*@bgen(jjtree) ReturnType */
- BSHReturnType jjtn000 = new BSHReturnType(JJTRETURNTYPE);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ }
- {/*@bgen(jjtree) ReturnType */
- try {
- /*@egen*/
- "void"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.isVoid = true; }
- |
- Type()/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void PrimitiveType() :
- {/*@bgen(jjtree) PrimitiveType */
- BSHPrimitiveType jjtn000 = new BSHPrimitiveType(JJTPRIMITIVETYPE);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ } {/*@bgen(jjtree) PrimitiveType */
- try {
- /*@egen*/
- "boolean"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.type = Boolean.TYPE; }
- | "char"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.type = Character.TYPE; }
- | "byte"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.type = Byte.TYPE; }
- | "short"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.type = Short.TYPE; }
- | "int"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.type = Integer.TYPE; }
- | "long"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.type = Long.TYPE; }
- | "float"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.type = Float.TYPE; }
- | "double"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.type = Double.TYPE; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void AmbiguousName() :
- /*
- * A lookahead of 2 is required below since "Name" can be followed
- * by a ".*" when used in the context of an "ImportDeclaration".
- */
- {/*@bgen(jjtree) AmbiguousName */
- BSHAmbiguousName jjtn000 = new BSHAmbiguousName(JJTAMBIGUOUSNAME);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/
- Token t;
- StringBuffer s;
- }
- {/*@bgen(jjtree) AmbiguousName */
- try {
- /*@egen*/
- t = <IDENTIFIER> {
- s = new StringBuffer(t.image);
- }
- ( LOOKAHEAD(2) "." t = <IDENTIFIER> {
- s.append("."+t.image);
- }
- )*/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.text = s.toString();
- }/*@bgen(jjtree)*/
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- /*
- * Expression syntax follows.
- */
- void Expression() :
- { }
- {
- /**
- SYNTACTIC_LOOKAHEAD
- This is probably expensive. Can we simplify it somehow?
- */
- LOOKAHEAD( LHSPrimaryExpression() AssignmentOperator() )
- Assignment()
- |
- ConditionalExpression()
- }
- void Assignment() :
- {/*@bgen(jjtree) Assignment */
- BSHAssignment jjtn000 = new BSHAssignment(JJTASSIGNMENT);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ int op ; }
- {/*@bgen(jjtree) Assignment */
- try {
- /*@egen*/
- LHSPrimaryExpression()
- op = AssignmentOperator() {
- jjtn000.operator = op;
- }
- Expression()/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- int AssignmentOperator() :
- { Token t; }
- {
- ( "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "&=" | "^=" | "|=" |
- "<<=" | "@left_shift_assign" | ">>=" | "@right_shift_assign" |
- ">>>=" | "@right_unsigned_shift_assign" )
- {
- t = getToken(0);
- return t.kind;
- }
- }
- void ConditionalExpression() :
- { }
- {
- ConditionalOrExpression() [ "?" Expression() ":"/*@bgen(jjtree) #TernaryExpression( 3) */
- {
- BSHTernaryExpression jjtn001 = new BSHTernaryExpression(JJTTERNARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*/ ConditionalExpression()/*@bgen(jjtree)*/
- } catch (Throwable jjte001) {
- if (jjtc001) {
- jjtree.clearNodeScope(jjtn001);
- jjtc001 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte001 instanceof RuntimeException) {
- throw (RuntimeException)jjte001;
- }
- if (jjte001 instanceof ParseException) {
- throw (ParseException)jjte001;
- }
- throw (Error)jjte001;
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 3);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/ ]
- }
- void ConditionalOrExpression() :
- { Token t=null; }
- {
- ConditionalAndExpression()
- ( ( t = "||" | t = "@or" )
- ConditionalAndExpression()/*@bgen(jjtree) #BinaryExpression( 2) */
- {
- BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/ )*
- }
- void ConditionalAndExpression() :
- { Token t=null; }
- {
- InclusiveOrExpression()
- ( ( t = "&&" | t = "@and" )
- InclusiveOrExpression()/*@bgen(jjtree) #BinaryExpression( 2) */
- {
- BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/ )*
- }
- void InclusiveOrExpression() :
- { Token t=null; }
- {
- ExclusiveOrExpression()
- ( ( t = "|" | t = "@bitwise_or" )
- ExclusiveOrExpression()/*@bgen(jjtree) #BinaryExpression( 2) */
- {
- BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/ )*
- }
- void ExclusiveOrExpression() :
- { Token t=null; }
- {
- AndExpression() ( t="^" AndExpression()/*@bgen(jjtree) #BinaryExpression( 2) */
- {
- BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/ )*
- }
- void AndExpression() :
- { Token t=null; }
- {
- EqualityExpression()
- ( ( t = "&" | t = "@bitwise_and" )
- EqualityExpression()/*@bgen(jjtree) #BinaryExpression( 2) */
- {
- BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/ )*
- }
- void EqualityExpression() :
- { Token t = null; }
- {
- InstanceOfExpression() ( ( t= "==" | t= "!=" ) InstanceOfExpression()/*@bgen(jjtree) #BinaryExpression( 2) */
- {
- BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/
- )*
- }
- void InstanceOfExpression() :
- { Token t = null; }
- {
- RelationalExpression()
- [ t = "instanceof" Type()/*@bgen(jjtree) #BinaryExpression( 2) */
- {
- BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/ { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/ ]
- }
- void RelationalExpression() :
- { Token t = null; }
- {
- ShiftExpression()
- ( ( t = "<" | t = "@lt" | t = ">" | t = "@gt" |
- t = "<=" | t = "@lteq" | t = ">=" | t = "@gteq" )
- ShiftExpression()/*@bgen(jjtree) #BinaryExpression( 2) */
- {
- BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/ )*
- }
- void ShiftExpression() :
- { Token t = null; }
- {
- AdditiveExpression()
- ( ( t = "<<" | t = "@left_shift" | t = ">>" | t = "@right_shift" |
- t = ">>>" | t = "@right_unsigned_shift" )
- AdditiveExpression()/*@bgen(jjtree) #BinaryExpression( 2) */
- {
- BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/ )*
- }
- void AdditiveExpression() :
- { Token t = null; }
- {
- MultiplicativeExpression()
- ( ( t= "+" | t= "-" ) MultiplicativeExpression()/*@bgen(jjtree) #BinaryExpression( 2) */
- {
- BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/ { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/
- )*
- }
- void MultiplicativeExpression() :
- { Token t = null; }
- {
- UnaryExpression() ( ( t= "*" | t= "/" | t= "%" )
- UnaryExpression()/*@bgen(jjtree) #BinaryExpression( 2) */
- {
- BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/ { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 2);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/ )*
- }
- void UnaryExpression() :
- { Token t = null; }
- {
- ( t="+" | t="-" ) UnaryExpression()/*@bgen(jjtree) #UnaryExpression( 1) */
- {
- BSHUnaryExpression jjtn001 = new BSHUnaryExpression(JJTUNARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 1);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 1);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/
- |
- PreIncrementExpression()
- |
- PreDecrementExpression()
- |
- UnaryExpressionNotPlusMinus()
- }
- void PreIncrementExpression() :
- { Token t = null; }
- {
- t="++" LHSPrimaryExpression()/*@bgen(jjtree) #UnaryExpression( 1) */
- {
- BSHUnaryExpression jjtn001 = new BSHUnaryExpression(JJTUNARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 1);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 1);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/
- }
- void PreDecrementExpression() :
- { Token t = null; }
- {
- t="--" LHSPrimaryExpression()/*@bgen(jjtree) #UnaryExpression( 1) */
- {
- BSHUnaryExpression jjtn001 = new BSHUnaryExpression(JJTUNARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 1);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 1);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/
- }
- void UnaryExpressionNotPlusMinus() :
- { Token t = null; }
- {
- ( t="~" | t="!" ) UnaryExpression()/*@bgen(jjtree) #UnaryExpression( 1) */
- {
- BSHUnaryExpression jjtn001 = new BSHUnaryExpression(JJTUNARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 1);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/
- { jjtn001.kind = t.kind; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 1);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/
- |
- // SYNTACTIC_LOOKAHEAD
- LOOKAHEAD( CastLookahead() ) CastExpression()
- |
- PostfixExpression()
- }
- // This production is to determine lookahead only.
- void CastLookahead() : { }
- {
- LOOKAHEAD(2) "(" PrimitiveType()
- |
- // SYNTACTIC_LOOKAHEAD
- LOOKAHEAD( "(" AmbiguousName() "[" ) "(" AmbiguousName() "[" "]"
- |
- "(" AmbiguousName() ")" ( "~" | "!" | "(" | <IDENTIFIER> | /* "this" | "super" | */ "new" | Literal() )
- }
- void PostfixExpression() :
- { Token t = null; }
- {
- (
- // SYNTACTIC_LOOKAHEAD
- LOOKAHEAD( LHSPrimaryExpression() ("++"|"--") )
- LHSPrimaryExpression()
- [ ( t="++" | t="--" )/*@bgen(jjtree) #UnaryExpression( 1) */
- {
- BSHUnaryExpression jjtn001 = new BSHUnaryExpression(JJTUNARYEXPRESSION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*//*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, 1);
- jjtc001 = false;
- jjtreeCloseNodeScope(jjtn001);
- }
- /*@egen*/ {
- jjtn001.kind = t.kind; jjtn001.postfix = true; }/*@bgen(jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, 1);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/ ]
- |
- PrimaryExpression()
- )
- }
- void CastExpression() :
- {/*@bgen(jjtree) CastExpression */
- BSHCastExpression jjtn000 = new BSHCastExpression(JJTCASTEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ }
- {/*@bgen(jjtree) CastExpression */
- try {
- /*@egen*/
- // SYNTACTIC_LOOKAHEAD
- LOOKAHEAD( "(" PrimitiveType() ) "(" Type() ")" UnaryExpression()
- |
- "(" Type() ")" UnaryExpressionNotPlusMinus()/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void PrimaryExpression() : {/*@bgen(jjtree) PrimaryExpression */
- BSHPrimaryExpression jjtn000 = new BSHPrimaryExpression(JJTPRIMARYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ }
- {/*@bgen(jjtree) PrimaryExpression */
- try {
- /*@egen*/
- PrimaryPrefix() ( PrimarySuffix() )*/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- // The MethodInvocation node here simplifies the prefix/suffix parsing a bit
- // by forcing the prefix to an object.
- void PrimaryPrefix() : { }
- {
- Literal()
- |
- "(" Expression() ")"
- |
- AllocationExpression()
- |
- // SYNTACTIC_LOOKAHEAD
- LOOKAHEAD( Type() "." "class" )
- Type()
- |/*@bgen(jjtree) #MethodInvocation(> 1) */
- {
- BSHMethodInvocation jjtn001 = new BSHMethodInvocation(JJTMETHODINVOCATION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*/
- /*
- Handle method invocation OR straight ambigous name...
- (probably should just write this as two rules more clearly)
- */
- ( AmbiguousName() [ Arguments() ] )/*@bgen(jjtree)*/
- } catch (Throwable jjte001) {
- if (jjtc001) {
- jjtree.clearNodeScope(jjtn001);
- jjtc001 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte001 instanceof RuntimeException) {
- throw (RuntimeException)jjte001;
- }
- if (jjte001 instanceof ParseException) {
- throw (ParseException)jjte001;
- }
- throw (Error)jjte001;
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/
- /*
- |
- LOOKAHEAD( "void" "." "class" )
- */
- }
- void PrimarySuffix() :
- {/*@bgen(jjtree) PrimarySuffix */
- BSHPrimarySuffix jjtn000 = new BSHPrimarySuffix(JJTPRIMARYSUFFIX);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/
- Token t = null;
- }
- {/*@bgen(jjtree) PrimarySuffix */
- try {
- /*@egen*/
- LOOKAHEAD(2)
- "." "class"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.operation = BSHPrimarySuffix.CLASS;
- }
- |
- "[" Expression() "]"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.operation = BSHPrimarySuffix.INDEX;
- }
- |
- // Field access or method invocation
- "." t = <IDENTIFIER> [ Arguments() ]/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.operation = BSHPrimarySuffix.NAME;
- jjtn000.field = t.image;
- }
- |
- "{" Expression() "}"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.operation = BSHPrimarySuffix.PROPERTY;
- }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- /*
- For inner classes
- |
- LOOKAHEAD(2)
- "." AllocationExpression()
- */
- }
- /*
- Begin LHS part of the grammar --
- The reason this stuff is duplicated (e.g. LHSPrimaryPrefix and
- PrimaryPrefix) is that the whole grammar splits based on whether we
- are preparig to do an assignment or not. This is an important issue
- to revisit in the future.
- */
- /**
- The method invocation is here to force this to an object type in order
- to simplify the suffix processing.
- */
- void LHSPrimaryPrefix() : { }
- {/*@bgen(jjtree) #MethodInvocation(> 1) */
- {
- BSHMethodInvocation jjtn001 = new BSHMethodInvocation(JJTMETHODINVOCATION);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- jjtreeOpenNodeScope(jjtn001);
- }
- try {
- /*@egen*/
- /*
- Method invocation or simple ambiguous name.
- (probably should just write this as two rules more clearly)
- */
- ( AmbiguousName() [ Arguments() ] )/*@bgen(jjtree)*/
- } catch (Throwable jjte001) {
- if (jjtc001) {
- jjtree.clearNodeScope(jjtn001);
- jjtc001 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte001 instanceof RuntimeException) {
- throw (RuntimeException)jjte001;
- }
- if (jjte001 instanceof ParseException) {
- throw (ParseException)jjte001;
- }
- throw (Error)jjte001;
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1);
- jjtreeCloseNodeScope(jjtn001);
- }
- }
- /*@egen*/
- }
- void LHSPrimaryExpression() : {/*@bgen(jjtree) LHSPrimaryExpression */
- BSHLHSPrimaryExpression jjtn000 = new BSHLHSPrimaryExpression(JJTLHSPRIMARYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ }
- {/*@bgen(jjtree) LHSPrimaryExpression */
- try {
- /*@egen*/
- LHSPrimaryPrefix() ( LHSPrimarySuffix( ) )*/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void LHSPrimarySuffix() :
- {/*@bgen(jjtree) LHSPrimarySuffix */
- BSHLHSPrimarySuffix jjtn000 = new BSHLHSPrimarySuffix(JJTLHSPRIMARYSUFFIX);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/
- Token t=null, t1, t2 = null;
- }
- {/*@bgen(jjtree) LHSPrimarySuffix */
- try {
- /*@egen*/
- // Indexed to a field
- "[" Expression() "]"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.operation = BSHLHSPrimarySuffix.INDEX;
- }
- |
- // Field access or method invocation followed by field access
- "." t1 = <IDENTIFIER> [ Arguments() "." t2 = <IDENTIFIER> ]/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.operation = BSHLHSPrimarySuffix.NAME;
- if ( t2 == null )
- jjtn000.field = t1.image;
- else {
- jjtn000.method = t1.image;
- jjtn000.field = t2.image;
- }
- }
- |
- "{" Expression() "}"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.operation = BSHLHSPrimarySuffix.PROPERTY;
- }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- /*
- -- End LHS part of the grammar
- */
- void Literal() :
- {/*@bgen(jjtree) Literal */
- BSHLiteral jjtn000 = new BSHLiteral(JJTLITERAL);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/
- Token x;
- boolean b;
- String literal;
- char ch;
- }
- {/*@bgen(jjtree) Literal */
- try {
- /*@egen*/
- x = <INTEGER_LITERAL>/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/
- {
- literal = x.image;
- ch = literal.charAt(literal.length()-1);
- if(ch == 'l' || ch == 'L')
- {
- literal = literal.substring(0,literal.length()-1);
- // This really should be Long.decode, but there isn't one. As a result,
- // hex and octal literals ending in 'l' or 'L' don't work.
- jjtn000.value = new Primitive( new Long( literal ) );
- }
- else
- jjtn000.value = new Primitive( Integer.decode( literal ) );
- }
- |
- x = <FLOATING_POINT_LITERAL>/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/
- {
- literal = x.image;
- ch = literal.charAt(literal.length()-1);
- if(ch == 'f' || ch == 'F')
- {
- literal = literal.substring(0,literal.length()-1);
- jjtn000.value = new Primitive( new Float( literal ) );
- }
- else
- {
- if(ch == 'd' || ch == 'D')
- literal = literal.substring(0,literal.length()-1);
- jjtn000.value = new Primitive( new Double( literal ) );
- }
- }
- |
- x = <CHARACTER_LITERAL>/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- try {
- jjtn000.charSetup( x.image.substring(1, x.image.length() - 1) );
- } catch ( Exception e ) {
- throw new ParseException("Error parsing character: "+x.image);
- }
- }
- |
- x = <STRING_LITERAL>/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- try {
- jjtn000.stringSetup( x.image.substring(1, x.image.length() - 1) );
- } catch ( Exception e ) {
- throw new ParseException("Error parsing string: "+x.image);
- }
- }
- |
- b = BooleanLiteral()/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.value = new Primitive( new Boolean(b) ); }
- |
- NullLiteral()/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.value = Primitive.NULL;
- }
- |
- VoidLiteral()/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ {
- jjtn000.value = Primitive.VOID; }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- boolean BooleanLiteral() :
- {}
- {
- "true" { return true; }
- |
- "false" { return false; }
- }
- void NullLiteral() :
- {}
- {
- "null"
- }
- void VoidLiteral() :
- {}
- {
- "void"
- }
- void Arguments() :
- {/*@bgen(jjtree) Arguments */
- BSHArguments jjtn000 = new BSHArguments(JJTARGUMENTS);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ }
- {/*@bgen(jjtree) Arguments */
- try {
- /*@egen*/
- "(" [ ArgumentList() ] ")"/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- // leave these on the stack for Arguments() to handle
- void ArgumentList() :
- { }
- {
- Expression()
- ( "," Expression() )*
- }
- void AllocationExpression() :
- {/*@bgen(jjtree) AllocationExpression */
- BSHAllocationExpression jjtn000 = new BSHAllocationExpression(JJTALLOCATIONEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/ }
- {/*@bgen(jjtree) AllocationExpression */
- try {
- /*@egen*/
- LOOKAHEAD(2)
- "new" PrimitiveType() ArrayDimensions()
- |
- "new" AmbiguousName()
- (
- ArrayDimensions()
- |
- // SYNTACTIC_LOOKAHEAD
- Arguments() [ LOOKAHEAD(2) Block() ]
- )/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void ArrayDimensions() :
- {/*@bgen(jjtree) ArrayDimensions */
- BSHArrayDimensions jjtn000 = new BSHArrayDimensions(JJTARRAYDIMENSIONS);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/}
- {/*@bgen(jjtree) ArrayDimensions */
- try {
- /*@egen*/
- LOOKAHEAD(2)
- ( LOOKAHEAD(2) "[" Expression() "]" { jjtn000.addArrayDimension(); } )+
- // Removed trailing "[]" identifiers. Specify array dims fully.
- |
- ( "[" "]" { jjtn000.addArrayDimension(); } )+ ArrayInitializer()/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- /*
- * Statement syntax follows.
- */
- void Statement() : { }
- {
- LOOKAHEAD(2)
- LabeledStatement()
- |
- Block()
- |
- EmptyStatement()
- |
- StatementExpression() ";"
- |
- SwitchStatement()
- |
- IfStatement()
- |
- WhileStatement()
- |
- DoStatement()
- |
- ForStatement()
- |
- BreakStatement()
- |
- ContinueStatement()
- |
- ReturnStatement()
- |
- ThrowStatement()
- |
- TryStatement()
- }
- void LabeledStatement() :
- {}
- {
- <IDENTIFIER> ":" Statement()
- }
- void Block() :
- {/*@bgen(jjtree) Block */
- BSHBlock jjtn000 = new BSHBlock(JJTBLOCK);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/}
- {/*@bgen(jjtree) Block */
- try {
- /*@egen*/
- "{" ( BlockStatement() )* "}"/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void BlockStatement() :
- {}
- {
- // SYNTACTIC_LOOKAHEAD
- LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration()
- |
- // SYNTACTIC_LOOKAHEAD
- LOOKAHEAD([ "final" ] Type() <IDENTIFIER>)
- TypedVariableDeclaration() ";"
- |
- Statement()
- /* end */
- |
- // Allow BeanShell imports in any block
- ImportDeclaration()
- }
- void EmptyStatement() :
- {}
- {
- ";"
- }
- void StatementExpression() :
- /*
- * The last expansion of this production accepts more than the legal
- * Java expansions for StatementExpression.
- */
- { }
- {
- PreIncrementExpression()
- |
- PreDecrementExpression()
- |
- // SYNTACTIC_LOOKAHEAD
- LOOKAHEAD( PrimaryExpression() AssignmentOperator() )
- Assignment() { }
- |
- PostfixExpression()
- }
- void SwitchStatement() :
- {/*@bgen(jjtree) SwitchStatement */
- BSHSwitchStatement jjtn000 = new BSHSwitchStatement(JJTSWITCHSTATEMENT);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/}
- {/*@bgen(jjtree) SwitchStatement */
- try {
- /*@egen*/
- "switch" "(" Expression() ")" "{"
- ( SwitchLabel() ( BlockStatement() )* )*
- "}"/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void SwitchLabel() :
- {/*@bgen(jjtree) SwitchLabel */
- BSHSwitchLabel jjtn000 = new BSHSwitchLabel(JJTSWITCHLABEL);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/}
- {/*@bgen(jjtree) SwitchLabel */
- try {
- /*@egen*/
- "case" Expression() ":"
- |
- "default" ":"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/ { jjtn000.isDefault = true; }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void IfStatement() :
- /*
- * The disambiguating algorithm of JavaCC automatically binds dangling
- * else's to the innermost if statement. The LOOKAHEAD specification
- * is to tell JavaCC that we know what we are doing.
- */
- {/*@bgen(jjtree) IfStatement */
- BSHIfStatement jjtn000 = new BSHIfStatement(JJTIFSTATEMENT);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/}
- {/*@bgen(jjtree) IfStatement */
- try {
- /*@egen*/
- "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ]/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void WhileStatement() :
- {/*@bgen(jjtree) WhileStatement */
- BSHWhileStatement jjtn000 = new BSHWhileStatement(JJTWHILESTATEMENT);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/}
- {/*@bgen(jjtree) WhileStatement */
- try {
- /*@egen*/
- "while" "(" Expression() ")" Statement()/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- /*
- Do statement is just a While statement with a special hook to execute
- at least once.
- */
- void DoStatement() :
- {/*@bgen(jjtree) WhileStatement */
- BSHWhileStatement jjtn000 = new BSHWhileStatement(JJTWHILESTATEMENT);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- jjtreeOpenNodeScope(jjtn000);
- /*@egen*/}
- {/*@bgen(jjtree) WhileStatement */
- try {
- /*@egen*/
- "do" Statement() "while" "(" Expression() ")" ";"/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtreeCloseNodeScope(jjtn000);
- }
- /*@egen*/
- { jjtn000.isDoStatement=true; }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- jjtreeCloseNodeScope(jjtn000);
- }
- }
- /*@egen*/
- }
- void ForStatement() :
- {/*@bgen(jjtree) ForStatement */
- BSHForStatement jjtn000 = new BSHForStatement(JJTFORSTATEMENT);
- boolean jjtc000 = true;
- jjtree.openNo