Search in sources :

Example 56 with CommonTree

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

Example 57 with CommonTree

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

the class JavaParser method genericWildcardBoundType.

// $ANTLR start "genericWildcardBoundType"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:707:1: genericWildcardBoundType : ( EXTENDS | SUPER ) type ;
public final JavaParser.genericWildcardBoundType_return genericWildcardBoundType() throws RecognitionException {
    JavaParser.genericWildcardBoundType_return retval = new JavaParser.genericWildcardBoundType_return();
    retval.start = input.LT(1);
    int genericWildcardBoundType_StartIndex = input.index();
    CommonTree root_0 = null;
    Token set193 = null;
    JavaParser.type_return type194 = null;
    CommonTree set193_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 52)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:708:5: ( ( EXTENDS | SUPER ) type )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:708:9: ( EXTENDS | SUPER ) type
        {
            root_0 = (CommonTree) adaptor.nil();
            set193 = (Token) input.LT(1);
            set193 = (Token) input.LT(1);
            if (input.LA(1) == EXTENDS || input.LA(1) == SUPER) {
                input.consume();
                if (state.backtracking == 0) {
                    root_0 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(set193), root_0);
                }
                state.errorRecovery = false;
                state.failed = false;
            } else {
                if (state.backtracking > 0) {
                    state.failed = true;
                    return retval;
                }
                MismatchedSetException mse = new MismatchedSetException(null, input);
                throw mse;
            }
            pushFollow(FOLLOW_type_in_genericWildcardBoundType7332);
            type194 = type();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                adaptor.addChild(root_0, type194.getTree());
            }
        }
        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, 52, genericWildcardBoundType_StartIndex);
        }
    }
    return retval;
}
Also used : MismatchedSetException(org.antlr.runtime.MismatchedSetException) CommonTree(org.antlr.runtime.tree.CommonTree) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 58 with CommonTree

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

the class JavaParser method packageDeclaration.

// $ANTLR start "packageDeclaration"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:427:1: packageDeclaration : PACKAGE qualifiedIdentifier SEMI ;
public final JavaParser.packageDeclaration_return packageDeclaration() throws RecognitionException {
    JavaParser.packageDeclaration_return retval = new JavaParser.packageDeclaration_return();
    retval.start = input.LT(1);
    int packageDeclaration_StartIndex = input.index();
    CommonTree root_0 = null;
    Token PACKAGE8 = null;
    Token SEMI10 = null;
    JavaParser.qualifiedIdentifier_return qualifiedIdentifier9 = null;
    CommonTree PACKAGE8_tree = null;
    CommonTree SEMI10_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 4)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:428:5: ( PACKAGE qualifiedIdentifier SEMI )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:428:9: PACKAGE qualifiedIdentifier SEMI
        {
            root_0 = (CommonTree) adaptor.nil();
            PACKAGE8 = (Token) match(input, PACKAGE, FOLLOW_PACKAGE_in_packageDeclaration4608);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                PACKAGE8_tree = (CommonTree) adaptor.create(PACKAGE8);
                root_0 = (CommonTree) adaptor.becomeRoot(PACKAGE8_tree, root_0);
            }
            pushFollow(FOLLOW_qualifiedIdentifier_in_packageDeclaration4611);
            qualifiedIdentifier9 = qualifiedIdentifier();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                adaptor.addChild(root_0, qualifiedIdentifier9.getTree());
            }
            SEMI10 = (Token) match(input, SEMI, FOLLOW_SEMI_in_packageDeclaration4613);
            if (state.failed) {
                return retval;
            }
        }
        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, 4, packageDeclaration_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 59 with CommonTree

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

the class JavaParser method classFieldDeclarator.

// $ANTLR start "classFieldDeclarator"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:574:1: classFieldDeclarator : variableDeclaratorId ( ASSIGN variableInitializer )? -> ^( VAR_DECLARATOR variableDeclaratorId ( variableInitializer )? ) ;
public final JavaParser.classFieldDeclarator_return classFieldDeclarator() throws RecognitionException {
    JavaParser.classFieldDeclarator_return retval = new JavaParser.classFieldDeclarator_return();
    retval.start = input.LT(1);
    int classFieldDeclarator_StartIndex = input.index();
    CommonTree root_0 = null;
    Token ASSIGN128 = null;
    JavaParser.variableDeclaratorId_return variableDeclaratorId127 = null;
    JavaParser.variableInitializer_return variableInitializer129 = null;
    CommonTree ASSIGN128_tree = null;
    RewriteRuleTokenStream stream_ASSIGN = new RewriteRuleTokenStream(adaptor, "token ASSIGN");
    RewriteRuleSubtreeStream stream_variableDeclaratorId = new RewriteRuleSubtreeStream(adaptor, "rule variableDeclaratorId");
    RewriteRuleSubtreeStream stream_variableInitializer = new RewriteRuleSubtreeStream(adaptor, "rule variableInitializer");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 28)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:575:5: ( variableDeclaratorId ( ASSIGN variableInitializer )? -> ^( VAR_DECLARATOR variableDeclaratorId ( variableInitializer )? ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:575:9: variableDeclaratorId ( ASSIGN variableInitializer )?
        {
            pushFollow(FOLLOW_variableDeclaratorId_in_classFieldDeclarator6269);
            variableDeclaratorId127 = variableDeclaratorId();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_variableDeclaratorId.add(variableDeclaratorId127.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:575:30: ( ASSIGN variableInitializer )?
            int alt46 = 2;
            int LA46_0 = input.LA(1);
            if ((LA46_0 == ASSIGN)) {
                alt46 = 1;
            }
            switch(alt46) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:575:31: ASSIGN variableInitializer
                    {
                        ASSIGN128 = (Token) match(input, ASSIGN, FOLLOW_ASSIGN_in_classFieldDeclarator6272);
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_ASSIGN.add(ASSIGN128);
                        }
                        pushFollow(FOLLOW_variableInitializer_in_classFieldDeclarator6274);
                        variableInitializer129 = variableInitializer();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_variableInitializer.add(variableInitializer129.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();
                // 576:9: -> ^( VAR_DECLARATOR variableDeclaratorId ( variableInitializer )? )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:576:13: ^( VAR_DECLARATOR variableDeclaratorId ( variableInitializer )? )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(VAR_DECLARATOR, "VAR_DECLARATOR"), root_1);
                        adaptor.addChild(root_1, stream_variableDeclaratorId.nextTree());
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:576:51: ( variableInitializer )?
                        if (stream_variableInitializer.hasNext()) {
                            adaptor.addChild(root_1, stream_variableInitializer.nextTree());
                        }
                        stream_variableInitializer.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, 28, classFieldDeclarator_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 60 with CommonTree

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

the class JavaParser method conditionalExpression.

// $ANTLR start "conditionalExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:952:1: conditionalExpression : logicalOrExpression ( QUESTION assignmentExpression COLON conditionalExpression )? ;
public final JavaParser.conditionalExpression_return conditionalExpression() throws RecognitionException {
    JavaParser.conditionalExpression_return retval = new JavaParser.conditionalExpression_return();
    retval.start = input.LT(1);
    int conditionalExpression_StartIndex = input.index();
    CommonTree root_0 = null;
    Token QUESTION381 = null;
    Token COLON383 = null;
    JavaParser.logicalOrExpression_return logicalOrExpression380 = null;
    JavaParser.assignmentExpression_return assignmentExpression382 = null;
    JavaParser.conditionalExpression_return conditionalExpression384 = null;
    CommonTree QUESTION381_tree = null;
    CommonTree COLON383_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 90)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:953:5: ( logicalOrExpression ( QUESTION assignmentExpression COLON conditionalExpression )? )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:953:9: logicalOrExpression ( QUESTION assignmentExpression COLON conditionalExpression )?
        {
            root_0 = (CommonTree) adaptor.nil();
            pushFollow(FOLLOW_logicalOrExpression_in_conditionalExpression10521);
            logicalOrExpression380 = logicalOrExpression();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                adaptor.addChild(root_0, logicalOrExpression380.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:953:29: ( QUESTION assignmentExpression COLON conditionalExpression )?
            int alt110 = 2;
            int LA110_0 = input.LA(1);
            if ((LA110_0 == QUESTION)) {
                alt110 = 1;
            }
            switch(alt110) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:953:30: QUESTION assignmentExpression COLON conditionalExpression
                    {
                        QUESTION381 = (Token) match(input, QUESTION, FOLLOW_QUESTION_in_conditionalExpression10524);
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            QUESTION381_tree = (CommonTree) adaptor.create(QUESTION381);
                            root_0 = (CommonTree) adaptor.becomeRoot(QUESTION381_tree, root_0);
                        }
                        pushFollow(FOLLOW_assignmentExpression_in_conditionalExpression10527);
                        assignmentExpression382 = assignmentExpression();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            adaptor.addChild(root_0, assignmentExpression382.getTree());
                        }
                        COLON383 = (Token) match(input, COLON, FOLLOW_COLON_in_conditionalExpression10529);
                        if (state.failed) {
                            return retval;
                        }
                        pushFollow(FOLLOW_conditionalExpression_in_conditionalExpression10532);
                        conditionalExpression384 = conditionalExpression();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            adaptor.addChild(root_0, conditionalExpression384.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, 90, conditionalExpression_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