📄 javarecognizer.java
字号:
case STRING_LITERAL: case NUM_FLOAT: case NUM_LONG: case NUM_DOUBLE: { e=unaryExpressionNotPlusMinus(); astFactory.addASTChild(currentAST, returnAST); unaryExpression_AST = (AST)currentAST.root; break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = unaryExpression_AST; return e; } public final Expression unaryExpressionNotPlusMinus() throws RecognitionException, TokenStreamException { Expression e = null; returnAST = null; ASTPair currentAST = new ASTPair(); AST unaryExpressionNotPlusMinus_AST = null; Token lpb = null; AST lpb_AST = null; Expression a; Type t; switch ( LA(1)) { case BNOT: { AST tmp37_AST = null; tmp37_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp37_AST); match(BNOT); a=unaryExpression(); astFactory.addASTChild(currentAST, returnAST); if ( inputState.guessing==0 ) { e=new NotExpression(a); } unaryExpressionNotPlusMinus_AST = (AST)currentAST.root; break; } case LNOT: { AST tmp38_AST = null; tmp38_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp38_AST); match(LNOT); a=unaryExpression(); astFactory.addASTChild(currentAST, returnAST); if ( inputState.guessing==0 ) { e=new LogicalNotExpression(a); } unaryExpressionNotPlusMinus_AST = (AST)currentAST.root; break; } default: boolean synPredMatched51 = false; if (((LA(1)==LPAREN) && ((LA(2) >= LITERAL_void && LA(2) <= LITERAL_String)))) { int _m51 = mark(); synPredMatched51 = true; inputState.guessing++; try { { match(LPAREN); builtInTypeSpec(true); match(RPAREN); } } catch (RecognitionException pe) { synPredMatched51 = false; } rewind(_m51); inputState.guessing--; } if ( synPredMatched51 ) { lpb = LT(1); lpb_AST = astFactory.create(lpb); astFactory.makeASTRoot(currentAST, lpb_AST); match(LPAREN); if ( inputState.guessing==0 ) { lpb_AST.setType(TYPECAST); } t=builtInTypeSpec(true); astFactory.addASTChild(currentAST, returnAST); match(RPAREN); a=unaryExpression(); astFactory.addASTChild(currentAST, returnAST); if ( inputState.guessing==0 ) { e=new TypeCastExpression(t,a); } unaryExpressionNotPlusMinus_AST = (AST)currentAST.root; } else if ((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2)))) { e=primaryExpression(); astFactory.addASTChild(currentAST, returnAST); unaryExpressionNotPlusMinus_AST = (AST)currentAST.root; } else { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = unaryExpressionNotPlusMinus_AST; return e; } public final Expression primaryExpression() throws RecognitionException, TokenStreamException { Expression e = null; String i = null;; returnAST = null; ASTPair currentAST = new ASTPair(); AST primaryExpression_AST = null; switch ( LA(1)) { case NUM_INT: case CHAR_LITERAL: case STRING_LITERAL: case NUM_FLOAT: case NUM_LONG: case NUM_DOUBLE: { e=constant(); astFactory.addASTChild(currentAST, returnAST); primaryExpression_AST = (AST)currentAST.root; break; } case IDENT: { i=identifier(); astFactory.addASTChild(currentAST, returnAST); if ( inputState.guessing==0 ) { e=new IdentifierExpression(i); } primaryExpression_AST = (AST)currentAST.root; break; } case LITERAL_true: { AST tmp40_AST = null; tmp40_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp40_AST); match(LITERAL_true); if ( inputState.guessing==0 ) { e=new ConstantBoolean(true); } primaryExpression_AST = (AST)currentAST.root; break; } case LITERAL_false: { AST tmp41_AST = null; tmp41_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp41_AST); match(LITERAL_false); if ( inputState.guessing==0 ) { e=new ConstantBoolean(false); } primaryExpression_AST = (AST)currentAST.root; break; } case LITERAL_null: { AST tmp42_AST = null; tmp42_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp42_AST); match(LITERAL_null); if ( inputState.guessing==0 ) { e=new ConstantNull(); } primaryExpression_AST = (AST)currentAST.root; break; } case LPAREN: { match(LPAREN); e=conditionalExpression(); astFactory.addASTChild(currentAST, returnAST); match(RPAREN); primaryExpression_AST = (AST)currentAST.root; break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = primaryExpression_AST; return e; } public final Expression constant() throws RecognitionException, TokenStreamException { Expression e = null; returnAST = null; ASTPair currentAST = new ASTPair(); AST constant_AST = null; Token l1 = null; AST l1_AST = null; Token l2 = null; AST l2_AST = null; Token l3 = null; AST l3_AST = null; Token l4 = null; AST l4_AST = null; Token l5 = null; AST l5_AST = null; Token l6 = null; AST l6_AST = null; switch ( LA(1)) { case NUM_INT: { l1 = LT(1); l1_AST = astFactory.create(l1); astFactory.addASTChild(currentAST, l1_AST); match(NUM_INT); if ( inputState.guessing==0 ) { e=new ConstantInteger(l1.getText()); } constant_AST = (AST)currentAST.root; break; } case CHAR_LITERAL: { l2 = LT(1); l2_AST = astFactory.create(l2); astFactory.addASTChild(currentAST, l2_AST); match(CHAR_LITERAL); if ( inputState.guessing==0 ) { e=new ConstantChar(l2.getText()); } constant_AST = (AST)currentAST.root; break; } case STRING_LITERAL: { l3 = LT(1); l3_AST = astFactory.create(l3); astFactory.addASTChild(currentAST, l3_AST); match(STRING_LITERAL); if ( inputState.guessing==0 ) { e=new ConstantString(l3.getText().substring(1, l3.getText().length()-1)); } constant_AST = (AST)currentAST.root; break; } case NUM_FLOAT: { l4 = LT(1); l4_AST = astFactory.create(l4); astFactory.addASTChild(currentAST, l4_AST); match(NUM_FLOAT); if ( inputState.guessing==0 ) { e=new ConstantFloat(l4.getText()); } constant_AST = (AST)currentAST.root; break; } case NUM_LONG: { l5 = LT(1); l5_AST = astFactory.create(l5); astFactory.addASTChild(currentAST, l5_AST); match(NUM_LONG); if ( inputState.guessing==0 ) { e=new ConstantLong(l5.getText()); } constant_AST = (AST)currentAST.root; break; } case NUM_DOUBLE: { l6 = LT(1); l6_AST = astFactory.create(l6); astFactory.addASTChild(currentAST, l6_AST); match(NUM_DOUBLE); if ( inputState.guessing==0 ) { e=new ConstantDouble(l6.getText()); } constant_AST = (AST)currentAST.root; break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = constant_AST; return e; } /** Match a, a.b.c refs */ public final Expression identPrimary() throws RecognitionException, TokenStreamException { Expression e = null; returnAST = null; ASTPair currentAST = new ASTPair(); AST identPrimary_AST = null; AST tmp45_AST = null; tmp45_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp45_AST); match(IDENT); { _loop55: do { if ((LA(1)==DOT)) { AST tmp46_AST = null; tmp46_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp46_AST); match(DOT); AST tmp47_AST = null; tmp47_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp47_AST); match(IDENT); } else { break _loop55; } } while (true); } identPrimary_AST = (AST)currentAST.root; returnAST = identPrimary_AST; return e; } public static final String[] _tokenNames = { "<0>", "EOF", "<2>", "NULL_TREE_LOOKAHEAD", "BLOCK", "MODIFIERS", "OBJBLOCK", "SLIST", "CTOR_DEF", "METHOD_DEF", "VARIABLE_DEF", "INSTANCE_INIT", "STATIC_INIT", "TYPE", "CLASS_DEF", "INTERFACE_DEF", "PACKAGE_DEF", "ARRAY_DECLARATOR", "EXTENDS_CLAUSE", "IMPLEMENTS_CLAUSE", "PARAMETERS", "PARAMETER_DEF", "LABELED_STAT", "TYPECAST", "INDEX_OP", "POST_INC", "POST_DEC", "METHOD_CALL", "EXPR", "ARRAY_INIT", "IMPORT", "UNARY_MINUS", "UNARY_PLUS", "CASE_GROUP", "ELIST", "FOR_INIT", "FOR_CONDITION", "FOR_ITERATOR", "EMPTY_STAT", "\"final\"", "\"abstract\"", "\"strictfp\"", "SUPER_CTOR_CALL", "CTOR_CALL", "LBRACK", "RBRACK", "\"void\"", "\"boolean\"", "\"byte\"", "\"char\"", "\"short\"", "\"int\"", "\"float\"", "\"long\"", "\"double\"", "\"String\"", "IDENT", "DOT", "QUESTION", "COLON", "LOR", "LAND", "BOR", "BXOR", "BAND", "NOT_EQUAL", "EQUAL", "LT", "GT", "LE", "GE", "SL", "SR", "BSR", "PLUS", "MINUS", "STAR", "DIV", "MOD", "BNOT", "LNOT", "LPAREN", "RPAREN", "\"true\"", "\"false\"", "\"null\"", "NUM_INT", "CHAR_LITERAL", "STRING_LITERAL", "NUM_FLOAT", "NUM_LONG", "NUM_DOUBLE", "LCURLY", "RCURLY", "COMMA", "ASSIGN", "DIV_ASSIGN", "PLUS_ASSIGN", "INC", "MINUS_ASSIGN", "DEC", "STAR_ASSIGN", "MOD_ASSIGN", "SR_ASSIGN", "BSR_ASSIGN", "SL_ASSIGN", "BXOR_ASSIGN", "BOR_ASSIGN", "BAND_ASSIGN", "SEMI", "WS", "SL_COMMIT", "ML_COMMENT", "ESC", "HEX_DIGIT", "VOCAB", "EXPONENT", "FLOAT_SUFFIX" }; protected void buildTokenTypeASTClassMap() { tokenTypeToASTClassMap=null; }; private static final long[] mk_tokenSet_0() { long[] data = { 72057594037927936L, 268042240L, 0L, 0L}; return data; } public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); private static final long[] mk_tokenSet_1() { long[] data = { -72057594037927934L, 268435455L, 0L, 0L}; return data; } public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -