Search in sources :

Example 6 with NoViableAltException

use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.

the class JavaParser method formalParameterList.

// $ANTLR start "formalParameterList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:725:1: formalParameterList : LPAREN ( formalParameterStandardDecl ( COMMA formalParameterStandardDecl )* ( COMMA formalParameterVarArgDecl )? -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] ( formalParameterStandardDecl )+ ( formalParameterVarArgDecl )? ) | formalParameterVarArgDecl -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] formalParameterVarArgDecl ) | -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] ) ) RPAREN ;
public final JavaParser.formalParameterList_return formalParameterList() throws RecognitionException {
    JavaParser.formalParameterList_return retval = new JavaParser.formalParameterList_return();
    retval.start = input.LT(1);
    int formalParameterList_StartIndex = input.index();
    CommonTree root_0 = null;
    Token LPAREN205 = null;
    Token COMMA207 = null;
    Token COMMA209 = null;
    Token RPAREN212 = null;
    JavaParser.formalParameterStandardDecl_return formalParameterStandardDecl206 = null;
    JavaParser.formalParameterStandardDecl_return formalParameterStandardDecl208 = null;
    JavaParser.formalParameterVarArgDecl_return formalParameterVarArgDecl210 = null;
    JavaParser.formalParameterVarArgDecl_return formalParameterVarArgDecl211 = null;
    CommonTree LPAREN205_tree = null;
    CommonTree COMMA207_tree = null;
    CommonTree COMMA209_tree = null;
    CommonTree RPAREN212_tree = null;
    RewriteRuleTokenStream stream_RPAREN = new RewriteRuleTokenStream(adaptor, "token RPAREN");
    RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
    RewriteRuleTokenStream stream_LPAREN = new RewriteRuleTokenStream(adaptor, "token LPAREN");
    RewriteRuleSubtreeStream stream_formalParameterVarArgDecl = new RewriteRuleSubtreeStream(adaptor, "rule formalParameterVarArgDecl");
    RewriteRuleSubtreeStream stream_formalParameterStandardDecl = new RewriteRuleSubtreeStream(adaptor, "rule formalParameterStandardDecl");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 56)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:726:5: ( LPAREN ( formalParameterStandardDecl ( COMMA formalParameterStandardDecl )* ( COMMA formalParameterVarArgDecl )? -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] ( formalParameterStandardDecl )+ ( formalParameterVarArgDecl )? ) | formalParameterVarArgDecl -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] formalParameterVarArgDecl ) | -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] ) ) RPAREN )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:726:9: LPAREN ( formalParameterStandardDecl ( COMMA formalParameterStandardDecl )* ( COMMA formalParameterVarArgDecl )? -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] ( formalParameterStandardDecl )+ ( formalParameterVarArgDecl )? ) | formalParameterVarArgDecl -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] formalParameterVarArgDecl ) | -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] ) ) RPAREN
        {
            LPAREN205 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_formalParameterList7456);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_LPAREN.add(LPAREN205);
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:727:9: ( formalParameterStandardDecl ( COMMA formalParameterStandardDecl )* ( COMMA formalParameterVarArgDecl )? -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] ( formalParameterStandardDecl )+ ( formalParameterVarArgDecl )? ) | formalParameterVarArgDecl -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] formalParameterVarArgDecl ) | -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] ) )
            int alt74 = 3;
            switch(input.LA(1)) {
                case FINAL:
                    {
                        int LA74_1 = input.LA(2);
                        if ((synpred100_Java())) {
                            alt74 = 1;
                        } else if ((synpred101_Java())) {
                            alt74 = 2;
                        } else {
                            if (state.backtracking > 0) {
                                state.failed = true;
                                return retval;
                            }
                            NoViableAltException nvae = new NoViableAltException("", 74, 1, input);
                            throw nvae;
                        }
                    }
                    break;
                case AT:
                    {
                        int LA74_2 = input.LA(2);
                        if ((synpred100_Java())) {
                            alt74 = 1;
                        } else if ((synpred101_Java())) {
                            alt74 = 2;
                        } else {
                            if (state.backtracking > 0) {
                                state.failed = true;
                                return retval;
                            }
                            NoViableAltException nvae = new NoViableAltException("", 74, 2, input);
                            throw nvae;
                        }
                    }
                    break;
                case BOOLEAN:
                case BYTE:
                case CHAR:
                case DOUBLE:
                case FLOAT:
                case INT:
                case LONG:
                case SHORT:
                    {
                        int LA74_3 = input.LA(2);
                        if ((synpred100_Java())) {
                            alt74 = 1;
                        } else if ((synpred101_Java())) {
                            alt74 = 2;
                        } else {
                            if (state.backtracking > 0) {
                                state.failed = true;
                                return retval;
                            }
                            NoViableAltException nvae = new NoViableAltException("", 74, 3, input);
                            throw nvae;
                        }
                    }
                    break;
                case IDENT:
                    {
                        int LA74_4 = input.LA(2);
                        if ((synpred100_Java())) {
                            alt74 = 1;
                        } else if ((synpred101_Java())) {
                            alt74 = 2;
                        } else {
                            if (state.backtracking > 0) {
                                state.failed = true;
                                return retval;
                            }
                            NoViableAltException nvae = new NoViableAltException("", 74, 4, input);
                            throw nvae;
                        }
                    }
                    break;
                case RPAREN:
                    {
                        alt74 = 3;
                    }
                    break;
                default:
                    if (state.backtracking > 0) {
                        state.failed = true;
                        return retval;
                    }
                    NoViableAltException nvae = new NoViableAltException("", 74, 0, input);
                    throw nvae;
            }
            switch(alt74) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:728:13: formalParameterStandardDecl ( COMMA formalParameterStandardDecl )* ( COMMA formalParameterVarArgDecl )?
                    {
                        pushFollow(FOLLOW_formalParameterStandardDecl_in_formalParameterList7483);
                        formalParameterStandardDecl206 = formalParameterStandardDecl();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_formalParameterStandardDecl.add(formalParameterStandardDecl206.getTree());
                        }
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:728:41: ( COMMA formalParameterStandardDecl )*
                        loop72: do {
                            int alt72 = 2;
                            int LA72_0 = input.LA(1);
                            if ((LA72_0 == COMMA)) {
                                int LA72_1 = input.LA(2);
                                if ((synpred98_Java())) {
                                    alt72 = 1;
                                }
                            }
                            switch(alt72) {
                                case 1:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:728:42: COMMA formalParameterStandardDecl
                                    {
                                        COMMA207 = (Token) match(input, COMMA, FOLLOW_COMMA_in_formalParameterList7486);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            stream_COMMA.add(COMMA207);
                                        }
                                        pushFollow(FOLLOW_formalParameterStandardDecl_in_formalParameterList7488);
                                        formalParameterStandardDecl208 = formalParameterStandardDecl();
                                        state._fsp--;
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            stream_formalParameterStandardDecl.add(formalParameterStandardDecl208.getTree());
                                        }
                                    }
                                    break;
                                default:
                                    break loop72;
                            }
                        } while (true);
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:728:78: ( COMMA formalParameterVarArgDecl )?
                        int alt73 = 2;
                        int LA73_0 = input.LA(1);
                        if ((LA73_0 == COMMA)) {
                            alt73 = 1;
                        }
                        switch(alt73) {
                            case 1:
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:728:79: COMMA formalParameterVarArgDecl
                                {
                                    COMMA209 = (Token) match(input, COMMA, FOLLOW_COMMA_in_formalParameterList7493);
                                    if (state.failed) {
                                        return retval;
                                    }
                                    if (state.backtracking == 0) {
                                        stream_COMMA.add(COMMA209);
                                    }
                                    pushFollow(FOLLOW_formalParameterVarArgDecl_in_formalParameterList7495);
                                    formalParameterVarArgDecl210 = formalParameterVarArgDecl();
                                    state._fsp--;
                                    if (state.failed) {
                                        return retval;
                                    }
                                    if (state.backtracking == 0) {
                                        stream_formalParameterVarArgDecl.add(formalParameterVarArgDecl210.getTree());
                                    }
                                }
                                break;
                        }
                        // wildcard labels:
                        if (state.backtracking == 0) {
                            retval.tree = root_0;
                            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                            root_0 = (CommonTree) adaptor.nil();
                            // 729:13: -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] ( formalParameterStandardDecl )+ ( formalParameterVarArgDecl )? )
                            {
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:729:17: ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] ( formalParameterStandardDecl )+ ( formalParameterVarArgDecl )? )
                                {
                                    CommonTree root_1 = (CommonTree) adaptor.nil();
                                    root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FORMAL_PARAM_LIST, LPAREN205, "FORMAL_PARAM_LIST"), root_1);
                                    if (!(stream_formalParameterStandardDecl.hasNext())) {
                                        throw new RewriteEarlyExitException();
                                    }
                                    while (stream_formalParameterStandardDecl.hasNext()) {
                                        adaptor.addChild(root_1, stream_formalParameterStandardDecl.nextTree());
                                    }
                                    stream_formalParameterStandardDecl.reset();
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:729:96: ( formalParameterVarArgDecl )?
                                    if (stream_formalParameterVarArgDecl.hasNext()) {
                                        adaptor.addChild(root_1, stream_formalParameterVarArgDecl.nextTree());
                                    }
                                    stream_formalParameterVarArgDecl.reset();
                                    adaptor.addChild(root_0, root_1);
                                }
                            }
                            retval.tree = root_0;
                        }
                    }
                    break;
                case 2:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:731:13: formalParameterVarArgDecl
                    {
                        pushFollow(FOLLOW_formalParameterVarArgDecl_in_formalParameterList7550);
                        formalParameterVarArgDecl211 = formalParameterVarArgDecl();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_formalParameterVarArgDecl.add(formalParameterVarArgDecl211.getTree());
                        }
                        // wildcard labels:
                        if (state.backtracking == 0) {
                            retval.tree = root_0;
                            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                            root_0 = (CommonTree) adaptor.nil();
                            // 732:13: -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] formalParameterVarArgDecl )
                            {
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:732:17: ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] formalParameterVarArgDecl )
                                {
                                    CommonTree root_1 = (CommonTree) adaptor.nil();
                                    root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FORMAL_PARAM_LIST, LPAREN205, "FORMAL_PARAM_LIST"), root_1);
                                    adaptor.addChild(root_1, stream_formalParameterVarArgDecl.nextTree());
                                    adaptor.addChild(root_0, root_1);
                                }
                            }
                            retval.tree = root_0;
                        }
                    }
                    break;
                case 3:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:734:13:
                    {
                        // wildcard labels:
                        if (state.backtracking == 0) {
                            retval.tree = root_0;
                            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                            root_0 = (CommonTree) adaptor.nil();
                            // 734:13: -> ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] )
                            {
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:734:17: ^( FORMAL_PARAM_LIST[$LPAREN, \"FORMAL_PARAM_LIST\"] )
                                {
                                    CommonTree root_1 = (CommonTree) adaptor.nil();
                                    root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FORMAL_PARAM_LIST, LPAREN205, "FORMAL_PARAM_LIST"), root_1);
                                    adaptor.addChild(root_0, root_1);
                                }
                            }
                            retval.tree = root_0;
                        }
                    }
                    break;
            }
            RPAREN212 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_formalParameterList7625);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_RPAREN.add(RPAREN212);
            }
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 56, formalParameterList_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RewriteEarlyExitException(org.antlr.runtime.tree.RewriteEarlyExitException) RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) NoViableAltException(org.antlr.runtime.NoViableAltException) RecognitionException(org.antlr.runtime.RecognitionException)

Example 7 with NoViableAltException

use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.

the class JavaParser method genericTypeArgumentSimplified.

// $ANTLR start "genericTypeArgumentSimplified"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:716:1: genericTypeArgumentSimplified : ( type | QUESTION );
public final JavaParser.genericTypeArgumentSimplified_return genericTypeArgumentSimplified() throws RecognitionException {
    JavaParser.genericTypeArgumentSimplified_return retval = new JavaParser.genericTypeArgumentSimplified_return();
    retval.start = input.LT(1);
    int genericTypeArgumentSimplified_StartIndex = input.index();
    CommonTree root_0 = null;
    Token QUESTION201 = null;
    JavaParser.type_return type200 = null;
    CommonTree QUESTION201_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 54)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:717:5: ( type | QUESTION )
        int alt70 = 2;
        int LA70_0 = input.LA(1);
        if ((LA70_0 == BOOLEAN || LA70_0 == BYTE || LA70_0 == CHAR || LA70_0 == DOUBLE || LA70_0 == FLOAT || (LA70_0 >= INT && LA70_0 <= LONG) || LA70_0 == SHORT || LA70_0 == IDENT)) {
            alt70 = 1;
        } else if ((LA70_0 == QUESTION)) {
            alt70 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return retval;
            }
            NoViableAltException nvae = new NoViableAltException("", 70, 0, input);
            throw nvae;
        }
        switch(alt70) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:717:9: type
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_type_in_genericTypeArgumentSimplified7400);
                    type200 = type();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, type200.getTree());
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:718:9: QUESTION
                {
                    root_0 = (CommonTree) adaptor.nil();
                    QUESTION201 = (Token) match(input, QUESTION, FOLLOW_QUESTION_in_genericTypeArgumentSimplified7410);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        QUESTION201_tree = (CommonTree) adaptor.create(QUESTION201);
                        adaptor.addChild(root_0, QUESTION201_tree);
                    }
                }
                break;
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 54, genericTypeArgumentSimplified_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 8 with NoViableAltException

use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.

the class JavaParser method annotationScopeDeclarations.

// $ANTLR start "annotationScopeDeclarations"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:809:1: annotationScopeDeclarations : ( modifierList type ( IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI -> ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? ) | classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) ) | typeDeclaration );
public final JavaParser.annotationScopeDeclarations_return annotationScopeDeclarations() throws RecognitionException {
    JavaParser.annotationScopeDeclarations_return retval = new JavaParser.annotationScopeDeclarations_return();
    retval.start = input.LT(1);
    int annotationScopeDeclarations_StartIndex = input.index();
    CommonTree root_0 = null;
    Token IDENT255 = null;
    Token LPAREN256 = null;
    Token RPAREN257 = null;
    Token SEMI259 = null;
    Token SEMI261 = null;
    JavaParser.modifierList_return modifierList253 = null;
    JavaParser.type_return type254 = null;
    JavaParser.annotationDefaultValue_return annotationDefaultValue258 = null;
    JavaParser.classFieldDeclaratorList_return classFieldDeclaratorList260 = null;
    JavaParser.typeDeclaration_return typeDeclaration262 = null;
    CommonTree IDENT255_tree = null;
    CommonTree LPAREN256_tree = null;
    CommonTree RPAREN257_tree = null;
    CommonTree SEMI259_tree = null;
    CommonTree SEMI261_tree = null;
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleTokenStream stream_RPAREN = new RewriteRuleTokenStream(adaptor, "token RPAREN");
    RewriteRuleTokenStream stream_SEMI = new RewriteRuleTokenStream(adaptor, "token SEMI");
    RewriteRuleTokenStream stream_LPAREN = new RewriteRuleTokenStream(adaptor, "token LPAREN");
    RewriteRuleSubtreeStream stream_modifierList = new RewriteRuleSubtreeStream(adaptor, "rule modifierList");
    RewriteRuleSubtreeStream stream_annotationDefaultValue = new RewriteRuleSubtreeStream(adaptor, "rule annotationDefaultValue");
    RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
    RewriteRuleSubtreeStream stream_classFieldDeclaratorList = new RewriteRuleSubtreeStream(adaptor, "rule classFieldDeclaratorList");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 70)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:810:5: ( modifierList type ( IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI -> ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? ) | classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) ) | typeDeclaration )
        int alt87 = 2;
        alt87 = dfa87.predict(input);
        switch(alt87) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:810:9: modifierList type ( IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI -> ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? ) | classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) )
                {
                    pushFollow(FOLLOW_modifierList_in_annotationScopeDeclarations8256);
                    modifierList253 = modifierList();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_modifierList.add(modifierList253.getTree());
                    }
                    pushFollow(FOLLOW_type_in_annotationScopeDeclarations8258);
                    type254 = type();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_type.add(type254.getTree());
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:811:9: ( IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI -> ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? ) | classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) )
                    int alt86 = 2;
                    int LA86_0 = input.LA(1);
                    if ((LA86_0 == IDENT)) {
                        int LA86_1 = input.LA(2);
                        if ((LA86_1 == LPAREN)) {
                            alt86 = 1;
                        } else if ((LA86_1 == ASSIGN || LA86_1 == COMMA || LA86_1 == LBRACK || LA86_1 == SEMI)) {
                            alt86 = 2;
                        } else {
                            if (state.backtracking > 0) {
                                state.failed = true;
                                return retval;
                            }
                            NoViableAltException nvae = new NoViableAltException("", 86, 1, input);
                            throw nvae;
                        }
                    } else {
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return retval;
                        }
                        NoViableAltException nvae = new NoViableAltException("", 86, 0, input);
                        throw nvae;
                    }
                    switch(alt86) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:811:13: IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI
                            {
                                IDENT255 = (Token) match(input, IDENT, FOLLOW_IDENT_in_annotationScopeDeclarations8272);
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_IDENT.add(IDENT255);
                                }
                                LPAREN256 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_annotationScopeDeclarations8274);
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_LPAREN.add(LPAREN256);
                                }
                                RPAREN257 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_annotationScopeDeclarations8276);
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_RPAREN.add(RPAREN257);
                                }
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:811:33: ( annotationDefaultValue )?
                                int alt85 = 2;
                                int LA85_0 = input.LA(1);
                                if ((LA85_0 == DEFAULT)) {
                                    alt85 = 1;
                                }
                                switch(alt85) {
                                    case 1:
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: annotationDefaultValue
                                        {
                                            pushFollow(FOLLOW_annotationDefaultValue_in_annotationScopeDeclarations8278);
                                            annotationDefaultValue258 = annotationDefaultValue();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_annotationDefaultValue.add(annotationDefaultValue258.getTree());
                                            }
                                        }
                                        break;
                                }
                                SEMI259 = (Token) match(input, SEMI, FOLLOW_SEMI_in_annotationScopeDeclarations8281);
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_SEMI.add(SEMI259);
                                }
                                // wildcard labels:
                                if (state.backtracking == 0) {
                                    retval.tree = root_0;
                                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                                    root_0 = (CommonTree) adaptor.nil();
                                    // 812:13: -> ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? )
                                    {
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:812:17: ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? )
                                        {
                                            CommonTree root_1 = (CommonTree) adaptor.nil();
                                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ANNOTATION_METHOD_DECL, "ANNOTATION_METHOD_DECL"), root_1);
                                            adaptor.addChild(root_1, stream_modifierList.nextTree());
                                            adaptor.addChild(root_1, stream_type.nextTree());
                                            adaptor.addChild(root_1, stream_IDENT.nextNode());
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:812:66: ( annotationDefaultValue )?
                                            if (stream_annotationDefaultValue.hasNext()) {
                                                adaptor.addChild(root_1, stream_annotationDefaultValue.nextTree());
                                            }
                                            stream_annotationDefaultValue.reset();
                                            adaptor.addChild(root_0, root_1);
                                        }
                                    }
                                    retval.tree = root_0;
                                }
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:813:13: classFieldDeclaratorList SEMI
                            {
                                pushFollow(FOLLOW_classFieldDeclaratorList_in_annotationScopeDeclarations8323);
                                classFieldDeclaratorList260 = classFieldDeclaratorList();
                                state._fsp--;
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_classFieldDeclaratorList.add(classFieldDeclaratorList260.getTree());
                                }
                                SEMI261 = (Token) match(input, SEMI, FOLLOW_SEMI_in_annotationScopeDeclarations8325);
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_SEMI.add(SEMI261);
                                }
                                // wildcard labels:
                                if (state.backtracking == 0) {
                                    retval.tree = root_0;
                                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                                    root_0 = (CommonTree) adaptor.nil();
                                    // 814:13: -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList )
                                    {
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:814:17: ^( VAR_DECLARATION modifierList type classFieldDeclaratorList )
                                        {
                                            CommonTree root_1 = (CommonTree) adaptor.nil();
                                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(VAR_DECLARATION, "VAR_DECLARATION"), root_1);
                                            adaptor.addChild(root_1, stream_modifierList.nextTree());
                                            adaptor.addChild(root_1, stream_type.nextTree());
                                            adaptor.addChild(root_1, stream_classFieldDeclaratorList.nextTree());
                                            adaptor.addChild(root_0, root_1);
                                        }
                                    }
                                    retval.tree = root_0;
                                }
                            }
                            break;
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:816:9: typeDeclaration
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_typeDeclaration_in_annotationScopeDeclarations8370);
                    typeDeclaration262 = typeDeclaration();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, typeDeclaration262.getTree());
                    }
                }
                break;
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 70, annotationScopeDeclarations_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) NoViableAltException(org.antlr.runtime.NoViableAltException) RecognitionException(org.antlr.runtime.RecognitionException)

Example 9 with NoViableAltException

use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.

the class JavaParser method typeDeclaration.

// $ANTLR start "typeDeclaration"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:435:1: typeDeclaration : modifierList ( classTypeDeclaration[$modifierList.tree] | interfaceTypeDeclaration[$modifierList.tree] | enumTypeDeclaration[$modifierList.tree] | annotationTypeDeclaration[$modifierList.tree] ) ;
public final JavaParser.typeDeclaration_return typeDeclaration() throws RecognitionException {
    JavaParser.typeDeclaration_return retval = new JavaParser.typeDeclaration_return();
    retval.start = input.LT(1);
    int typeDeclaration_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.modifierList_return modifierList16 = null;
    JavaParser.classTypeDeclaration_return classTypeDeclaration17 = null;
    JavaParser.interfaceTypeDeclaration_return interfaceTypeDeclaration18 = null;
    JavaParser.enumTypeDeclaration_return enumTypeDeclaration19 = null;
    JavaParser.annotationTypeDeclaration_return annotationTypeDeclaration20 = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 6)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:436:5: ( modifierList ( classTypeDeclaration[$modifierList.tree] | interfaceTypeDeclaration[$modifierList.tree] | enumTypeDeclaration[$modifierList.tree] | annotationTypeDeclaration[$modifierList.tree] ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:436:9: modifierList ( classTypeDeclaration[$modifierList.tree] | interfaceTypeDeclaration[$modifierList.tree] | enumTypeDeclaration[$modifierList.tree] | annotationTypeDeclaration[$modifierList.tree] )
        {
            root_0 = (CommonTree) adaptor.nil();
            pushFollow(FOLLOW_modifierList_in_typeDeclaration4664);
            modifierList16 = modifierList();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:437:9: ( classTypeDeclaration[$modifierList.tree] | interfaceTypeDeclaration[$modifierList.tree] | enumTypeDeclaration[$modifierList.tree] | annotationTypeDeclaration[$modifierList.tree] )
            int alt7 = 4;
            switch(input.LA(1)) {
                case CLASS:
                    {
                        alt7 = 1;
                    }
                    break;
                case INTERFACE:
                    {
                        alt7 = 2;
                    }
                    break;
                case ENUM:
                    {
                        alt7 = 3;
                    }
                    break;
                case AT:
                    {
                        alt7 = 4;
                    }
                    break;
                default:
                    if (state.backtracking > 0) {
                        state.failed = true;
                        return retval;
                    }
                    NoViableAltException nvae = new NoViableAltException("", 7, 0, input);
                    throw nvae;
            }
            switch(alt7) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:437:13: classTypeDeclaration[$modifierList.tree]
                    {
                        pushFollow(FOLLOW_classTypeDeclaration_in_typeDeclaration4679);
                        classTypeDeclaration17 = classTypeDeclaration((modifierList16 != null ? ((CommonTree) modifierList16.tree) : null));
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            adaptor.addChild(root_0, classTypeDeclaration17.getTree());
                        }
                    }
                    break;
                case 2:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:438:13: interfaceTypeDeclaration[$modifierList.tree]
                    {
                        pushFollow(FOLLOW_interfaceTypeDeclaration_in_typeDeclaration4694);
                        interfaceTypeDeclaration18 = interfaceTypeDeclaration((modifierList16 != null ? ((CommonTree) modifierList16.tree) : null));
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            adaptor.addChild(root_0, interfaceTypeDeclaration18.getTree());
                        }
                    }
                    break;
                case 3:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:439:13: enumTypeDeclaration[$modifierList.tree]
                    {
                        pushFollow(FOLLOW_enumTypeDeclaration_in_typeDeclaration4709);
                        enumTypeDeclaration19 = enumTypeDeclaration((modifierList16 != null ? ((CommonTree) modifierList16.tree) : null));
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            adaptor.addChild(root_0, enumTypeDeclaration19.getTree());
                        }
                    }
                    break;
                case 4:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:440:13: annotationTypeDeclaration[$modifierList.tree]
                    {
                        pushFollow(FOLLOW_annotationTypeDeclaration_in_typeDeclaration4724);
                        annotationTypeDeclaration20 = annotationTypeDeclaration((modifierList16 != null ? ((CommonTree) modifierList16.tree) : null));
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            adaptor.addChild(root_0, annotationTypeDeclaration20.getTree());
                        }
                    }
                    break;
            }
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 6, typeDeclaration_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) RecognitionException(org.antlr.runtime.RecognitionException)

Example 10 with NoViableAltException

use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.

the class CssParser method pseudo.

// $ANTLR start "pseudo"
// /home/langera/dev/freud/src/grammar/Css.g:88:1: pseudo : ( ( ':' | '::' ) IDENT -> ^( PSEUDO IDENT ) | ( ':' | '::' ) function -> ^( PSEUDO function ) );
public final CssParser.pseudo_return pseudo() throws RecognitionException {
    CssParser.pseudo_return retval = new CssParser.pseudo_return();
    retval.start = input.LT(1);
    CommonTree root_0 = null;
    Token char_literal40 = null;
    Token string_literal41 = null;
    Token IDENT42 = null;
    Token char_literal43 = null;
    Token string_literal44 = null;
    CssParser.function_return function45 = null;
    CommonTree char_literal40_tree = null;
    CommonTree string_literal41_tree = null;
    CommonTree IDENT42_tree = null;
    CommonTree char_literal43_tree = null;
    CommonTree string_literal44_tree = null;
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleTokenStream stream_39 = new RewriteRuleTokenStream(adaptor, "token 39");
    RewriteRuleTokenStream stream_38 = new RewriteRuleTokenStream(adaptor, "token 38");
    RewriteRuleSubtreeStream stream_function = new RewriteRuleSubtreeStream(adaptor, "rule function");
    try {
        // /home/langera/dev/freud/src/grammar/Css.g:89:2: ( ( ':' | '::' ) IDENT -> ^( PSEUDO IDENT ) | ( ':' | '::' ) function -> ^( PSEUDO function ) )
        int alt20 = 2;
        alt20 = dfa20.predict(input);
        switch(alt20) {
            case 1:
                // /home/langera/dev/freud/src/grammar/Css.g:89:4: ( ':' | '::' ) IDENT
                {
                    // /home/langera/dev/freud/src/grammar/Css.g:89:4: ( ':' | '::' )
                    int alt18 = 2;
                    int LA18_0 = input.LA(1);
                    if ((LA18_0 == 38)) {
                        alt18 = 1;
                    } else if ((LA18_0 == 39)) {
                        alt18 = 2;
                    } else {
                        NoViableAltException nvae = new NoViableAltException("", 18, 0, input);
                        throw nvae;
                    }
                    switch(alt18) {
                        case 1:
                            // /home/langera/dev/freud/src/grammar/Css.g:89:5: ':'
                            {
                                char_literal40 = (Token) match(input, 38, FOLLOW_38_in_pseudo493);
                                stream_38.add(char_literal40);
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/src/grammar/Css.g:89:9: '::'
                            {
                                string_literal41 = (Token) match(input, 39, FOLLOW_39_in_pseudo495);
                                stream_39.add(string_literal41);
                            }
                            break;
                    }
                    IDENT42 = (Token) match(input, IDENT, FOLLOW_IDENT_in_pseudo498);
                    stream_IDENT.add(IDENT42);
                    // AST REWRITE
                    // elements: IDENT
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                    root_0 = (CommonTree) adaptor.nil();
                    // 89:21: -> ^( PSEUDO IDENT )
                    {
                        // /home/langera/dev/freud/src/grammar/Css.g:89:24: ^( PSEUDO IDENT )
                        {
                            CommonTree root_1 = (CommonTree) adaptor.nil();
                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(PSEUDO, "PSEUDO"), root_1);
                            adaptor.addChild(root_1, stream_IDENT.nextNode());
                            adaptor.addChild(root_0, root_1);
                        }
                    }
                    retval.tree = root_0;
                }
                break;
            case 2:
                // /home/langera/dev/freud/src/grammar/Css.g:90:4: ( ':' | '::' ) function
                {
                    // /home/langera/dev/freud/src/grammar/Css.g:90:4: ( ':' | '::' )
                    int alt19 = 2;
                    int LA19_0 = input.LA(1);
                    if ((LA19_0 == 38)) {
                        alt19 = 1;
                    } else if ((LA19_0 == 39)) {
                        alt19 = 2;
                    } else {
                        NoViableAltException nvae = new NoViableAltException("", 19, 0, input);
                        throw nvae;
                    }
                    switch(alt19) {
                        case 1:
                            // /home/langera/dev/freud/src/grammar/Css.g:90:5: ':'
                            {
                                char_literal43 = (Token) match(input, 38, FOLLOW_38_in_pseudo514);
                                stream_38.add(char_literal43);
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/src/grammar/Css.g:90:9: '::'
                            {
                                string_literal44 = (Token) match(input, 39, FOLLOW_39_in_pseudo516);
                                stream_39.add(string_literal44);
                            }
                            break;
                    }
                    pushFollow(FOLLOW_function_in_pseudo519);
                    function45 = function();
                    state._fsp--;
                    stream_function.add(function45.getTree());
                    // AST REWRITE
                    // elements: function
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                    root_0 = (CommonTree) adaptor.nil();
                    // 90:24: -> ^( PSEUDO function )
                    {
                        // /home/langera/dev/freud/src/grammar/Css.g:90:27: ^( PSEUDO function )
                        {
                            CommonTree root_1 = (CommonTree) adaptor.nil();
                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(PSEUDO, "PSEUDO"), root_1);
                            adaptor.addChild(root_1, stream_function.nextTree());
                            adaptor.addChild(root_0, root_1);
                        }
                    }
                    retval.tree = root_0;
                }
                break;
        }
        retval.stop = input.LT(-1);
        retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
        adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

NoViableAltException (org.antlr.runtime.NoViableAltException)68 RecognitionException (org.antlr.runtime.RecognitionException)50 Token (org.antlr.runtime.Token)43 CommonTree (org.antlr.runtime.tree.CommonTree)33 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)28 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)24 ParserRuleReturnScope (org.antlr.runtime.ParserRuleReturnScope)10 CommonToken (org.antlr.runtime.CommonToken)7 MismatchedSetException (org.antlr.runtime.MismatchedSetException)6 EarlyExitException (org.antlr.runtime.EarlyExitException)4 FailedPredicateException (org.antlr.runtime.FailedPredicateException)3 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)3 ArrayList (java.util.ArrayList)2 MismatchedNotSetException (org.antlr.runtime.MismatchedNotSetException)2 MismatchedTokenException (org.antlr.runtime.MismatchedTokenException)2 MismatchedTreeNodeException (org.antlr.runtime.MismatchedTreeNodeException)2 RewriteEmptyStreamException (org.antlr.runtime.tree.RewriteEmptyStreamException)2