Search in sources :

Example 51 with RecognitionException

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

the class JavaParser method enumClassScopeDeclarations.

// $ANTLR start "enumClassScopeDeclarations"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:503:1: enumClassScopeDeclarations : SEMI ( classScopeDeclarations )* -> ^( CLASS_TOP_LEVEL_SCOPE[$SEMI, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* ) ;
public final JavaParser.enumClassScopeDeclarations_return enumClassScopeDeclarations() throws RecognitionException {
    JavaParser.enumClassScopeDeclarations_return retval = new JavaParser.enumClassScopeDeclarations_return();
    retval.start = input.LT(1);
    int enumClassScopeDeclarations_StartIndex = input.index();
    CommonTree root_0 = null;
    Token SEMI57 = null;
    JavaParser.classScopeDeclarations_return classScopeDeclarations58 = null;
    CommonTree SEMI57_tree = null;
    RewriteRuleTokenStream stream_SEMI = new RewriteRuleTokenStream(adaptor, "token SEMI");
    RewriteRuleSubtreeStream stream_classScopeDeclarations = new RewriteRuleSubtreeStream(adaptor, "rule classScopeDeclarations");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 18)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:504:5: ( SEMI ( classScopeDeclarations )* -> ^( CLASS_TOP_LEVEL_SCOPE[$SEMI, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:504:9: SEMI ( classScopeDeclarations )*
        {
            SEMI57 = (Token) match(input, SEMI, FOLLOW_SEMI_in_enumClassScopeDeclarations5316);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_SEMI.add(SEMI57);
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:504:14: ( classScopeDeclarations )*
            loop19: do {
                int alt19 = 2;
                int LA19_0 = input.LA(1);
                if ((LA19_0 == AT || LA19_0 == LCURLY || LA19_0 == LESS_THAN || LA19_0 == SEMI || LA19_0 == ABSTRACT || LA19_0 == BOOLEAN || LA19_0 == BYTE || (LA19_0 >= CHAR && LA19_0 <= CLASS) || LA19_0 == DOUBLE || LA19_0 == ENUM || LA19_0 == FINAL || LA19_0 == FLOAT || LA19_0 == INTERFACE || (LA19_0 >= INT && LA19_0 <= NATIVE) || (LA19_0 >= PRIVATE && LA19_0 <= PUBLIC) || (LA19_0 >= SHORT && LA19_0 <= STRICTFP) || LA19_0 == SYNCHRONIZED || LA19_0 == TRANSIENT || (LA19_0 >= VOID && LA19_0 <= VOLATILE) || LA19_0 == IDENT)) {
                    alt19 = 1;
                }
                switch(alt19) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: classScopeDeclarations
                        {
                            pushFollow(FOLLOW_classScopeDeclarations_in_enumClassScopeDeclarations5318);
                            classScopeDeclarations58 = classScopeDeclarations();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_classScopeDeclarations.add(classScopeDeclarations58.getTree());
                            }
                        }
                        break;
                    default:
                        break loop19;
                }
            } while (true);
            // 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();
                // 505:9: -> ^( CLASS_TOP_LEVEL_SCOPE[$SEMI, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:505:13: ^( CLASS_TOP_LEVEL_SCOPE[$SEMI, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CLASS_TOP_LEVEL_SCOPE, SEMI57, "CLASS_TOP_LEVEL_SCOPE"), root_1);
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:505:69: ( classScopeDeclarations )*
                        while (stream_classScopeDeclarations.hasNext()) {
                            adaptor.addChild(root_1, stream_classScopeDeclarations.nextTree());
                        }
                        stream_classScopeDeclarations.reset();
                        adaptor.addChild(root_0, root_1);
                    }
                }
                retval.tree = root_0;
            }
        }
        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, 18, enumClassScopeDeclarations_StartIndex);
        }
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 52 with RecognitionException

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

the class JavaParser method relationalExpression.

// $ANTLR start "relationalExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:989:1: relationalExpression : shiftExpression ( ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN ) shiftExpression )* ;
public final JavaParser.relationalExpression_return relationalExpression() throws RecognitionException {
    JavaParser.relationalExpression_return retval = new JavaParser.relationalExpression_return();
    retval.start = input.LT(1);
    int relationalExpression_StartIndex = input.index();
    CommonTree root_0 = null;
    Token LESS_OR_EQUAL408 = null;
    Token GREATER_OR_EQUAL409 = null;
    Token LESS_THAN410 = null;
    Token GREATER_THAN411 = null;
    JavaParser.shiftExpression_return shiftExpression407 = null;
    JavaParser.shiftExpression_return shiftExpression412 = null;
    CommonTree LESS_OR_EQUAL408_tree = null;
    CommonTree GREATER_OR_EQUAL409_tree = null;
    CommonTree LESS_THAN410_tree = null;
    CommonTree GREATER_THAN411_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 98)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:990:5: ( shiftExpression ( ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN ) shiftExpression )* )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:990:9: shiftExpression ( ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN ) shiftExpression )*
        {
            root_0 = (CommonTree) adaptor.nil();
            pushFollow(FOLLOW_shiftExpression_in_relationalExpression10811);
            shiftExpression407 = shiftExpression();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                adaptor.addChild(root_0, shiftExpression407.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:991:9: ( ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN ) shiftExpression )*
            loop120: do {
                int alt120 = 2;
                int LA120_0 = input.LA(1);
                if (((LA120_0 >= GREATER_OR_EQUAL && LA120_0 <= GREATER_THAN) || (LA120_0 >= LESS_OR_EQUAL && LA120_0 <= LESS_THAN))) {
                    alt120 = 1;
                }
                switch(alt120) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:991:13: ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN ) shiftExpression
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:991:13: ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN )
                            int alt119 = 4;
                            switch(input.LA(1)) {
                                case LESS_OR_EQUAL:
                                    {
                                        alt119 = 1;
                                    }
                                    break;
                                case GREATER_OR_EQUAL:
                                    {
                                        alt119 = 2;
                                    }
                                    break;
                                case LESS_THAN:
                                    {
                                        alt119 = 3;
                                    }
                                    break;
                                case GREATER_THAN:
                                    {
                                        alt119 = 4;
                                    }
                                    break;
                                default:
                                    if (state.backtracking > 0) {
                                        state.failed = true;
                                        return retval;
                                    }
                                    NoViableAltException nvae = new NoViableAltException("", 119, 0, input);
                                    throw nvae;
                            }
                            switch(alt119) {
                                case 1:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:991:17: LESS_OR_EQUAL
                                    {
                                        LESS_OR_EQUAL408 = (Token) match(input, LESS_OR_EQUAL, FOLLOW_LESS_OR_EQUAL_in_relationalExpression10829);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            LESS_OR_EQUAL408_tree = (CommonTree) adaptor.create(LESS_OR_EQUAL408);
                                            root_0 = (CommonTree) adaptor.becomeRoot(LESS_OR_EQUAL408_tree, root_0);
                                        }
                                    }
                                    break;
                                case 2:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:992:17: GREATER_OR_EQUAL
                                    {
                                        GREATER_OR_EQUAL409 = (Token) match(input, GREATER_OR_EQUAL, FOLLOW_GREATER_OR_EQUAL_in_relationalExpression10848);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            GREATER_OR_EQUAL409_tree = (CommonTree) adaptor.create(GREATER_OR_EQUAL409);
                                            root_0 = (CommonTree) adaptor.becomeRoot(GREATER_OR_EQUAL409_tree, root_0);
                                        }
                                    }
                                    break;
                                case 3:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:993:17: LESS_THAN
                                    {
                                        LESS_THAN410 = (Token) match(input, LESS_THAN, FOLLOW_LESS_THAN_in_relationalExpression10867);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            LESS_THAN410_tree = (CommonTree) adaptor.create(LESS_THAN410);
                                            root_0 = (CommonTree) adaptor.becomeRoot(LESS_THAN410_tree, root_0);
                                        }
                                    }
                                    break;
                                case 4:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:994:17: GREATER_THAN
                                    {
                                        GREATER_THAN411 = (Token) match(input, GREATER_THAN, FOLLOW_GREATER_THAN_in_relationalExpression10886);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            GREATER_THAN411_tree = (CommonTree) adaptor.create(GREATER_THAN411);
                                            root_0 = (CommonTree) adaptor.becomeRoot(GREATER_THAN411_tree, root_0);
                                        }
                                    }
                                    break;
                            }
                            pushFollow(FOLLOW_shiftExpression_in_relationalExpression10915);
                            shiftExpression412 = shiftExpression();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                adaptor.addChild(root_0, shiftExpression412.getTree());
                            }
                        }
                        break;
                    default:
                        break loop120;
                }
            } while (true);
        }
        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, 98, relationalExpression_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 53 with RecognitionException

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

the class JavaParser method newArrayConstruction.

// $ANTLR start "newArrayConstruction"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1146:1: newArrayConstruction : ( arrayDeclaratorList arrayInitializer | LBRACK expression RBRACK ( LBRACK expression RBRACK )* ( arrayDeclaratorList )? );
public final JavaParser.newArrayConstruction_return newArrayConstruction() throws RecognitionException {
    JavaParser.newArrayConstruction_return retval = new JavaParser.newArrayConstruction_return();
    retval.start = input.LT(1);
    int newArrayConstruction_StartIndex = input.index();
    CommonTree root_0 = null;
    Token LBRACK524 = null;
    Token RBRACK526 = null;
    Token LBRACK527 = null;
    Token RBRACK529 = null;
    JavaParser.arrayDeclaratorList_return arrayDeclaratorList522 = null;
    JavaParser.arrayInitializer_return arrayInitializer523 = null;
    JavaParser.expression_return expression525 = null;
    JavaParser.expression_return expression528 = null;
    JavaParser.arrayDeclaratorList_return arrayDeclaratorList530 = null;
    CommonTree LBRACK524_tree = null;
    CommonTree RBRACK526_tree = null;
    CommonTree LBRACK527_tree = null;
    CommonTree RBRACK529_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 109)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1147:5: ( arrayDeclaratorList arrayInitializer | LBRACK expression RBRACK ( LBRACK expression RBRACK )* ( arrayDeclaratorList )? )
        int alt153 = 2;
        int LA153_0 = input.LA(1);
        if ((LA153_0 == LBRACK)) {
            int LA153_1 = input.LA(2);
            if ((LA153_1 == RBRACK)) {
                alt153 = 1;
            } else if ((LA153_1 == DEC || LA153_1 == INC || LA153_1 == LESS_THAN || LA153_1 == LOGICAL_NOT || (LA153_1 >= LPAREN && LA153_1 <= MINUS) || LA153_1 == NOT || LA153_1 == PLUS || LA153_1 == BOOLEAN || LA153_1 == BYTE || LA153_1 == CHAR || LA153_1 == DOUBLE || LA153_1 == FALSE || LA153_1 == FLOAT || (LA153_1 >= INT && LA153_1 <= LONG) || (LA153_1 >= NEW && LA153_1 <= NULL) || LA153_1 == SHORT || LA153_1 == SUPER || LA153_1 == THIS || LA153_1 == TRUE || LA153_1 == VOID || (LA153_1 >= IDENT && LA153_1 <= STRING_LITERAL))) {
                alt153 = 2;
            } else {
                if (state.backtracking > 0) {
                    state.failed = true;
                    return retval;
                }
                NoViableAltException nvae = new NoViableAltException("", 153, 1, input);
                throw nvae;
            }
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return retval;
            }
            NoViableAltException nvae = new NoViableAltException("", 153, 0, input);
            throw nvae;
        }
        switch(alt153) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1147:9: arrayDeclaratorList arrayInitializer
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_arrayDeclaratorList_in_newArrayConstruction14338);
                    arrayDeclaratorList522 = arrayDeclaratorList();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, arrayDeclaratorList522.getTree());
                    }
                    pushFollow(FOLLOW_arrayInitializer_in_newArrayConstruction14340);
                    arrayInitializer523 = arrayInitializer();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, arrayInitializer523.getTree());
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1148:9: LBRACK expression RBRACK ( LBRACK expression RBRACK )* ( arrayDeclaratorList )?
                {
                    root_0 = (CommonTree) adaptor.nil();
                    LBRACK524 = (Token) match(input, LBRACK, FOLLOW_LBRACK_in_newArrayConstruction14350);
                    if (state.failed) {
                        return retval;
                    }
                    pushFollow(FOLLOW_expression_in_newArrayConstruction14353);
                    expression525 = expression();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, expression525.getTree());
                    }
                    RBRACK526 = (Token) match(input, RBRACK, FOLLOW_RBRACK_in_newArrayConstruction14355);
                    if (state.failed) {
                        return retval;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1148:36: ( LBRACK expression RBRACK )*
                    loop151: do {
                        int alt151 = 2;
                        alt151 = dfa151.predict(input);
                        switch(alt151) {
                            case 1:
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1148:37: LBRACK expression RBRACK
                                {
                                    LBRACK527 = (Token) match(input, LBRACK, FOLLOW_LBRACK_in_newArrayConstruction14359);
                                    if (state.failed) {
                                        return retval;
                                    }
                                    pushFollow(FOLLOW_expression_in_newArrayConstruction14362);
                                    expression528 = expression();
                                    state._fsp--;
                                    if (state.failed) {
                                        return retval;
                                    }
                                    if (state.backtracking == 0) {
                                        adaptor.addChild(root_0, expression528.getTree());
                                    }
                                    RBRACK529 = (Token) match(input, RBRACK, FOLLOW_RBRACK_in_newArrayConstruction14364);
                                    if (state.failed) {
                                        return retval;
                                    }
                                }
                                break;
                            default:
                                break loop151;
                        }
                    } while (true);
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1148:66: ( arrayDeclaratorList )?
                    int alt152 = 2;
                    int LA152_0 = input.LA(1);
                    if ((LA152_0 == LBRACK)) {
                        int LA152_1 = input.LA(2);
                        if ((LA152_1 == RBRACK)) {
                            alt152 = 1;
                        }
                    }
                    switch(alt152) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclaratorList
                            {
                                pushFollow(FOLLOW_arrayDeclaratorList_in_newArrayConstruction14369);
                                arrayDeclaratorList530 = arrayDeclaratorList();
                                state._fsp--;
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    adaptor.addChild(root_0, arrayDeclaratorList530.getTree());
                                }
                            }
                            break;
                    }
                }
                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, 109, newArrayConstruction_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 54 with RecognitionException

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

the class JavaParser method expression.

// $ANTLR start "expression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:929:1: expression : assignmentExpression -> ^( EXPR assignmentExpression ) ;
public final JavaParser.expression_return expression() throws RecognitionException {
    JavaParser.expression_return retval = new JavaParser.expression_return();
    retval.start = input.LT(1);
    int expression_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.assignmentExpression_return assignmentExpression365 = null;
    RewriteRuleSubtreeStream stream_assignmentExpression = new RewriteRuleSubtreeStream(adaptor, "rule assignmentExpression");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 88)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:930:5: ( assignmentExpression -> ^( EXPR assignmentExpression ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:930:9: assignmentExpression
        {
            pushFollow(FOLLOW_assignmentExpression_in_expression10216);
            assignmentExpression365 = assignmentExpression();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_assignmentExpression.add(assignmentExpression365.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();
                // 931:9: -> ^( EXPR assignmentExpression )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:931:13: ^( EXPR assignmentExpression )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(EXPR, "EXPR"), root_1);
                        adaptor.addChild(root_1, stream_assignmentExpression.nextTree());
                        adaptor.addChild(root_0, root_1);
                    }
                }
                retval.tree = root_0;
            }
        }
        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, 88, expression_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) RecognitionException(org.antlr.runtime.RecognitionException)

Example 55 with RecognitionException

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

the class JavaParser method qualifiedTypeIdent.

// $ANTLR start "qualifiedTypeIdent"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:667:1: qualifiedTypeIdent : typeIdent ( DOT typeIdent )* -> ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ ) ;
public final JavaParser.qualifiedTypeIdent_return qualifiedTypeIdent() throws RecognitionException {
    JavaParser.qualifiedTypeIdent_return retval = new JavaParser.qualifiedTypeIdent_return();
    retval.start = input.LT(1);
    int qualifiedTypeIdent_StartIndex = input.index();
    CommonTree root_0 = null;
    Token DOT175 = null;
    JavaParser.typeIdent_return typeIdent174 = null;
    JavaParser.typeIdent_return typeIdent176 = null;
    CommonTree DOT175_tree = null;
    RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor, "token DOT");
    RewriteRuleSubtreeStream stream_typeIdent = new RewriteRuleSubtreeStream(adaptor, "rule typeIdent");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 45)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:668:5: ( typeIdent ( DOT typeIdent )* -> ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:668:9: typeIdent ( DOT typeIdent )*
        {
            pushFollow(FOLLOW_typeIdent_in_qualifiedTypeIdent7001);
            typeIdent174 = typeIdent();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_typeIdent.add(typeIdent174.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:668:19: ( DOT typeIdent )*
            loop62: do {
                int alt62 = 2;
                int LA62_0 = input.LA(1);
                if ((LA62_0 == DOT)) {
                    int LA62_2 = input.LA(2);
                    if ((synpred80_Java())) {
                        alt62 = 1;
                    }
                }
                switch(alt62) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:668:20: DOT typeIdent
                        {
                            DOT175 = (Token) match(input, DOT, FOLLOW_DOT_in_qualifiedTypeIdent7004);
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_DOT.add(DOT175);
                            }
                            pushFollow(FOLLOW_typeIdent_in_qualifiedTypeIdent7006);
                            typeIdent176 = typeIdent();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_typeIdent.add(typeIdent176.getTree());
                            }
                        }
                        break;
                    default:
                        break loop62;
                }
            } while (true);
            // 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();
                // 669:9: -> ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:669:13: ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(QUALIFIED_TYPE_IDENT, "QUALIFIED_TYPE_IDENT"), root_1);
                        if (!(stream_typeIdent.hasNext())) {
                            throw new RewriteEarlyExitException();
                        }
                        while (stream_typeIdent.hasNext()) {
                            adaptor.addChild(root_1, stream_typeIdent.nextTree());
                        }
                        stream_typeIdent.reset();
                        adaptor.addChild(root_0, root_1);
                    }
                }
                retval.tree = root_0;
            }
        }
        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, 45, qualifiedTypeIdent_StartIndex);
        }
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RewriteEarlyExitException(org.antlr.runtime.tree.RewriteEarlyExitException) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

RecognitionException (org.antlr.runtime.RecognitionException)257 Token (org.antlr.runtime.Token)169 CommonTree (org.antlr.runtime.tree.CommonTree)132 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)98 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)74 CommonToken (org.antlr.runtime.CommonToken)48 NoViableAltException (org.antlr.runtime.NoViableAltException)43 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)21 ParserRuleReturnScope (org.antlr.runtime.ParserRuleReturnScope)14 CommonTokenStream (org.antlr.runtime.CommonTokenStream)11 EarlyExitException (org.antlr.runtime.EarlyExitException)10 MismatchedSetException (org.antlr.runtime.MismatchedSetException)10 ANTLRStringStream (org.antlr.runtime.ANTLRStringStream)8 MismatchedTokenException (org.antlr.runtime.MismatchedTokenException)7 TokenRewriteStream (org.antlr.runtime.TokenRewriteStream)7 FailedPredicateException (org.antlr.runtime.FailedPredicateException)6 MissingTokenException (org.antlr.runtime.MissingTokenException)6 UnwantedTokenException (org.antlr.runtime.UnwantedTokenException)6 BaseDescr (org.drools.compiler.lang.descr.BaseDescr)5 HashMap (java.util.HashMap)4