Search in sources :

Example 56 with RecognitionException

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

the class JavaParser method inclusiveOrExpression.

// $ANTLR start "inclusiveOrExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:964:1: inclusiveOrExpression : exclusiveOrExpression ( OR exclusiveOrExpression )* ;
public final JavaParser.inclusiveOrExpression_return inclusiveOrExpression() throws RecognitionException {
    JavaParser.inclusiveOrExpression_return retval = new JavaParser.inclusiveOrExpression_return();
    retval.start = input.LT(1);
    int inclusiveOrExpression_StartIndex = input.index();
    CommonTree root_0 = null;
    Token OR392 = null;
    JavaParser.exclusiveOrExpression_return exclusiveOrExpression391 = null;
    JavaParser.exclusiveOrExpression_return exclusiveOrExpression393 = null;
    CommonTree OR392_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 93)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:965:5: ( exclusiveOrExpression ( OR exclusiveOrExpression )* )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:965:9: exclusiveOrExpression ( OR exclusiveOrExpression )*
        {
            root_0 = (CommonTree) adaptor.nil();
            pushFollow(FOLLOW_exclusiveOrExpression_in_inclusiveOrExpression10607);
            exclusiveOrExpression391 = exclusiveOrExpression();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                adaptor.addChild(root_0, exclusiveOrExpression391.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:965:31: ( OR exclusiveOrExpression )*
            loop113: do {
                int alt113 = 2;
                int LA113_0 = input.LA(1);
                if ((LA113_0 == OR)) {
                    alt113 = 1;
                }
                switch(alt113) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:965:32: OR exclusiveOrExpression
                        {
                            OR392 = (Token) match(input, OR, FOLLOW_OR_in_inclusiveOrExpression10610);
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                OR392_tree = (CommonTree) adaptor.create(OR392);
                                root_0 = (CommonTree) adaptor.becomeRoot(OR392_tree, root_0);
                            }
                            pushFollow(FOLLOW_exclusiveOrExpression_in_inclusiveOrExpression10613);
                            exclusiveOrExpression393 = exclusiveOrExpression();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                adaptor.addChild(root_0, exclusiveOrExpression393.getTree());
                            }
                        }
                        break;
                    default:
                        break loop113;
                }
            } 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, 93, inclusiveOrExpression_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 57 with RecognitionException

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

the class JavaParser method variableDeclaratorId.

// $ANTLR start "variableDeclaratorId"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:589:1: variableDeclaratorId : IDENT ( arrayDeclaratorList )? ;
public final JavaParser.variableDeclaratorId_return variableDeclaratorId() throws RecognitionException {
    JavaParser.variableDeclaratorId_return retval = new JavaParser.variableDeclaratorId_return();
    retval.start = input.LT(1);
    int variableDeclaratorId_StartIndex = input.index();
    CommonTree root_0 = null;
    Token IDENT136 = null;
    JavaParser.arrayDeclaratorList_return arrayDeclaratorList137 = null;
    CommonTree IDENT136_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 31)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:590:5: ( IDENT ( arrayDeclaratorList )? )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:590:9: IDENT ( arrayDeclaratorList )?
        {
            root_0 = (CommonTree) adaptor.nil();
            IDENT136 = (Token) match(input, IDENT, FOLLOW_IDENT_in_variableDeclaratorId6401);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                IDENT136_tree = (CommonTree) adaptor.create(IDENT136);
                root_0 = (CommonTree) adaptor.becomeRoot(IDENT136_tree, root_0);
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:590:16: ( arrayDeclaratorList )?
            int alt48 = 2;
            int LA48_0 = input.LA(1);
            if ((LA48_0 == LBRACK)) {
                alt48 = 1;
            }
            switch(alt48) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclaratorList
                    {
                        pushFollow(FOLLOW_arrayDeclaratorList_in_variableDeclaratorId6404);
                        arrayDeclaratorList137 = arrayDeclaratorList();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            adaptor.addChild(root_0, arrayDeclaratorList137.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, 31, variableDeclaratorId_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 58 with RecognitionException

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

the class JavaParser method forUpdater.

// $ANTLR start "forUpdater"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:913:1: forUpdater : ( expressionList )? -> ^( FOR_UPDATE ( expressionList )? ) ;
public final JavaParser.forUpdater_return forUpdater() throws RecognitionException {
    JavaParser.forUpdater_return retval = new JavaParser.forUpdater_return();
    retval.start = input.LT(1);
    int forUpdater_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.expressionList_return expressionList358 = null;
    RewriteRuleSubtreeStream stream_expressionList = new RewriteRuleSubtreeStream(adaptor, "rule expressionList");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 85)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:914:5: ( ( expressionList )? -> ^( FOR_UPDATE ( expressionList )? ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:914:9: ( expressionList )?
        {
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:914:9: ( expressionList )?
            int alt106 = 2;
            int LA106_0 = input.LA(1);
            if ((LA106_0 == DEC || LA106_0 == INC || LA106_0 == LESS_THAN || LA106_0 == LOGICAL_NOT || (LA106_0 >= LPAREN && LA106_0 <= MINUS) || LA106_0 == NOT || LA106_0 == PLUS || LA106_0 == BOOLEAN || LA106_0 == BYTE || LA106_0 == CHAR || LA106_0 == DOUBLE || LA106_0 == FALSE || LA106_0 == FLOAT || (LA106_0 >= INT && LA106_0 <= LONG) || (LA106_0 >= NEW && LA106_0 <= NULL) || LA106_0 == SHORT || LA106_0 == SUPER || LA106_0 == THIS || LA106_0 == TRUE || LA106_0 == VOID || (LA106_0 >= IDENT && LA106_0 <= STRING_LITERAL))) {
                alt106 = 1;
            }
            switch(alt106) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: expressionList
                    {
                        pushFollow(FOLLOW_expressionList_in_forUpdater10108);
                        expressionList358 = expressionList();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_expressionList.add(expressionList358.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();
                // 915:9: -> ^( FOR_UPDATE ( expressionList )? )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:915:13: ^( FOR_UPDATE ( expressionList )? )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FOR_UPDATE, "FOR_UPDATE"), root_1);
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:915:26: ( expressionList )?
                        if (stream_expressionList.hasNext()) {
                            adaptor.addChild(root_1, stream_expressionList.nextTree());
                        }
                        stream_expressionList.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, 85, forUpdater_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) RecognitionException(org.antlr.runtime.RecognitionException)

Example 59 with RecognitionException

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

the class JavaParser method switchDefaultLabel.

// $ANTLR start "switchDefaultLabel"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:898:1: switchDefaultLabel : DEFAULT COLON ( blockStatement )* ;
public final JavaParser.switchDefaultLabel_return switchDefaultLabel() throws RecognitionException {
    JavaParser.switchDefaultLabel_return retval = new JavaParser.switchDefaultLabel_return();
    retval.start = input.LT(1);
    int switchDefaultLabel_StartIndex = input.index();
    CommonTree root_0 = null;
    Token DEFAULT352 = null;
    Token COLON353 = null;
    JavaParser.blockStatement_return blockStatement354 = null;
    CommonTree DEFAULT352_tree = null;
    CommonTree COLON353_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 82)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:899:5: ( DEFAULT COLON ( blockStatement )* )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:899:9: DEFAULT COLON ( blockStatement )*
        {
            root_0 = (CommonTree) adaptor.nil();
            DEFAULT352 = (Token) match(input, DEFAULT, FOLLOW_DEFAULT_in_switchDefaultLabel9938);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                DEFAULT352_tree = (CommonTree) adaptor.create(DEFAULT352);
                root_0 = (CommonTree) adaptor.becomeRoot(DEFAULT352_tree, root_0);
            }
            COLON353 = (Token) match(input, COLON, FOLLOW_COLON_in_switchDefaultLabel9941);
            if (state.failed) {
                return retval;
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:899:25: ( blockStatement )*
            loop103: do {
                int alt103 = 2;
                int LA103_0 = input.LA(1);
                if ((LA103_0 == AT || LA103_0 == DEC || LA103_0 == INC || LA103_0 == LCURLY || LA103_0 == LESS_THAN || LA103_0 == LOGICAL_NOT || (LA103_0 >= LPAREN && LA103_0 <= MINUS) || LA103_0 == NOT || LA103_0 == PLUS || LA103_0 == SEMI || (LA103_0 >= ABSTRACT && LA103_0 <= BYTE) || (LA103_0 >= CHAR && LA103_0 <= CONTINUE) || (LA103_0 >= DO && LA103_0 <= DOUBLE) || LA103_0 == ENUM || (LA103_0 >= FALSE && LA103_0 <= FINAL) || (LA103_0 >= FLOAT && LA103_0 <= IF) || LA103_0 == INTERFACE || (LA103_0 >= INT && LA103_0 <= NULL) || (LA103_0 >= PRIVATE && LA103_0 <= THROW) || (LA103_0 >= TRANSIENT && LA103_0 <= WHILE) || (LA103_0 >= IDENT && LA103_0 <= STRING_LITERAL))) {
                    alt103 = 1;
                }
                switch(alt103) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: blockStatement
                        {
                            pushFollow(FOLLOW_blockStatement_in_switchDefaultLabel9944);
                            blockStatement354 = blockStatement();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                adaptor.addChild(root_0, blockStatement354.getTree());
                            }
                        }
                        break;
                    default:
                        break loop103;
                }
            } 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, 82, switchDefaultLabel_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 60 with RecognitionException

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

the class JavaParser method classExtendsClause.

// $ANTLR start "classExtendsClause"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:449:1: classExtendsClause : EXTENDS type -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type ) ;
public final JavaParser.classExtendsClause_return classExtendsClause() throws RecognitionException {
    JavaParser.classExtendsClause_return retval = new JavaParser.classExtendsClause_return();
    retval.start = input.LT(1);
    int classExtendsClause_StartIndex = input.index();
    CommonTree root_0 = null;
    Token EXTENDS27 = null;
    JavaParser.type_return type28 = null;
    CommonTree EXTENDS27_tree = null;
    RewriteRuleTokenStream stream_EXTENDS = new RewriteRuleTokenStream(adaptor, "token EXTENDS");
    RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 8)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:450:5: ( EXTENDS type -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:450:9: EXTENDS type
        {
            EXTENDS27 = (Token) match(input, EXTENDS, FOLLOW_EXTENDS_in_classExtendsClause4817);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_EXTENDS.add(EXTENDS27);
            }
            pushFollow(FOLLOW_type_in_classExtendsClause4819);
            type28 = type();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_type.add(type28.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();
                // 451:9: -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:451:13: ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(EXTENDS_CLAUSE, EXTENDS27, "EXTENDS_CLAUSE"), root_1);
                        adaptor.addChild(root_1, stream_type.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, 8, classExtendsClause_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)

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