Search in sources :

Example 26 with CommonTree

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

the class JavaParser method genericTypeArgumentSimplified.

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

Example 27 with CommonTree

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

the class JavaParser method localModifierList.

// $ANTLR start "localModifierList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:637:1: localModifierList : ( localModifier )* -> ^( LOCAL_MODIFIER_LIST ( localModifier )* ) ;
public final JavaParser.localModifierList_return localModifierList() throws RecognitionException {
    JavaParser.localModifierList_return retval = new JavaParser.localModifierList_return();
    retval.start = input.LT(1);
    int localModifierList_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.localModifier_return localModifier163 = null;
    RewriteRuleSubtreeStream stream_localModifier = new RewriteRuleSubtreeStream(adaptor, "rule localModifier");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 39)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:638:5: ( ( localModifier )* -> ^( LOCAL_MODIFIER_LIST ( localModifier )* ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:638:9: ( localModifier )*
        {
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:638:9: ( localModifier )*
            loop56: do {
                int alt56 = 2;
                int LA56_0 = input.LA(1);
                if ((LA56_0 == AT || LA56_0 == FINAL)) {
                    alt56 = 1;
                }
                switch(alt56) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: localModifier
                        {
                            pushFollow(FOLLOW_localModifier_in_localModifierList6778);
                            localModifier163 = localModifier();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_localModifier.add(localModifier163.getTree());
                            }
                        }
                        break;
                    default:
                        break loop56;
                }
            } 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();
                // 639:9: -> ^( LOCAL_MODIFIER_LIST ( localModifier )* )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:639:12: ^( LOCAL_MODIFIER_LIST ( localModifier )* )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(LOCAL_MODIFIER_LIST, "LOCAL_MODIFIER_LIST"), root_1);
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:639:34: ( localModifier )*
                        while (stream_localModifier.hasNext()) {
                            adaptor.addChild(root_1, stream_localModifier.nextTree());
                        }
                        stream_localModifier.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, 39, localModifierList_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) RecognitionException(org.antlr.runtime.RecognitionException)

Example 28 with CommonTree

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

the class JavaParser method interfaceFieldDeclarator.

// $ANTLR start "interfaceFieldDeclarator"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:584:1: interfaceFieldDeclarator : variableDeclaratorId ASSIGN variableInitializer -> ^( VAR_DECLARATOR variableDeclaratorId variableInitializer ) ;
public final JavaParser.interfaceFieldDeclarator_return interfaceFieldDeclarator() throws RecognitionException {
    JavaParser.interfaceFieldDeclarator_return retval = new JavaParser.interfaceFieldDeclarator_return();
    retval.start = input.LT(1);
    int interfaceFieldDeclarator_StartIndex = input.index();
    CommonTree root_0 = null;
    Token ASSIGN134 = null;
    JavaParser.variableDeclaratorId_return variableDeclaratorId133 = null;
    JavaParser.variableInitializer_return variableInitializer135 = null;
    CommonTree ASSIGN134_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, 30)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:585:5: ( variableDeclaratorId ASSIGN variableInitializer -> ^( VAR_DECLARATOR variableDeclaratorId variableInitializer ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:585:9: variableDeclaratorId ASSIGN variableInitializer
        {
            pushFollow(FOLLOW_variableDeclaratorId_in_interfaceFieldDeclarator6359);
            variableDeclaratorId133 = variableDeclaratorId();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_variableDeclaratorId.add(variableDeclaratorId133.getTree());
            }
            ASSIGN134 = (Token) match(input, ASSIGN, FOLLOW_ASSIGN_in_interfaceFieldDeclarator6361);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_ASSIGN.add(ASSIGN134);
            }
            pushFollow(FOLLOW_variableInitializer_in_interfaceFieldDeclarator6363);
            variableInitializer135 = variableInitializer();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_variableInitializer.add(variableInitializer135.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();
                // 586:9: -> ^( VAR_DECLARATOR variableDeclaratorId variableInitializer )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:586: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());
                        adaptor.addChild(root_1, stream_variableInitializer.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, 30, interfaceFieldDeclarator_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 29 with CommonTree

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

the class JavaParser method formalParameterVarArgDecl.

// $ANTLR start "formalParameterVarArgDecl"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:744:1: formalParameterVarArgDecl : localModifierList type ELLIPSIS variableDeclaratorId -> ^( FORMAL_PARAM_VARARG_DECL localModifierList type variableDeclaratorId ) ;
public final JavaParser.formalParameterVarArgDecl_return formalParameterVarArgDecl() throws RecognitionException {
    JavaParser.formalParameterVarArgDecl_return retval = new JavaParser.formalParameterVarArgDecl_return();
    retval.start = input.LT(1);
    int formalParameterVarArgDecl_StartIndex = input.index();
    CommonTree root_0 = null;
    Token ELLIPSIS218 = null;
    JavaParser.localModifierList_return localModifierList216 = null;
    JavaParser.type_return type217 = null;
    JavaParser.variableDeclaratorId_return variableDeclaratorId219 = null;
    CommonTree ELLIPSIS218_tree = null;
    RewriteRuleTokenStream stream_ELLIPSIS = new RewriteRuleTokenStream(adaptor, "token ELLIPSIS");
    RewriteRuleSubtreeStream stream_variableDeclaratorId = new RewriteRuleSubtreeStream(adaptor, "rule variableDeclaratorId");
    RewriteRuleSubtreeStream stream_localModifierList = new RewriteRuleSubtreeStream(adaptor, "rule localModifierList");
    RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 58)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:745:5: ( localModifierList type ELLIPSIS variableDeclaratorId -> ^( FORMAL_PARAM_VARARG_DECL localModifierList type variableDeclaratorId ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:745:9: localModifierList type ELLIPSIS variableDeclaratorId
        {
            pushFollow(FOLLOW_localModifierList_in_formalParameterVarArgDecl7688);
            localModifierList216 = localModifierList();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_localModifierList.add(localModifierList216.getTree());
            }
            pushFollow(FOLLOW_type_in_formalParameterVarArgDecl7690);
            type217 = type();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_type.add(type217.getTree());
            }
            ELLIPSIS218 = (Token) match(input, ELLIPSIS, FOLLOW_ELLIPSIS_in_formalParameterVarArgDecl7692);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_ELLIPSIS.add(ELLIPSIS218);
            }
            pushFollow(FOLLOW_variableDeclaratorId_in_formalParameterVarArgDecl7694);
            variableDeclaratorId219 = variableDeclaratorId();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_variableDeclaratorId.add(variableDeclaratorId219.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();
                // 746:9: -> ^( FORMAL_PARAM_VARARG_DECL localModifierList type variableDeclaratorId )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:746:13: ^( FORMAL_PARAM_VARARG_DECL localModifierList type variableDeclaratorId )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FORMAL_PARAM_VARARG_DECL, "FORMAL_PARAM_VARARG_DECL"), root_1);
                        adaptor.addChild(root_1, stream_localModifierList.nextTree());
                        adaptor.addChild(root_1, stream_type.nextTree());
                        adaptor.addChild(root_1, stream_variableDeclaratorId.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, 58, formalParameterVarArgDecl_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 30 with CommonTree

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

the class JavaParser method annotation.

// $ANTLR start "annotation"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:763:1: annotation : AT qualifiedIdentifier ( annotationInit )? ;
public final JavaParser.annotation_return annotation() throws RecognitionException {
    JavaParser.annotation_return retval = new JavaParser.annotation_return();
    retval.start = input.LT(1);
    int annotation_StartIndex = input.index();
    CommonTree root_0 = null;
    Token AT223 = null;
    JavaParser.qualifiedIdentifier_return qualifiedIdentifier224 = null;
    JavaParser.annotationInit_return annotationInit225 = null;
    CommonTree AT223_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 61)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:764:5: ( AT qualifiedIdentifier ( annotationInit )? )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:764:9: AT qualifiedIdentifier ( annotationInit )?
        {
            root_0 = (CommonTree) adaptor.nil();
            AT223 = (Token) match(input, AT, FOLLOW_AT_in_annotation7872);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                AT223_tree = (CommonTree) adaptor.create(AT223);
                root_0 = (CommonTree) adaptor.becomeRoot(AT223_tree, root_0);
            }
            pushFollow(FOLLOW_qualifiedIdentifier_in_annotation7875);
            qualifiedIdentifier224 = qualifiedIdentifier();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                adaptor.addChild(root_0, qualifiedIdentifier224.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:764:33: ( annotationInit )?
            int alt77 = 2;
            int LA77_0 = input.LA(1);
            if ((LA77_0 == LPAREN)) {
                alt77 = 1;
            }
            switch(alt77) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: annotationInit
                    {
                        pushFollow(FOLLOW_annotationInit_in_annotation7877);
                        annotationInit225 = annotationInit();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            adaptor.addChild(root_0, annotationInit225.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, 61, annotation_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