javarecognizer.java
来自「Groovy动态语言 运行在JVM中的动态语言 可以方便的处理业务逻辑变化大的业」· Java 代码 · 共 2,519 行 · 第 1/5 页
JAVA
2,519 行
currentAST.root = classTypeSpec_AST; currentAST.child = classTypeSpec_AST!=null &&classTypeSpec_AST.getFirstChild()!=null ? classTypeSpec_AST.getFirstChild() : classTypeSpec_AST; currentAST.advanceChildToEnd(); } classTypeSpec_AST = (AST)currentAST.root; returnAST = classTypeSpec_AST; } public final void builtInTypeSpec( boolean addImagNode ) throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST builtInTypeSpec_AST = null; Token lb = null; AST lb_AST = null; Token first = LT(1); builtInType(); astFactory.addASTChild(currentAST, returnAST); { _loop43: do { if ((LA(1)==LBRACK)) { lb = LT(1); lb_AST = astFactory.create(lb); astFactory.makeASTRoot(currentAST, lb_AST); match(LBRACK); if ( inputState.guessing==0 ) { lb_AST.setType(ARRAY_DECLARATOR); } match(RBRACK); } else { break _loop43; } } while (true); } if ( inputState.guessing==0 ) { builtInTypeSpec_AST = (AST)currentAST.root; if ( addImagNode ) { builtInTypeSpec_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(TYPE,"TYPE",first,LT(1))).add(builtInTypeSpec_AST)); } currentAST.root = builtInTypeSpec_AST; currentAST.child = builtInTypeSpec_AST!=null &&builtInTypeSpec_AST.getFirstChild()!=null ? builtInTypeSpec_AST.getFirstChild() : builtInTypeSpec_AST; currentAST.advanceChildToEnd(); } builtInTypeSpec_AST = (AST)currentAST.root; returnAST = builtInTypeSpec_AST; } public final void classOrInterfaceType( boolean addImagNode ) throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST classOrInterfaceType_AST = null; Token first = LT(1); AST tmp26_AST = null; tmp26_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp26_AST); match(IDENT); { switch ( LA(1)) { case LT: { typeArguments(); astFactory.addASTChild(currentAST, returnAST); break; } case SEMI: case LBRACK: case RBRACK: case IDENT: case DOT: case QUESTION: case LITERAL_extends: case LITERAL_super: case COMMA: case GT: case SR: case BSR: case LITERAL_void: case LITERAL_boolean: case LITERAL_byte: case LITERAL_char: case LITERAL_short: case LITERAL_int: case LITERAL_float: case LITERAL_long: case LITERAL_double: case LPAREN: case RPAREN: case ASSIGN: case LCURLY: case RCURLY: case BAND: case LITERAL_implements: case LITERAL_this: case TRIPLE_DOT: case COLON: case PLUS_ASSIGN: case MINUS_ASSIGN: case STAR_ASSIGN: case DIV_ASSIGN: case MOD_ASSIGN: case SR_ASSIGN: case BSR_ASSIGN: case SL_ASSIGN: case BAND_ASSIGN: case BXOR_ASSIGN: case BOR_ASSIGN: case LOR: case LAND: case BOR: case BXOR: case NOT_EQUAL: case EQUAL: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { _loop23: do { if ((LA(1)==DOT) && (LA(2)==IDENT)) { AST tmp27_AST = null; tmp27_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp27_AST); match(DOT); AST tmp28_AST = null; tmp28_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp28_AST); match(IDENT); { switch ( LA(1)) { case LT: { typeArguments(); astFactory.addASTChild(currentAST, returnAST); break; } case SEMI: case LBRACK: case RBRACK: case IDENT: case DOT: case QUESTION: case LITERAL_extends: case LITERAL_super: case COMMA: case GT: case SR: case BSR: case LITERAL_void: case LITERAL_boolean: case LITERAL_byte: case LITERAL_char: case LITERAL_short: case LITERAL_int: case LITERAL_float: case LITERAL_long: case LITERAL_double: case LPAREN: case RPAREN: case ASSIGN: case LCURLY: case RCURLY: case BAND: case LITERAL_implements: case LITERAL_this: case TRIPLE_DOT: case COLON: case PLUS_ASSIGN: case MINUS_ASSIGN: case STAR_ASSIGN: case DIV_ASSIGN: case MOD_ASSIGN: case SR_ASSIGN: case BSR_ASSIGN: case SL_ASSIGN: case BAND_ASSIGN: case BXOR_ASSIGN: case BOR_ASSIGN: case LOR: case LAND: case BOR: case BXOR: case NOT_EQUAL: case EQUAL: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } else { break _loop23; } } while (true); } if ( inputState.guessing==0 ) { classOrInterfaceType_AST = (AST)currentAST.root; if ( addImagNode ) { classOrInterfaceType_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(TYPE,"TYPE",first,LT(1))).add(classOrInterfaceType_AST)); } currentAST.root = classOrInterfaceType_AST; currentAST.child = classOrInterfaceType_AST!=null &&classOrInterfaceType_AST.getFirstChild()!=null ? classOrInterfaceType_AST.getFirstChild() : classOrInterfaceType_AST; currentAST.advanceChildToEnd(); } classOrInterfaceType_AST = (AST)currentAST.root; returnAST = classOrInterfaceType_AST; } public final void typeArguments() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST typeArguments_AST = null; int currentLtLevel = 0; Token first = LT(1); if ( inputState.guessing==0 ) { currentLtLevel = ltCounter; } match(LT); if ( inputState.guessing==0 ) { ltCounter++; } typeArgument(); astFactory.addASTChild(currentAST, returnAST); { _loop33: do { if (((LA(1)==COMMA) && (_tokenSet_5.member(LA(2))))&&(inputState.guessing !=0 || ltCounter == currentLtLevel + 1)) { match(COMMA); typeArgument(); astFactory.addASTChild(currentAST, returnAST); } else { break _loop33; } } while (true); } { if (((LA(1) >= GT && LA(1) <= BSR)) && (_tokenSet_6.member(LA(2)))) { typeArgumentsOrParametersEnd(); astFactory.addASTChild(currentAST, returnAST); } else if ((_tokenSet_6.member(LA(1))) && (_tokenSet_7.member(LA(2)))) { } else { throw new NoViableAltException(LT(1), getFilename()); } } if (!((currentLtLevel != 0) || ltCounter == currentLtLevel)) throw new SemanticException("(currentLtLevel != 0) || ltCounter == currentLtLevel"); if ( inputState.guessing==0 ) { typeArguments_AST = (AST)currentAST.root; typeArguments_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(TYPE_ARGUMENTS,"TYPE_ARGUMENTS",first,LT(1))).add(typeArguments_AST)); currentAST.root = typeArguments_AST; currentAST.child = typeArguments_AST!=null &&typeArguments_AST.getFirstChild()!=null ? typeArguments_AST.getFirstChild() : typeArguments_AST; currentAST.advanceChildToEnd(); } typeArguments_AST = (AST)currentAST.root; returnAST = typeArguments_AST; } public final void typeArgumentSpec() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST typeArgumentSpec_AST = null; switch ( LA(1)) { case IDENT: { classTypeSpec(true); astFactory.addASTChild(currentAST, returnAST); typeArgumentSpec_AST = (AST)currentAST.root; break; } case LITERAL_void: case LITERAL_boolean: case LITERAL_byte: case LITERAL_char: case LITERAL_short: case LITERAL_int: case LITERAL_float: case LITERAL_long: case LITERAL_double: { builtInTypeArraySpec(true); astFactory.addASTChild(currentAST, returnAST); typeArgumentSpec_AST = (AST)currentAST.root; break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = typeArgumentSpec_AST; } public final void builtInTypeArraySpec( boolean addImagNode ) throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST builtInTypeArraySpec_AST = null; Token lb = null; AST lb_AST = null; Token first = LT(1); builtInType(); astFactory.addASTChild(currentAST, returnAST); { int _cnt40=0; _loop40: do { if ((LA(1)==LBRACK) && (LA(2)==RBRACK)) { lb = LT(1); lb_AST = astFactory.create(lb); astFactory.makeASTRoot(currentAST, lb_AST); match(LBRACK); if ( inputState.guessing==0 ) { lb_AST.setType(ARRAY_DECLARATOR); } match(RBRACK); } else { if ( _cnt40>=1 ) { break _loop40; } else {throw new NoViableAltException(LT(1), getFilename());} } _cnt40++; } while (true); } if ( inputState.guessing==0 ) { builtInTypeArraySpec_AST = (AST)currentAST.root; if ( addImagNode ) { builtInTypeArraySpec_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(TYPE,"TYPE",first,LT(1))).add(builtInTypeArraySpec_AST)); } currentAST.root = builtInTypeArraySpec_AST; currentAST.child = builtInTypeArraySpec_AST!=null &&builtInTypeArraySpec_AST.getFirstChild()!=null ? builtInTypeArraySpec_AST.getFirstChild() : builtInTypeArraySpec_AST; currentAST.advanceChildToEnd(); } builtInTypeArraySpec_AST = (AST)currentAST.root; returnAST = builtInTypeArraySpec_AST; } public final void typeArgument() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST typeArgument_AST = null; Token first = LT(1); { switch ( LA(1)) { case IDENT: case LITERAL_void: case LITERAL_boolean: case LITERAL_byte: case LITERAL_char: case LITERAL_short: case LITERAL_int: case LITERAL_float: case LITERAL_long: case LITERAL_double: { typeArgumentSpec(); astFactory.addASTChild(currentAST, returnAST); break; } case QUESTION: { wildcardType(); astFactory.addASTChild(currentAST, returnAST); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } if ( inputState.guessing==0 ) { typeArgument_AST = (AST)currentAST.root; typeArgument_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(TYPE_ARGUMENT,"TYPE_ARGUMENT",first,LT(1))).add(typeArgument_AST)); currentAST.root = typeArgument_AST; currentAST.child = typeArgument_AST!=null &&typeArgument_AST.getFirstChild()!=null ? typeArgument_AST.getFirstChild() : typeArgument_AST; currentAST.advanceChildToEnd(); } typeArgument_AST = (AST)currentAST.root; returnAST = typeArgument_AST; } public final void wildcardType() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST wildcardType_AST = null; Token q = null; AST q_AST = null; q = LT(1); q_AST = astFactory.create(q); astFactory.makeASTRoot(currentAST, q_AST); match(QUESTION); if ( inputState.guessing==0 ) { q_AST.setType(WILDCARD_TYPE); } { boolean synPredMatched30 = false; if (((LA(1)==LITERAL_extends||LA(1)==LITERAL_super) && (LA(2)==IDENT))) { int _m30 = mark(); synPredMatched30 = true; inputState.guessing++; try { { switch ( LA(1)) { case LITERAL_extends: { match(LITERAL_extends); break; } case LITERAL_super: { match(LITERAL_super); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } catch (RecognitionException pe) { synPredMatched30 = false; } rewind(_m30); inputState.guessing--; } if ( synPredMatched30 ) { typeArgumentBounds(); astFactory.addASTChild(currentAST, returnAST); } else if ((_tokenSet_8.member(LA(1))) && (_tokenSet_9.member(LA(2)))) { } else { throw new NoViableAltException(LT(1), getFilename()); } } wildcardType_AST = (AST)currentAST.root; returnAST = wildcardType_AST; } public final void typeArgumentBounds() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST typeArgumentBounds_AST = null; boolean isUpperBounds = false; Token first = LT(1); { switch ( LA(1)) { case LITERAL_extends: { match(LITERAL_extends); if ( inputState.guessing==0 ) { isUpperBounds=true; } break;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?