/* Generated By:JavaCC: Do not edit this line. simplejava.java */ public class simplejava implements simplejavaConstants { /***************************************** * SimpleJava Language Grammar Starts Here *****************************************/ static final public ASTProgram program() throws ParseException { trace_call("program"); try { ASTProgram result; ASTFunctionDefinitions fds;ASTFunctionDefinition fd; ASTClass astclass;ASTClasses classes; classes = new ASTClasses();fds = new ASTFunctionDefinitions(); label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case CLASS: case IDENTIFIER: ; break; default: jj_la1[0] = jj_gen; break label_1; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case CLASS: astclass = ClassDefinition(); classes.addElement(astclass); break; case IDENTIFIER: fd = FunctionDeclaration(); fds.addElement(fd); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(0); result = new ASTProgram(classes, fds, 0); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("program"); } } static final public ASTClass ClassDefinition() throws ParseException { trace_call("ClassDefinition"); try { ASTClass result; Token t;Token name; ASTInstanceVariableDefs variabledefs; ASTVariableDefStatement vd; variabledefs = new ASTInstanceVariableDefs(); t = jj_consume_token(CLASS); name = jj_consume_token(IDENTIFIER); jj_consume_token(LBRACE); label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: ; break; default: jj_la1[2] = jj_gen; break label_2; } vd = VariableDeclarationStatement(); variabledefs.addElement(new ASTInstanceVariableDef(vd.type(), vd.name(), vd.arraydimension(), vd.line())); } jj_consume_token(RBRACE); result = new ASTClass(name.image, variabledefs, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("ClassDefinition"); } } /*Two kinds of Function Declarations: FunctionProtoype or FunctionDefinition. */ static final public ASTFunctionDefinition FunctionDeclaration() throws ParseException { trace_call("FunctionDeclaration"); try { ASTFunctionDefinition result; Token t1;Token t2; ASTFormals formals; ASTStatements body; t1 = jj_consume_token(IDENTIFIER); t2 = jj_consume_token(IDENTIFIER); formals = FormalParameterList(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SEMICOLON: jj_consume_token(SEMICOLON); result = new ASTPrototype(t1.image, t2.image, formals, t1.beginLine); break; case LBRACE: jj_consume_token(LBRACE); body = StatementList(); jj_consume_token(RBRACE); result = new ASTFunction(t1.image, t2.image, formals, body, t1.beginLine); break; default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("FunctionDeclaration"); } } static final public ASTPrototype FunctionPrototype() throws ParseException { trace_call("FunctionPrototype"); try { ASTPrototype result; String type; Token name; ASTFormals formals; Token t; type = FunctionType(); name = jj_consume_token(IDENTIFIER); formals = FormalParameterList(); t = jj_consume_token(SEMICOLON); result = new ASTPrototype(type, name.image, formals, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("FunctionPrototype"); } } static final public ASTFunction FunctionDefinition() throws ParseException { trace_call("FunctionDefinition"); try { ASTFunction result; String type; Token name; ASTFormals formals; ASTStatement body; type = FunctionType(); name = jj_consume_token(IDENTIFIER); formals = FormalParameterList(); jj_consume_token(LBRACE); body = StatementList(); jj_consume_token(RBRACE); result = new ASTFunction(type, name.image, formals, body, name.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("FunctionDefinition"); } } static final public ASTFunctionDefinitions FunctionDefinitions() throws ParseException { trace_call("FunctionDefinitions"); try { ASTFunctionDefinitions result; ASTFunctionDefinition functionDefinition; result = new ASTFunctionDefinitions(); label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: ; break; default: jj_la1[4] = jj_gen; break label_3; } functionDefinition = FunctionDefinition(); result.addElement(functionDefinition); } {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("FunctionDefinitions"); } } static final public String FunctionType() throws ParseException { trace_call("FunctionType"); try { Token t; t = jj_consume_token(IDENTIFIER); {if (true) return t.image;} throw new Error("Missing return statement in function"); } finally { trace_return("FunctionType"); } } static final public String VariableType() throws ParseException { trace_call("VariableType"); try { Token t; t = jj_consume_token(IDENTIFIER); {if (true) return t.image;} throw new Error("Missing return statement in function"); } finally { trace_return("VariableType"); } } // 5th Expression /*void NewExpression(): {} { LOOKAHEAD(3) VariableType() | VariableType()Variable()()* }*/ static final public ASTNewClassExpression NewClassExpression() throws ParseException { trace_call("NewClassExpression"); try { ASTNewClassExpression result; String type; Token t; t = jj_consume_token(NEW); type = VariableType(); jj_consume_token(LPAREN); jj_consume_token(RPAREN); result = new ASTNewClassExpression(type, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("NewClassExpression"); } } static final public ASTNewArrayExpression NewArrayExpression() throws ParseException { trace_call("NewArrayExpression"); try { ASTNewArrayExpression result; Token t; String type; ASTExpression elements;int arraydimension; arraydimension=0; t = jj_consume_token(NEW); type = VariableType(); jj_consume_token(LBRACKET); elements = integerConstant(); jj_consume_token(RBRACKET); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: ; break; default: jj_la1[5] = jj_gen; break label_4; } jj_consume_token(LBRACKET); jj_consume_token(RBRACKET); arraydimension++; } result = new ASTNewArrayExpression(type, elements, arraydimension, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("NewArrayExpression"); } } static final public ASTFormals FormalParameterList() throws ParseException { trace_call("FormalParameterList"); try { ASTFormals result; ASTFormal formal; result =new ASTFormals(); jj_consume_token(LPAREN); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: formal = FormalParameter(); result.addElement(formal); label_5: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[6] = jj_gen; break label_5; } jj_consume_token(COMMA); formal = FormalParameter(); result.addElement(formal); } break; default: jj_la1[7] = jj_gen; ; } jj_consume_token(RPAREN); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("FormalParameterList"); } } static final public ASTFormal FormalParameter() throws ParseException { trace_call("FormalParameter"); try { String type; Token name;ASTFormal result;int arraydimension; arraydimension=0; type = VariableType(); name = jj_consume_token(IDENTIFIER); label_6: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: ; break; default: jj_la1[8] = jj_gen; break label_6; } jj_consume_token(LBRACKET); jj_consume_token(RBRACKET); arraydimension++; } result = new ASTFormal(type, name.image, arraydimension, name.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("FormalParameter"); } } /* All Expressions are OrOperatorExpression, and put NewArrayExpression and NewClassExpression in the bottom of OrOperatorExpression.*/ /* ASTExpression Expression(): {ASTExpression result;} { LOOKAHEAD(3) FunctionCall()|LOOKAHEAD(3) OrOperatorExpression() |LOOKAHEAD(2) Variable()| ConstantExpression()| NewExpression() LOOKAHEAD(3) result = FunctionCall()|LOOKAHEAD(3) result = OrOperatorExpression() |LOOKAHEAD(3) var = Variable() {result = new ASTVariableExpression(var, var.line());} | result = booleanConstant()|result = integerConstant()|LOOKAHEAD(3)result = NewClassExpression() | LOOKAHEAD(3)result = NewArrayExpression()/ {result = NewClassExpression();} | {result = NewArrayExpression();} | {result = OrOperatorExpression();} {return result;} }*/ // Two kinds of constant expression: boolean or integer. static final public ASTBooleanLiteral booleanConstant() throws ParseException { trace_call("booleanConstant"); try { ASTBooleanLiteral result; Token t; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TRUE: t = jj_consume_token(TRUE); break; case FALSE: t = jj_consume_token(FALSE); break; default: jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } result = new ASTBooleanLiteral(Boolean.valueOf(t.image), t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("booleanConstant"); } } static final public ASTIntegerLiteral integerConstant() throws ParseException { trace_call("integerConstant"); try { ASTIntegerLiteral result; Token t; t = jj_consume_token(INTEGER_LITERAL); result = new ASTIntegerLiteral(Integer.parseInt(t.image), t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("integerConstant"); } } // First Expression. /*void ConstantExpression(): {} { || } */ // Three kinds of variables: BaseVariable, ClassVariable, ArrayVariable. //B = id; C=V.id; A=V[exp]; V =A|B|C; So: // V = id([exp] | (.id))*, V is ArrayVariable if ended with [exp], V is ClassVariable if ended with (.id);So I added base() to be id([exp]|(.id))*. static final public ASTVariable Variable() throws ParseException { trace_call("Variable"); try { ASTVariable tmp; ASTExpression exp;Token t; tmp = baseVariable(); label_7: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: case PERIOD: ; break; default: jj_la1[10] = jj_gen; break label_7; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: jj_consume_token(LBRACKET); exp = OrOperatorExpression(); jj_consume_token(RBRACKET); tmp = new ASTArrayVariable(tmp, exp, tmp.line()); break; case PERIOD: jj_consume_token(PERIOD); t = jj_consume_token(IDENTIFIER); tmp = new ASTClassVariable(tmp, t.image, tmp.line()); break; default: jj_la1[11] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } {if (true) return tmp;} throw new Error("Missing return statement in function"); } finally { trace_return("Variable"); } } static final public ASTBaseVariable baseVariable() throws ParseException { trace_call("baseVariable"); try { ASTBaseVariable result ; Token t; t = jj_consume_token(IDENTIFIER); result = new ASTBaseVariable(t.image, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("baseVariable"); } } /* ASTVariable base(): {ASTVariable result; ASTExpression exp; Token t;} { t=(exp = Expression()| ())* {result = new ASTVariable();} {return result;} } ASTArrayVariable arrayVariable(): {ASTArrayVariable result; ASTVariable base; ASTExpression index;} { base = Variable() index = Expression() {result = new ASTArrayVariable(base,index,base.line());} {return result;} // (Variable())? } ASTClassVariable classVariable(): {ASTClassVariable result; ASTVariable base; Token t; } { base = Variable()( t=)* {result = new ASTClassVariable(base,t.image,t.beginLine);} {return result;} // LOOKAHEAD(2)()* //| (ArrayVariable())* } */ // Three built-in function: readfunction,printfunction and printlnfunction. static final public ASTFunctionCallExpression ReadFunctionCall() throws ParseException { trace_call("ReadFunctionCall"); try { ASTFunctionCallExpression result; Token t; // t = jj_consume_token(READ); jj_consume_token(LPAREN); jj_consume_token(RPAREN); result = new ASTFunctionCallExpression(t.image, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("ReadFunctionCall"); } } //TODO make sure print(int value) static final public ASTFunctionCallExpression PrintFunctionCall() throws ParseException { trace_call("PrintFunctionCall"); try { Token t; ASTExpression param; ASTVariable var; ASTFunctionCallExpression result; // FormalParameterList() t = jj_consume_token(PRINT); jj_consume_token(LPAREN); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_LITERAL: param = integerConstant(); break; case IDENTIFIER: var = Variable(); param = new ASTVariableExpression(var, var.line()); break; default: jj_la1[12] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(RPAREN); result = new ASTFunctionCallExpression(t.image, param, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("PrintFunctionCall"); } } static final public ASTFunctionCallExpression PrintlnFunctionCall() throws ParseException { trace_call("PrintlnFunctionCall"); try { ASTFunctionCallExpression result; Token t; t = jj_consume_token(PRINTLN); jj_consume_token(LPAREN); jj_consume_token(RPAREN); result = new ASTFunctionCallExpression(t.image, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("PrintlnFunctionCall"); } } static final public ASTFunctionCallExpression CustomizedFunctionCall() throws ParseException { trace_call("CustomizedFunctionCall"); try { ASTFunctionCallExpression result; Token t; ASTExpression formal; t = jj_consume_token(IDENTIFIER); jj_consume_token(LPAREN); label_8: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NEW: case READ: case PRINT: case PRINTLN: case INTEGER_LITERAL: case IDENTIFIER: case MINUS: case LPAREN: ; break; default: jj_la1[13] = jj_gen; break label_8; } formal = OrOperatorExpression(); } jj_consume_token(RPAREN); result = new ASTFunctionCallExpression(t.image, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("CustomizedFunctionCall"); } } //Three built-in function and a customized function. static final public ASTFunctionCallExpression FunctionCall() throws ParseException { trace_call("FunctionCall"); try { ASTFunctionCallExpression result; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case READ: /* ReadFunctionCall() | PrintFunctionCall() | PrintlnFunctionCall() | CustomizedFunctionCall() */ result = ReadFunctionCall(); break; case PRINT: result = PrintFunctionCall(); break; case PRINTLN: result = PrintlnFunctionCall(); break; case IDENTIFIER: result = CustomizedFunctionCall(); {if (true) return result;} break; default: jj_la1[14] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); } finally { trace_return("FunctionCall"); } } //The OperatorExpression static final public ASTExpression OrOperatorExpression() throws ParseException { trace_call("OrOperatorExpression"); try { ASTExpression result; ASTExpression andExp; Token t; result = AndExpression(); label_9: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OR: ; break; default: jj_la1[15] = jj_gen; break label_9; } t = jj_consume_token(OR); andExp = AndExpression(); result = new ASTOperatorExpression(andExp, andExp, 6, t.beginLine); } {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("OrOperatorExpression"); } } static final public ASTExpression AndExpression() throws ParseException { trace_call("AndExpression"); try { ASTExpression result; Token t; ASTExpression lhs; ASTExpression rhs; result = NotExpression(); label_10: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case AND: ; break; default: jj_la1[16] = jj_gen; break label_10; } t = jj_consume_token(AND); rhs = NotExpression(); result = new ASTOperatorExpression(result, rhs, 5, t.beginLine); } {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("AndExpression"); } } static final public ASTExpression NotExpression() throws ParseException { trace_call("NotExpression"); try { ASTExpression result; ASTExpression operand; Token t; result = CompareExpression(); label_11: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NOT: ; break; default: jj_la1[17] = jj_gen; break label_11; } t = jj_consume_token(NOT); operand = CompareExpression(); result = new ASTUnaryOperatorExpression(operand, t.image, t.beginLine); } {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("NotExpression"); } } static final public ASTExpression CompareExpression() throws ParseException { trace_call("CompareExpression"); try { ASTExpression result; ASTExpression rhs; Token t; result = MathExpression(); label_12: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EQUALEQUAL: case NOTEQUALTO: case LESSTHAN: case LESSTHANOREQUALTO: case GREATERTHAN: case GREATERTHANOREQUALTO: ; break; default: jj_la1[18] = jj_gen; break label_12; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EQUALEQUAL: t = jj_consume_token(EQUALEQUAL); break; case NOTEQUALTO: t = jj_consume_token(NOTEQUALTO); break; case LESSTHAN: t = jj_consume_token(LESSTHAN); break; case LESSTHANOREQUALTO: t = jj_consume_token(LESSTHANOREQUALTO); break; case GREATERTHAN: t = jj_consume_token(GREATERTHAN); break; case GREATERTHANOREQUALTO: t = jj_consume_token(GREATERTHANOREQUALTO); break; default: jj_la1[19] = jj_gen; jj_consume_token(-1); throw new ParseException(); } rhs = MathExpression(); result = new ASTOperatorExpression(result,rhs,t.image,t.beginLine); } {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("CompareExpression"); } } static final public ASTExpression MathExpression() throws ParseException { trace_call("MathExpression"); try { ASTExpression result; Token t; ASTExpression rhs; result = term(); label_13: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: case MINUS: ; break; default: jj_la1[20] = jj_gen; break label_13; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: t = jj_consume_token(PLUS); break; case MINUS: t = jj_consume_token(MINUS); break; default: jj_la1[21] = jj_gen; jj_consume_token(-1); throw new ParseException(); } rhs = term(); result = new ASTOperatorExpression(result, rhs, t.image, t.beginLine); } {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("MathExpression"); } } static final public ASTExpression term() throws ParseException { trace_call("term"); try { Token t;ASTExpression result; ASTExpression rhs; // factor() ( ( | ) factor() )* result = factor(); label_14: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MULTIPLY: case DIVIDE: ; break; default: jj_la1[22] = jj_gen; break label_14; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MULTIPLY: t = jj_consume_token(MULTIPLY); break; case DIVIDE: t = jj_consume_token(DIVIDE); break; default: jj_la1[23] = jj_gen; jj_consume_token(-1); throw new ParseException(); } rhs = factor(); result = new ASTOperatorExpression(result, rhs, t.image, t.beginLine); } {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("term"); } } static final public ASTExpression factor() throws ParseException { trace_call("factor"); try { ASTExpression result; Token t; ASTVariable variableExp; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_LITERAL: t = jj_consume_token(INTEGER_LITERAL); {if (true) return new ASTIntegerLiteral(Integer.parseInt(t.image), t.beginLine);} break; case MINUS: t = jj_consume_token(MINUS); result = factor(); {if (true) return new ASTOperatorExpression(new ASTIntegerLiteral(0, t.beginLine), result, ASTOperatorExpression.MINUS,t.beginLine);} break; default: jj_la1[24] = jj_gen; if (jj_2_1(2)) { variableExp = Variable(); {if (true) return new ASTVariableExpression(variableExp,variableExp.line());} } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: jj_consume_token(LPAREN); result = OrOperatorExpression(); jj_consume_token(RPAREN); {if (true) return result;} break; case READ: case PRINT: case PRINTLN: case IDENTIFIER: result = FunctionCall(); {if (true) return result;} break; default: jj_la1[25] = jj_gen; if (jj_2_2(3)) { result = NewClassExpression(); {if (true) return result;} } else if (jj_2_3(3)) { result = NewArrayExpression(); {if (true) return result;} } else { jj_consume_token(-1); throw new ParseException(); } } } } throw new Error("Missing return statement in function"); } finally { trace_return("factor"); } } // zero or more statements. static final public ASTStatements StatementList() throws ParseException { trace_call("StatementList"); try { ASTStatements result; ASTStatement statement; result = new ASTStatements(); label_15: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case FOR: case IF: case WHILE: case DO: case RETURN: case IDENTIFIER: case SEMICOLON: case LBRACE: ; break; default: jj_la1[26] = jj_gen; break label_15; } statement = Statement(); result.addElement(statement); } {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("StatementList"); } } // 11 kinds of statement // Assignment, Increment, Block are ASTStatement; static final public ASTStatement Statement() throws ParseException { trace_call("Statement"); try { ASTStatement result; if (jj_2_4(3)) { result = AssignmentStatement(); {if (true) return result;} } else if (jj_2_5(3)) { result = IncrementStatement(); {if (true) return result;} } else if (jj_2_6(2)) { result = VariableDeclarationStatement(); {if (true) return result;} } else if (jj_2_7(3)) { result = IfStatement(); {if (true) return result;} } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WHILE: result = WhileStatement(); {if (true) return result;} break; case DO: result = DoWhileStatement(); {if (true) return result;} break; case FOR: result = ForStatement(); {if (true) return result;} break; case IDENTIFIER: result = FunctionCallStatement(); {if (true) return result;} break; case RETURN: result = ReturnStatement(); {if (true) return result;} break; case SEMICOLON: result = EmptyStatement(); {if (true) return result;} break; case LBRACE: result = BlockStatement(); {if (true) return result;} break; default: jj_la1[27] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } throw new Error("Missing return statement in function"); } finally { trace_return("Statement"); } } static final public ASTAssignmentStatement AssignmentStatement() throws ParseException { trace_call("AssignmentStatement"); try { ASTAssignmentStatement result; ASTVariable variable; ASTExpression value;Token t; variable = Variable(); t = jj_consume_token(GETS); value = OrOperatorExpression(); jj_consume_token(SEMICOLON); result = new ASTAssignmentStatement(variable,value,t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("AssignmentStatement"); } } // Incrementstatement just like ++ or -- : x++ converted to x=x+1 static final public ASTAssignmentStatement IncrementStatement() throws ParseException { trace_call("IncrementStatement"); try { ASTAssignmentStatement result; ASTVariable variable; Token t; ASTExpression value; ASTOperatorExpression operatorExp; if (jj_2_8(3)) { variable = Variable(); t = jj_consume_token(PLUS); jj_consume_token(PLUS); } else if (jj_2_9(3)) { variable = Variable(); t = jj_consume_token(MINUS); jj_consume_token(MINUS); result = new ASTAssignmentStatement(variable, new ASTOperatorExpression(new ASTVariableExpression(variable, variable.line()), new ASTIntegerLiteral(1, variable.line()),t.image,t.beginLine), t.beginLine); {if (true) return result;} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); } finally { trace_return("IncrementStatement"); } } // result = new ASTAssignmentStatement(variable, new ASTOperatorExpression(value,Integer.parseInt(),1,value.line())); // x = x+1 , this is an assignment statement, x is a variable, x+1 is an operatorExpression, // 1 is a ASTIntegerLiteral static final public ASTVariableDefStatement VariableDeclarationStatement() throws ParseException { trace_call("VariableDeclarationStatement"); try { ASTVariableDefStatement result; Token type; Token name; ASTExpression init; ASTVariable variable; int arrdim; if (jj_2_10(3)) { init = null; type = jj_consume_token(IDENTIFIER); name = jj_consume_token(IDENTIFIER); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case GETS: jj_consume_token(GETS); init = OrOperatorExpression(); break; default: jj_la1[28] = jj_gen; ; } jj_consume_token(SEMICOLON); result = new ASTVariableDefStatement(type.image, name.image, init, type.beginLine); {if (true) return result;} } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: init = null; arrdim = 0; type = jj_consume_token(IDENTIFIER); name = jj_consume_token(IDENTIFIER); label_16: while (true) { jj_consume_token(LPAREN); jj_consume_token(RPAREN); arrdim++; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: ; break; default: jj_la1[29] = jj_gen; break label_16; } } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case GETS: jj_consume_token(GETS); init = OrOperatorExpression(); break; default: jj_la1[30] = jj_gen; ; } jj_consume_token(SEMICOLON); result = new ASTVariableDefStatement(type.image, name.image, init, type.beginLine); {if (true) return result;} break; default: jj_la1[31] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } throw new Error("Missing return statement in function"); } finally { trace_return("VariableDeclarationStatement"); } } static final public ASTIfStatement IfStatement() throws ParseException { trace_call("IfStatement"); try { Token t; ASTIfStatement result; ASTExpression expression; ASTStatement thenstatement;ASTStatement elseStatement; t = jj_consume_token(IF); jj_consume_token(LPAREN); expression = OrOperatorExpression(); jj_consume_token(RPAREN); thenstatement = Statement(); jj_consume_token(ELSE); elseStatement = Statement(); result = new ASTIfStatement( expression, thenstatement, elseStatement, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("IfStatement"); } } // Expression() Statement() static final public ASTWhileStatement WhileStatement() throws ParseException { trace_call("WhileStatement"); try { Token t; ASTWhileStatement result; ASTExpression test; ASTStatement body; t = jj_consume_token(WHILE); jj_consume_token(LPAREN); test = OrOperatorExpression(); jj_consume_token(RPAREN); body = Statement(); result =new ASTWhileStatement(test, body, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("WhileStatement"); } } static final public ASTDoWhileStatement DoWhileStatement() throws ParseException { trace_call("DoWhileStatement"); try { Token t; ASTDoWhileStatement result; ASTStatement body; ASTExpression test; t = jj_consume_token(DO); body = Statement(); jj_consume_token(WHILE); jj_consume_token(LPAREN); test = OrOperatorExpression(); jj_consume_token(RPAREN); jj_consume_token(SEMICOLON); result = new ASTDoWhileStatement (test,body, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("DoWhileStatement"); } } static final public ASTForStatement ForStatement() throws ParseException { trace_call("ForStatement"); try { Token t; ASTForStatement result; ASTStatement initialize; ASTExpression test; ASTStatement increment; ASTStatement body; // ForInit() Expression() IncrementStatement() < RPAREN> Statement() t = jj_consume_token(FOR); jj_consume_token(LPAREN); initialize = ForInit(); test = OrOperatorExpression(); jj_consume_token(SEMICOLON); increment = IncrementStatement(); jj_consume_token(RPAREN); body = Statement(); result = new ASTForStatement(initialize, test, increment, body, t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("ForStatement"); } } //ForInit: variable declarations, increment statements(which is assignment statement), assignment statements, or empty statements. static final public ASTStatement ForInit() throws ParseException { trace_call("ForInit"); try { ASTStatement result; if (jj_2_11(2)) { result = VariableDeclarationStatement(); } else if (jj_2_12(3)) { result = IncrementStatement(); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: result = AssignmentStatement(); break; case SEMICOLON: result = EmptyStatement(); {if (true) return result;} break; default: jj_la1[32] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } throw new Error("Missing return statement in function"); } finally { trace_return("ForInit"); } } static final public ASTEmptyStatement EmptyStatement() throws ParseException { trace_call("EmptyStatement"); try { ASTEmptyStatement result; Token t; t = jj_consume_token(SEMICOLON); result = new ASTEmptyStatement(t.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("EmptyStatement"); } } //ASTFormal: {arraydimension=0;} type = VariableType() name = ( {arraydimension++;})* /*{result =new ASTFormals();} (formal = FormalParameter() {result.addElement(formal);}( formal = FormalParameter() {result.addElement(formal);})*)? {return result;} */ static final public ASTFunctionCallStatement FunctionCallStatement() throws ParseException { trace_call("FunctionCallStatement"); try { ASTFunctionCallStatement result; Token t; ASTExpression formal; // (Expression()(Expression())*)? t = jj_consume_token(IDENTIFIER); result = new ASTFunctionCallStatement(t.image, t.beginLine); jj_consume_token(LPAREN); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NEW: case READ: case PRINT: case PRINTLN: case INTEGER_LITERAL: case IDENTIFIER: case MINUS: case LPAREN: formal = OrOperatorExpression(); result.addElement(formal); break; default: jj_la1[33] = jj_gen; ; } jj_consume_token(RPAREN); jj_consume_token(SEMICOLON); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("FunctionCallStatement"); } } static final public ASTReturnStatement ReturnStatement() throws ParseException { trace_call("ReturnStatement"); try { ASTReturnStatement result; ASTExpression value;Token t1; Token t2; // Expression() t1 = jj_consume_token(RETURN); value = OrOperatorExpression(); t2 = jj_consume_token(SEMICOLON); result = new ASTReturnStatement(value, t1.beginLine); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("ReturnStatement"); } } static final public ASTStatements BlockStatement() throws ParseException { trace_call("BlockStatement"); try { ASTStatements result; jj_consume_token(LBRACE); result = StatementList(); jj_consume_token(RBRACE); {if (true) return result;} throw new Error("Missing return statement in function"); } finally { trace_return("BlockStatement"); } } static private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_1(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } static private boolean jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_2(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } } static private boolean jj_2_3(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_3(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(2, xla); } } static private boolean jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_4(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } } static private boolean jj_2_5(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_5(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(4, xla); } } static private boolean jj_2_6(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_6(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(5, xla); } } static private boolean jj_2_7(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_7(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(6, xla); } } static private boolean jj_2_8(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_8(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(7, xla); } } static private boolean jj_2_9(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_9(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(8, xla); } } static private boolean jj_2_10(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_10(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(9, xla); } } static private boolean jj_2_11(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_11(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(10, xla); } } static private boolean jj_2_12(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_12(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(11, xla); } } static private boolean jj_3R_21() { Token xsp; xsp = jj_scanpos; if (jj_3_8()) { jj_scanpos = xsp; if (jj_3_9()) return true; } return false; } static private boolean jj_3_8() { if (jj_3R_17()) return true; if (jj_scan_token(PLUS)) return true; if (jj_scan_token(PLUS)) return true; return false; } static private boolean jj_3R_25() { if (jj_scan_token(IDENTIFIER)) return true; return false; } static private boolean jj_3R_32() { if (jj_3R_33()) return true; return false; } static private boolean jj_3_9() { if (jj_3R_17()) return true; if (jj_scan_token(MINUS)) return true; if (jj_scan_token(MINUS)) return true; return false; } static private boolean jj_3R_20() { if (jj_3R_17()) return true; if (jj_scan_token(GETS)) return true; if (jj_3R_28()) return true; return false; } static private boolean jj_3R_17() { if (jj_3R_25()) return true; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_26()) { jj_scanpos = xsp; break; } } return false; } static private boolean jj_3R_28() { if (jj_3R_32()) return true; return false; } static private boolean jj_3R_24() { if (jj_scan_token(GETS)) return true; return false; } static private boolean jj_3R_27() { if (jj_scan_token(IDENTIFIER)) return true; return false; } static private boolean jj_3R_46() { if (jj_3R_50()) return true; return false; } static private boolean jj_3R_45() { if (jj_3R_49()) return true; return false; } static private boolean jj_3R_44() { if (jj_3R_48()) return true; return false; } static private boolean jj_3R_43() { if (jj_3R_47()) return true; return false; } static private boolean jj_3R_42() { Token xsp; xsp = jj_scanpos; if (jj_3R_43()) { jj_scanpos = xsp; if (jj_3R_44()) { jj_scanpos = xsp; if (jj_3R_45()) { jj_scanpos = xsp; if (jj_3R_46()) return true; } } } return false; } static private boolean jj_3_6() { if (jj_3R_22()) return true; return false; } static private boolean jj_3_12() { if (jj_3R_21()) return true; return false; } static private boolean jj_3R_50() { if (jj_scan_token(IDENTIFIER)) return true; return false; } static private boolean jj_3_5() { if (jj_3R_21()) return true; return false; } static private boolean jj_3_7() { if (jj_3R_23()) return true; return false; } static private boolean jj_3_11() { if (jj_3R_22()) return true; return false; } static private boolean jj_3_4() { if (jj_3R_20()) return true; return false; } static private boolean jj_3R_49() { if (jj_scan_token(PRINTLN)) return true; return false; } static private boolean jj_3R_48() { if (jj_scan_token(PRINT)) return true; return false; } static private boolean jj_3_3() { if (jj_3R_19()) return true; return false; } static private boolean jj_3_2() { if (jj_3R_18()) return true; return false; } static private boolean jj_3R_41() { if (jj_3R_42()) return true; return false; } static private boolean jj_3R_40() { if (jj_scan_token(LPAREN)) return true; return false; } static private boolean jj_3R_47() { if (jj_scan_token(READ)) return true; return false; } static private boolean jj_3R_37() { Token xsp; xsp = jj_scanpos; if (jj_3R_38()) { jj_scanpos = xsp; if (jj_3R_39()) { jj_scanpos = xsp; if (jj_3_1()) { jj_scanpos = xsp; if (jj_3R_40()) { jj_scanpos = xsp; if (jj_3R_41()) { jj_scanpos = xsp; if (jj_3_2()) { jj_scanpos = xsp; if (jj_3_3()) return true; } } } } } } return false; } static private boolean jj_3R_38() { if (jj_scan_token(INTEGER_LITERAL)) return true; return false; } static private boolean jj_3_1() { if (jj_3R_17()) return true; return false; } static private boolean jj_3R_39() { if (jj_scan_token(MINUS)) return true; return false; } static private boolean jj_3R_36() { if (jj_3R_37()) return true; return false; } static private boolean jj_3R_35() { if (jj_3R_36()) return true; return false; } static private boolean jj_3R_31() { if (jj_scan_token(PERIOD)) return true; if (jj_scan_token(IDENTIFIER)) return true; return false; } static private boolean jj_3R_23() { if (jj_scan_token(IF)) return true; if (jj_scan_token(LPAREN)) return true; if (jj_3R_28()) return true; return false; } static private boolean jj_3R_29() { if (jj_scan_token(IDENTIFIER)) return true; if (jj_scan_token(IDENTIFIER)) return true; return false; } static private boolean jj_3R_19() { if (jj_scan_token(NEW)) return true; if (jj_3R_27()) return true; if (jj_scan_token(LBRACKET)) return true; return false; } static private boolean jj_3_10() { if (jj_scan_token(IDENTIFIER)) return true; if (jj_scan_token(IDENTIFIER)) return true; Token xsp; xsp = jj_scanpos; if (jj_3R_24()) jj_scanpos = xsp; if (jj_scan_token(SEMICOLON)) return true; return false; } static private boolean jj_3R_22() { Token xsp; xsp = jj_scanpos; if (jj_3_10()) { jj_scanpos = xsp; if (jj_3R_29()) return true; } return false; } static private boolean jj_3R_26() { Token xsp; xsp = jj_scanpos; if (jj_3R_30()) { jj_scanpos = xsp; if (jj_3R_31()) return true; } return false; } static private boolean jj_3R_30() { if (jj_scan_token(LBRACKET)) return true; if (jj_3R_28()) return true; return false; } static private boolean jj_3R_34() { if (jj_3R_35()) return true; return false; } static private boolean jj_3R_18() { if (jj_scan_token(NEW)) return true; if (jj_3R_27()) return true; if (jj_scan_token(LPAREN)) return true; return false; } static private boolean jj_3R_33() { if (jj_3R_34()) return true; return false; } static private boolean jj_initialized_once = false; /** Generated Token Manager. */ static public simplejavaTokenManager token_source; static JavaCharStream jj_input_stream; /** Current token. */ static public Token token; /** Next token. */ static public Token jj_nt; static private int jj_ntk; static private Token jj_scanpos, jj_lastpos; static private int jj_la; static private int jj_gen; static final private int[] jj_la1 = new int[34]; static private int[] jj_la1_0; static private int[] jj_la1_1; static { jj_la1_init_0(); jj_la1_init_1(); } private static void jj_la1_init_0() { jj_la1_0 = new int[] {0x2010000,0x2010000,0x2000000,0x8000000,0x2000000,0x0,0x0,0x2000000,0x0,0x60000,0x0,0x0,0x3000000,0x93f00000,0x2e00000,0x0,0x0,0x0,0x0,0x0,0x14000000,0x14000000,0x60000000,0x60000000,0x11000000,0x82e00000,0xa087400,0xa086400,0x0,0x80000000,0x0,0x2000000,0xa000000,0x93f00000,}; } private static void jj_la1_init_1() { jj_la1_1 = new int[] {0x0,0x0,0x0,0x2,0x0,0x8,0x40,0x0,0x8,0x0,0x28,0x28,0x0,0x0,0x0,0x10000,0x8000,0x400,0x7a80,0x7a80,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x100,0x0,0x100,0x0,0x0,0x0,}; } static final private JJCalls[] jj_2_rtns = new JJCalls[12]; static private boolean jj_rescan = false; static private int jj_gc = 0; /** Constructor with InputStream. */ public simplejava(java.io.InputStream stream) { this(stream, null); } /** Constructor with InputStream and supplied encoding */ public simplejava(java.io.InputStream stream, String encoding) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new simplejavaTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ static public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } /** Reinitialise. */ static public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Constructor. */ public simplejava(java.io.Reader stream) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; jj_input_stream = new JavaCharStream(stream, 1, 1); token_source = new simplejavaTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ static public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Constructor with generated Token Manager. */ public simplejava(simplejavaTokenManager tm) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(simplejavaTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } static private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } trace_token(token, ""); return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } static private final class LookaheadSuccess extends java.lang.Error { } static final private LookaheadSuccess jj_ls = new LookaheadSuccess(); static private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_scanpos.next; } if (jj_rescan) { int i = 0; Token tok = token; while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } if (tok != null) jj_add_error_token(kind, i); } if (jj_scanpos.kind != kind) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; return false; } /** Get the next Token. */ static final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; trace_token(token, " (in getNextToken)"); return token; } /** Get the specific Token. */ static final public Token getToken(int index) { Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } static private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } static private java.util.List jj_expentries = new java.util.ArrayList(); static private int[] jj_expentry; static private int jj_kind = -1; static private int[] jj_lasttokens = new int[100]; static private int jj_endpos; static private void jj_add_error_token(int kind, int pos) { if (pos >= 100) return; if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; } else if (jj_endpos != 0) { jj_expentry = new int[jj_endpos]; for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { int[] oldentry = (int[])(it.next()); if (oldentry.length == jj_expentry.length) { for (int i = 0; i < jj_expentry.length; i++) { if (oldentry[i] != jj_expentry[i]) { continue jj_entries_loop; } } jj_expentries.add(jj_expentry); break jj_entries_loop; } } if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; } } /** Generate ParseException. */ static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[49]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 34; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<" + where); } } static private void trace_scan(Token t1, int t2) { if (trace_enabled) { for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } System.out.print("Visited token: <" + tokenImage[t1.kind]); if (t1.kind != 0 && !tokenImage[t1.kind].equals("\"" + t1.image + "\"")) { System.out.print(": \"" + t1.image + "\""); } System.out.println(" at line " + t1.beginLine + " column " + t1.beginColumn + ">; Expected token: <" + tokenImage[t2] + ">"); } } static private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 12; i++) { try { JJCalls p = jj_2_rtns[i]; do { if (p.gen > jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; switch (i) { case 0: jj_3_1(); break; case 1: jj_3_2(); break; case 2: jj_3_3(); break; case 3: jj_3_4(); break; case 4: jj_3_5(); break; case 5: jj_3_6(); break; case 6: jj_3_7(); break; case 7: jj_3_8(); break; case 8: jj_3_9(); break; case 9: jj_3_10(); break; case 10: jj_3_11(); break; case 11: jj_3_12(); break; } } p = p.next; } while (p != null); } catch(LookaheadSuccess ls) { } } jj_rescan = false; } static private void jj_save(int index, int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; } p = p.next; } p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; } static final class JJCalls { int gen; Token first; int arg; JJCalls next; } }