Search in sources :

Example 51 with CommonTree

use of org.antlr.runtime.tree.CommonTree 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)

Example 52 with CommonTree

use of org.antlr.runtime.tree.CommonTree 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 53 with CommonTree

use of org.antlr.runtime.tree.CommonTree 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 54 with CommonTree

use of org.antlr.runtime.tree.CommonTree 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 55 with CommonTree

use of org.antlr.runtime.tree.CommonTree 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)

Aggregations

CommonTree (org.antlr.runtime.tree.CommonTree)155 RecognitionException (org.antlr.runtime.RecognitionException)132 Token (org.antlr.runtime.Token)106 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)81 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)62 NoViableAltException (org.antlr.runtime.NoViableAltException)33 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)15 CommonTokenStream (org.antlr.runtime.CommonTokenStream)12 CommonTreeNodeStream (org.antlr.runtime.tree.CommonTreeNodeStream)8 ANTLRStringStream (org.antlr.runtime.ANTLRStringStream)6 EarlyExitException (org.antlr.runtime.EarlyExitException)4 MismatchedSetException (org.antlr.runtime.MismatchedSetException)4 WindowingException (com.sap.hadoop.windowing.WindowingException)3 FileInputStream (java.io.FileInputStream)3 InputStreamReader (java.io.InputStreamReader)3 CharStream (org.antlr.runtime.CharStream)3 Tree (org.antlr.runtime.tree.Tree)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 TokenSource (org.antlr.runtime.TokenSource)2