expressionparser.java
来自「jpda例子文件」· Java 代码 · 共 2,349 行 · 第 1/5 页
JAVA
2,349 行
break; case GT: tok = jj_consume_token(GT); break; case LE: tok = jj_consume_token(LE); break; case GE: tok = jj_consume_token(GE); break; default: jj_la1[16] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ShiftExpression(); LValue left = pop(); push( LValue.booleanOperation(vm, tok, pop(), left) ); } } final public void ShiftExpression() throws ParseException { AdditiveExpression(); label_11: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LSHIFT: case RSIGNEDSHIFT: case RUNSIGNEDSHIFT: ; break; default: jj_la1[17] = jj_gen; break label_11; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LSHIFT: jj_consume_token(LSHIFT); break; case RSIGNEDSHIFT: jj_consume_token(RSIGNEDSHIFT); break; case RUNSIGNEDSHIFT: jj_consume_token(RUNSIGNEDSHIFT); break; default: jj_la1[18] = jj_gen; jj_consume_token(-1); throw new ParseException(); } AdditiveExpression(); {if (true) throw new ParseException("operation not yet supported");} } } final public void AdditiveExpression() throws ParseException { Token tok; MultiplicativeExpression(); label_12: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: case MINUS: ; break; default: jj_la1[19] = jj_gen; break label_12; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: tok = jj_consume_token(PLUS); break; case MINUS: tok = jj_consume_token(MINUS); break; default: jj_la1[20] = jj_gen; jj_consume_token(-1); throw new ParseException(); } MultiplicativeExpression(); LValue left = pop(); push( LValue.operation(vm, tok, pop(), left, frameGetter) ); } } final public void MultiplicativeExpression() throws ParseException { Token tok; UnaryExpression(); label_13: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STAR: case SLASH: case REM: ; break; default: jj_la1[21] = jj_gen; break label_13; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STAR: tok = jj_consume_token(STAR); break; case SLASH: tok = jj_consume_token(SLASH); break; case REM: tok = jj_consume_token(REM); break; default: jj_la1[22] = jj_gen; jj_consume_token(-1); throw new ParseException(); } UnaryExpression(); LValue left = pop(); push( LValue.operation(vm, tok, pop(), left, frameGetter) ); } } final public void UnaryExpression() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: case MINUS: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: jj_consume_token(PLUS); break; case MINUS: jj_consume_token(MINUS); break; default: jj_la1[23] = jj_gen; jj_consume_token(-1); throw new ParseException(); } UnaryExpression(); {if (true) throw new ParseException("operation not yet supported");} break; case INCR: PreIncrementExpression(); break; case DECR: PreDecrementExpression(); break; case FALSE: case NEW: case NULL: case SUPER: case THIS: case TRUE: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case BANG: case TILDE: UnaryExpressionNotPlusMinus(); break; default: jj_la1[24] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } final public void PreIncrementExpression() throws ParseException { jj_consume_token(INCR); PrimaryExpression(); {if (true) throw new ParseException("operation not yet supported");} } final public void PreDecrementExpression() throws ParseException { jj_consume_token(DECR); PrimaryExpression(); {if (true) throw new ParseException("operation not yet supported");} } final public void UnaryExpressionNotPlusMinus() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BANG: case TILDE: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TILDE: jj_consume_token(TILDE); break; case BANG: jj_consume_token(BANG); break; default: jj_la1[25] = jj_gen; jj_consume_token(-1); throw new ParseException(); } UnaryExpression(); {if (true) throw new ParseException("operation not yet supported");} break; default: jj_la1[26] = jj_gen; if (jj_2_3(2147483647)) { CastExpression(); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case FALSE: case NEW: case NULL: case SUPER: case THIS: case TRUE: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: PostfixExpression(); break; default: jj_la1[27] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } }// This production is to determine lookahead only. The LOOKAHEAD specifications// below are not used, but they are there just to indicate that we know about// this. final public void CastLookahead() throws ParseException { if (jj_2_4(2)) { jj_consume_token(LPAREN); PrimitiveType(); } else if (jj_2_5(2147483647)) { jj_consume_token(LPAREN); Name(); jj_consume_token(LBRACKET); jj_consume_token(RBRACKET); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: jj_consume_token(LPAREN); Name(); jj_consume_token(RPAREN); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TILDE: jj_consume_token(TILDE); break; case BANG: jj_consume_token(BANG); break; case LPAREN: jj_consume_token(LPAREN); break; case IDENTIFIER: jj_consume_token(IDENTIFIER); break; case THIS: jj_consume_token(THIS); break; case SUPER: jj_consume_token(SUPER); break; case NEW: jj_consume_token(NEW); break; case FALSE: case NULL: case TRUE: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: Literal(); break; default: jj_la1[28] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: jj_la1[29] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } final public void PostfixExpression() throws ParseException { PrimaryExpression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INCR: case DECR: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INCR: jj_consume_token(INCR); break; case DECR: jj_consume_token(DECR); {if (true) throw new ParseException("operation not yet supported");} break; default: jj_la1[30] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: jj_la1[31] = jj_gen; ; } } final public void CastExpression() throws ParseException { if (jj_2_6(2)) { jj_consume_token(LPAREN); PrimitiveType(); label_14: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: ; break; default: jj_la1[32] = jj_gen; break label_14; } jj_consume_token(LBRACKET); jj_consume_token(RBRACKET); } jj_consume_token(RPAREN); UnaryExpression(); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: jj_consume_token(LPAREN); Name(); label_15: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: ; break; default: jj_la1[33] = jj_gen; break label_15; } jj_consume_token(LBRACKET); jj_consume_token(RBRACKET); } jj_consume_token(RPAREN); UnaryExpressionNotPlusMinus(); break; default: jj_la1[34] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } final public void PrimaryExpression() throws ParseException { PrimaryPrefix(); label_16: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: case LBRACKET: case DOT: ; break; default: jj_la1[35] = jj_gen; break label_16; } PrimarySuffix(); } } final public void PrimaryPrefix() throws ParseException { String name; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case FALSE: case NULL: case TRUE: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: Literal(); break; case IDENTIFIER: name = Name(); push(LValue.makeName(vm, frameGetter, name)); break; case THIS: jj_consume_token(THIS); push(LValue.makeThisObject(vm, frameGetter, token)); break; case SUPER: jj_consume_token(SUPER); jj_consume_token(DOT); jj_consume_token(IDENTIFIER); {if (true) throw new ParseException("operation not yet supported");} break; case LPAREN: jj_consume_token(LPAREN); Expression(); jj_consume_token(RPAREN); break; case NEW: AllocationExpression(); break; default: jj_la1[36] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } final public void PrimarySuffix() throws ParseException { List argList; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: jj_consume_token(LBRACKET); Expression(); jj_consume_token(RBRACKET); LValue index = pop(); push(pop().arrayElementLValue(index)); break; case DOT: jj_consume_token(DOT); jj_consume_token(IDENTIFIER); push(pop().memberLValue(frameGetter, token.image)); break; case LPAREN: argList = Arguments(); peek().invokeWith(argList); break; default: jj_la1[37] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } final public void Literal() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_LITERAL: jj_consume_token(INTEGER_LITERAL); push(LValue.makeInteger(vm, token)); break; case FLOATING_POINT_LITERAL: jj_consume_token(FLOATING_POINT_LITERAL); push(LValue.makeFloat(vm, token)); break; case CHARACTER_LITERAL: jj_consume_token(CHARACTER_LITERAL); push(LValue.makeCharacter(vm, token)); break; case STRING_LITERAL: jj_consume_token(STRING_LITERAL); push(LValue.makeString(vm, token)); break;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?