📄 groovyrecognizer.java
字号:
case LITERAL_synchronized: case LITERAL_volatile: { modifiers(); m_AST = (AST)returnAST; { if ((_tokenSet_27.member(LA(1))) && (_tokenSet_28.member(LA(2)))) { typeSpec(false); t_AST = (AST)returnAST; } else if ((LA(1)==IDENT||LA(1)==STRING_LITERAL) && (_tokenSet_29.member(LA(2)))) { } else { throw new NoViableAltException(LT(1), getFilename()); } } variableDefinitions(m_AST, t_AST); v_AST = (AST)returnAST; if ( inputState.guessing==0 ) { declaration_AST = (AST)currentAST.root; declaration_AST = v_AST; currentAST.root = declaration_AST; currentAST.child = declaration_AST!=null &&declaration_AST.getFirstChild()!=null ? declaration_AST.getFirstChild() : declaration_AST; currentAST.advanceChildToEnd(); } break; } 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: case LITERAL_any: { typeSpec(false); t2_AST = (AST)returnAST; variableDefinitions(null,t2_AST); v2_AST = (AST)returnAST; if ( inputState.guessing==0 ) { declaration_AST = (AST)currentAST.root; declaration_AST = v2_AST; currentAST.root = declaration_AST; currentAST.child = declaration_AST!=null &&declaration_AST.getFirstChild()!=null ? declaration_AST.getFirstChild() : declaration_AST; currentAST.advanceChildToEnd(); } break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = declaration_AST; } /** A list of one or more modifier, annotation, or "def". */ public final void modifiers() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST modifiers_AST = null; Token first = LT(1); modifiersInternal(); astFactory.addASTChild(currentAST, returnAST); if ( inputState.guessing==0 ) { modifiers_AST = (AST)currentAST.root; modifiers_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(MODIFIERS,"MODIFIERS",first,LT(1))).add(modifiers_AST)); currentAST.root = modifiers_AST; currentAST.child = modifiers_AST!=null &&modifiers_AST.getFirstChild()!=null ? modifiers_AST.getFirstChild() : modifiers_AST; currentAST.advanceChildToEnd(); } modifiers_AST = (AST)currentAST.root; returnAST = modifiers_AST; } public final void typeSpec( boolean addImagNode ) throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST typeSpec_AST = null; switch ( LA(1)) { case IDENT: { classTypeSpec(addImagNode); astFactory.addASTChild(currentAST, returnAST); typeSpec_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: case LITERAL_any: { builtInTypeSpec(addImagNode); astFactory.addASTChild(currentAST, returnAST); typeSpec_AST = (AST)currentAST.root; break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = typeSpec_AST; } /** The tail of a declaration. * Either v1, v2, ... (with possible initializers) or else m(args){body}. * The two arguments are the modifier list (if any) and the declaration head (if any). * The declaration head is the variable type, or (for a method) the return type. * If it is missing, then the variable type is taken from its initializer (if there is one). * Otherwise, the variable type defaults to 'any'. * DECIDE: Method return types default to the type of the method body, as an expression. */ public final void variableDefinitions( AST mods, AST t ) throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST variableDefinitions_AST = null; Token id = null; AST id_AST = null; Token qid = null; AST qid_AST = null; AST param_AST = null; AST tc_AST = null; AST mb_AST = null; Token first = LT(1); if ((LA(1)==IDENT) && (_tokenSet_30.member(LA(2)))) { variableDeclarator(getASTFactory().dupTree(mods), getASTFactory().dupTree(t)); astFactory.addASTChild(currentAST, returnAST); { _loop190: do { if ((LA(1)==COMMA)) { match(COMMA); nls(); variableDeclarator(getASTFactory().dupTree(mods), getASTFactory().dupTree(t)); astFactory.addASTChild(currentAST, returnAST); } else { break _loop190; } } while (true); } variableDefinitions_AST = (AST)currentAST.root; } else if ((LA(1)==IDENT||LA(1)==STRING_LITERAL) && (LA(2)==LPAREN)) { { switch ( LA(1)) { case IDENT: { id = LT(1); id_AST = astFactory.create(id); astFactory.addASTChild(currentAST, id_AST); match(IDENT); break; } case STRING_LITERAL: { qid = LT(1); qid_AST = astFactory.create(qid); astFactory.addASTChild(currentAST, qid_AST); match(STRING_LITERAL); if ( inputState.guessing==0 ) { qid_AST.setType(IDENT); } break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } match(LPAREN); parameterDeclarationList(); param_AST = (AST)returnAST; match(RPAREN); { boolean synPredMatched194 = false; if (((LA(1)==NLS||LA(1)==LITERAL_throws) && (_tokenSet_31.member(LA(2))) && (_tokenSet_32.member(LA(3))))) { int _m194 = mark(); synPredMatched194 = true; inputState.guessing++; try { { nls(); match(LITERAL_throws); } } catch (RecognitionException pe) { synPredMatched194 = false; } rewind(_m194); inputState.guessing--; } if ( synPredMatched194 ) { throwsClause(); tc_AST = (AST)returnAST; } else if ((_tokenSet_33.member(LA(1))) && (_tokenSet_10.member(LA(2))) && (_tokenSet_11.member(LA(3)))) { } else { throw new NoViableAltException(LT(1), getFilename()); } } { boolean synPredMatched197 = false; if (((LA(1)==LCURLY||LA(1)==NLS) && (_tokenSet_34.member(LA(2))) && (_tokenSet_8.member(LA(3))))) { int _m197 = mark(); synPredMatched197 = true; inputState.guessing++; try { { nls(); match(LCURLY); } } catch (RecognitionException pe) { synPredMatched197 = false; } rewind(_m197); inputState.guessing--; } if ( synPredMatched197 ) { { nlsWarn(); openBlock(); mb_AST = (AST)returnAST; } } else if ((_tokenSet_9.member(LA(1))) && (_tokenSet_10.member(LA(2))) && (_tokenSet_11.member(LA(3)))) { } else { throw new NoViableAltException(LT(1), getFilename()); } } if ( inputState.guessing==0 ) { variableDefinitions_AST = (AST)currentAST.root; if (qid_AST != null) id_AST = qid_AST; variableDefinitions_AST = (AST)astFactory.make( (new ASTArray(7)).add(create(METHOD_DEF,"METHOD_DEF",first,LT(1))).add(mods).add((AST)astFactory.make( (new ASTArray(2)).add(create(TYPE,"TYPE",first,LT(1))).add(t))).add(id_AST).add(param_AST).add(tc_AST).add(mb_AST)); currentAST.root = variableDefinitions_AST; currentAST.child = variableDefinitions_AST!=null &&variableDefinitions_AST.getFirstChild()!=null ? variableDefinitions_AST.getFirstChild() : variableDefinitions_AST; currentAST.advanceChildToEnd(); } variableDefinitions_AST = (AST)currentAST.root; } else { throw new NoViableAltException(LT(1), getFilename()); } returnAST = variableDefinitions_AST; } /** A declaration with one declarator and no initialization, like a parameterDeclaration. * Used to parse loops like <code>for (int x in y)</code> (up to the <code>in</code> keyword). */ public final void singleDeclarationNoInit() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST singleDeclarationNoInit_AST = null; AST m_AST = null; AST t_AST = null; AST v_AST = null; AST t2_AST = null; AST v2_AST = null; switch ( LA(1)) { case FINAL: case ABSTRACT: case STRICTFP: case LITERAL_static: case LITERAL_def: case AT: case LITERAL_private: case LITERAL_public: case LITERAL_protected: case LITERAL_transient: case LITERAL_native: case LITERAL_threadsafe: case LITERAL_synchronized: case LITERAL_volatile: { modifiers(); m_AST = (AST)returnAST; { if ((_tokenSet_27.member(LA(1))) && (_tokenSet_35.member(LA(2)))) { typeSpec(false); t_AST = (AST)returnAST; } else if ((LA(1)==IDENT) && (_tokenSet_36.member(LA(2)))) { } else { throw new NoViableAltException(LT(1), getFilename()); } } singleVariable(m_AST, t_AST); v_AST = (AST)returnAST; if ( inputState.guessing==0 ) { singleDeclarationNoInit_AST = (AST)currentAST.root; singleDeclarationNoInit_AST = v_AST; currentAST.root = singleDeclarationNoInit_AST; currentAST.child = singleDeclarationNoInit_AST!=null &&singleDeclarationNoInit_AST.getFirstChild()!=null ? singleDeclarationNoInit_AST.getFirstChild() : singleDeclarationNoInit_AST; currentAST.advanceChildToEnd(); } break; } 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: case LITERAL_any: { typeSpec(false); t2_AST = (AST)returnAST; singleVariable(null,t2_AST); v2_AST = (AST)returnAST; if ( inputState.guessing==0 ) { singleDeclarationNoInit_AST = (AST)currentAST.root; singleDeclarationNoInit_AST = v2_AST; currentAST.root = singleDeclarationNoInit_AST; currentAST.child = singleDeclarationNoInit_AST!=null &&singleDeclarationNoInit_AST.getFirstChild()!=null ? singleDeclarationNoInit_AST.getFirstChild() : singleDeclarationNoInit_AST; currentAST.advanceChildToEnd(); } break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = singleDeclarationNoInit_AST; } /** Used in cases where a declaration cannot have commas, or ends with the "in" operator instead of '='. */ public final void singleVariable( AST mods, AST t ) throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST singleVariable_AST = null; AST id_AST = null; Token first = LT(1); variableName(); id_AST = (AST)returnAST; if ( inputState.guessing==0 ) { singleVariable_AST = (AST)currentAST.root; singleVariable_AST = (AST)astFactory.make( (new ASTArray(4)).add(create(VARIABLE_DEF,"VARIABLE_DEF",first,LT(1))).add(mods).add((AST)astFactory.make( (new ASTArray(2)).add(create(TYPE,"TYPE",first,LT(1))).add(t))).add(id_AST)); currentAST.root = singleVariable_AST; currentAST.child = singleVariable_AST!=null &&singleVariable_AST.getFirstChild()!=null ? singleVariable_AST.getFirstChild() : singleVariable_AST; currentAST.advanceChildToEnd(); } returnAST = singleVariable_AST; } /** A declaration with one declarator and optional initialization, like a parameterDeclaration. * Used to parse declarations used for both binding and effect, in places like argument * lists and <code>while</code> statements. */ public final void singleDeclaration() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST singleDeclaration_AST = null; AST sd_AST = null; singleDeclarationNoInit(); sd_AST = (AST)returnAST; if ( inputState.guessing==0 ) { singleDeclaration_AST = (AST)currentAST.root; singleDeclaration_AST = sd_AST; currentAST.root = singleDeclaration_AST; currentAST.child = singleDeclaration_AST!=null &&singleDeclaration_AST.getFirstChild()!=null ? singleDeclaration_AST.getFirstChild() : singleDeclaration_AST; currentAST.advanceChildToEnd(); } { switch ( LA(1)) { case ASSIGN: { varInitializer(); astFactory.addASTChild(currentAST, returnAST); break; } case RBRACK: case COMMA: case RPAREN: case SEMI: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } singleDeclaration_AST = (AST)currentAST.root; returnAST = singleDeclaration_AST; } /** An assignment operator '=' followed by an expression. (Never empty.) */ public final void varInitializer() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST varInitializer_AST = null; AST tmp50_AST = null; tmp50_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp50_AST); match(ASSIGN); nls(); expression(LC_INIT); astFactory.ad
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -