Search in sources :

Example 16 with RewriteRuleSubtreeStream

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

the class JavaParser method classBody.

// $ANTLR start "classBody"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:525:1: classBody : LCURLY ( classScopeDeclarations )* RCURLY -> ^( CLASS_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* ) ;
public final JavaParser.classBody_return classBody() throws RecognitionException {
    JavaParser.classBody_return retval = new JavaParser.classBody_return();
    retval.start = input.LT(1);
    int classBody_StartIndex = input.index();
    CommonTree root_0 = null;
    Token LCURLY74 = null;
    Token RCURLY76 = null;
    JavaParser.classScopeDeclarations_return classScopeDeclarations75 = null;
    CommonTree LCURLY74_tree = null;
    CommonTree RCURLY76_tree = null;
    RewriteRuleTokenStream stream_LCURLY = new RewriteRuleTokenStream(adaptor, "token LCURLY");
    RewriteRuleTokenStream stream_RCURLY = new RewriteRuleTokenStream(adaptor, "token RCURLY");
    RewriteRuleSubtreeStream stream_classScopeDeclarations = new RewriteRuleSubtreeStream(adaptor, "rule classScopeDeclarations");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 23)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:526:5: ( LCURLY ( classScopeDeclarations )* RCURLY -> ^( CLASS_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:526:9: LCURLY ( classScopeDeclarations )* RCURLY
        {
            LCURLY74 = (Token) match(input, LCURLY, FOLLOW_LCURLY_in_classBody5496);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_LCURLY.add(LCURLY74);
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:526:16: ( classScopeDeclarations )*
            loop26: do {
                int alt26 = 2;
                int LA26_0 = input.LA(1);
                if ((LA26_0 == AT || LA26_0 == LCURLY || LA26_0 == LESS_THAN || LA26_0 == SEMI || LA26_0 == ABSTRACT || LA26_0 == BOOLEAN || LA26_0 == BYTE || (LA26_0 >= CHAR && LA26_0 <= CLASS) || LA26_0 == DOUBLE || LA26_0 == ENUM || LA26_0 == FINAL || LA26_0 == FLOAT || LA26_0 == INTERFACE || (LA26_0 >= INT && LA26_0 <= NATIVE) || (LA26_0 >= PRIVATE && LA26_0 <= PUBLIC) || (LA26_0 >= SHORT && LA26_0 <= STRICTFP) || LA26_0 == SYNCHRONIZED || LA26_0 == TRANSIENT || (LA26_0 >= VOID && LA26_0 <= VOLATILE) || LA26_0 == IDENT)) {
                    alt26 = 1;
                }
                switch(alt26) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: classScopeDeclarations
                        {
                            pushFollow(FOLLOW_classScopeDeclarations_in_classBody5498);
                            classScopeDeclarations75 = classScopeDeclarations();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_classScopeDeclarations.add(classScopeDeclarations75.getTree());
                            }
                        }
                        break;
                    default:
                        break loop26;
                }
            } while (true);
            RCURLY76 = (Token) match(input, RCURLY, FOLLOW_RCURLY_in_classBody5501);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_RCURLY.add(RCURLY76);
            }
            // 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();
                // 527:9: -> ^( CLASS_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:527:13: ^( CLASS_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CLASS_TOP_LEVEL_SCOPE, LCURLY74, "CLASS_TOP_LEVEL_SCOPE"), root_1);
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:527:71: ( 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, 23, classBody_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 17 with RewriteRuleSubtreeStream

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

the class JavaParser method objectTypeSimplified.

// $ANTLR start "objectTypeSimplified"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:662:1: objectTypeSimplified : qualifiedTypeIdentSimplified ( arrayDeclaratorList )? -> ^( TYPE qualifiedTypeIdentSimplified ( arrayDeclaratorList )? ) ;
public final JavaParser.objectTypeSimplified_return objectTypeSimplified() throws RecognitionException {
    JavaParser.objectTypeSimplified_return retval = new JavaParser.objectTypeSimplified_return();
    retval.start = input.LT(1);
    int objectTypeSimplified_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.qualifiedTypeIdentSimplified_return qualifiedTypeIdentSimplified172 = null;
    JavaParser.arrayDeclaratorList_return arrayDeclaratorList173 = null;
    RewriteRuleSubtreeStream stream_arrayDeclaratorList = new RewriteRuleSubtreeStream(adaptor, "rule arrayDeclaratorList");
    RewriteRuleSubtreeStream stream_qualifiedTypeIdentSimplified = new RewriteRuleSubtreeStream(adaptor, "rule qualifiedTypeIdentSimplified");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 44)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:663:5: ( qualifiedTypeIdentSimplified ( arrayDeclaratorList )? -> ^( TYPE qualifiedTypeIdentSimplified ( arrayDeclaratorList )? ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:663:9: qualifiedTypeIdentSimplified ( arrayDeclaratorList )?
        {
            pushFollow(FOLLOW_qualifiedTypeIdentSimplified_in_objectTypeSimplified6959);
            qualifiedTypeIdentSimplified172 = qualifiedTypeIdentSimplified();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_qualifiedTypeIdentSimplified.add(qualifiedTypeIdentSimplified172.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:663:38: ( arrayDeclaratorList )?
            int alt61 = 2;
            int LA61_0 = input.LA(1);
            if ((LA61_0 == LBRACK)) {
                alt61 = 1;
            }
            switch(alt61) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclaratorList
                    {
                        pushFollow(FOLLOW_arrayDeclaratorList_in_objectTypeSimplified6961);
                        arrayDeclaratorList173 = arrayDeclaratorList();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_arrayDeclaratorList.add(arrayDeclaratorList173.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();
                // 664:9: -> ^( TYPE qualifiedTypeIdentSimplified ( arrayDeclaratorList )? )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:664:13: ^( TYPE qualifiedTypeIdentSimplified ( arrayDeclaratorList )? )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(TYPE, "TYPE"), root_1);
                        adaptor.addChild(root_1, stream_qualifiedTypeIdentSimplified.nextTree());
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:664:49: ( arrayDeclaratorList )?
                        if (stream_arrayDeclaratorList.hasNext()) {
                            adaptor.addChild(root_1, stream_arrayDeclaratorList.nextTree());
                        }
                        stream_arrayDeclaratorList.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, 44, objectTypeSimplified_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) RecognitionException(org.antlr.runtime.RecognitionException)

Example 18 with RewriteRuleSubtreeStream

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

the class CssParser method nest.

// $ANTLR start "nest"
// /home/langera/dev/freud/src/grammar/Css.g:52:1: nest : IDENT ( IDENT )* ( pseudo )* -> ^( NEST IDENT ( IDENT )* ( pseudo )* ) ;
public final CssParser.nest_return nest() throws RecognitionException {
    CssParser.nest_return retval = new CssParser.nest_return();
    retval.start = input.LT(1);
    CommonTree root_0 = null;
    Token IDENT13 = null;
    Token IDENT14 = null;
    CssParser.pseudo_return pseudo15 = null;
    CommonTree IDENT13_tree = null;
    CommonTree IDENT14_tree = null;
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleSubtreeStream stream_pseudo = new RewriteRuleSubtreeStream(adaptor, "rule pseudo");
    try {
        // /home/langera/dev/freud/src/grammar/Css.g:53:2: ( IDENT ( IDENT )* ( pseudo )* -> ^( NEST IDENT ( IDENT )* ( pseudo )* ) )
        // /home/langera/dev/freud/src/grammar/Css.g:53:4: IDENT ( IDENT )* ( pseudo )*
        {
            IDENT13 = (Token) match(input, IDENT, FOLLOW_IDENT_in_nest222);
            stream_IDENT.add(IDENT13);
            // /home/langera/dev/freud/src/grammar/Css.g:53:10: ( IDENT )*
            loop6: do {
                int alt6 = 2;
                int LA6_0 = input.LA(1);
                if ((LA6_0 == IDENT)) {
                    alt6 = 1;
                }
                switch(alt6) {
                    case 1:
                        // /home/langera/dev/freud/src/grammar/Css.g:53:10: IDENT
                        {
                            IDENT14 = (Token) match(input, IDENT, FOLLOW_IDENT_in_nest224);
                            stream_IDENT.add(IDENT14);
                        }
                        break;
                    default:
                        break loop6;
                }
            } while (true);
            // /home/langera/dev/freud/src/grammar/Css.g:53:17: ( pseudo )*
            loop7: do {
                int alt7 = 2;
                int LA7_0 = input.LA(1);
                if (((LA7_0 >= 38 && LA7_0 <= 39))) {
                    alt7 = 1;
                }
                switch(alt7) {
                    case 1:
                        // /home/langera/dev/freud/src/grammar/Css.g:53:17: pseudo
                        {
                            pushFollow(FOLLOW_pseudo_in_nest227);
                            pseudo15 = pseudo();
                            state._fsp--;
                            stream_pseudo.add(pseudo15.getTree());
                        }
                        break;
                    default:
                        break loop7;
                }
            } while (true);
            // AST REWRITE
            // elements: pseudo, IDENT, IDENT
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
            root_0 = (CommonTree) adaptor.nil();
            // 53:25: -> ^( NEST IDENT ( IDENT )* ( pseudo )* )
            {
                // /home/langera/dev/freud/src/grammar/Css.g:53:28: ^( NEST IDENT ( IDENT )* ( pseudo )* )
                {
                    CommonTree root_1 = (CommonTree) adaptor.nil();
                    root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(NEST, "NEST"), root_1);
                    adaptor.addChild(root_1, stream_IDENT.nextNode());
                    // /home/langera/dev/freud/src/grammar/Css.g:53:42: ( IDENT )*
                    while (stream_IDENT.hasNext()) {
                        adaptor.addChild(root_1, stream_IDENT.nextNode());
                    }
                    stream_IDENT.reset();
                    // /home/langera/dev/freud/src/grammar/Css.g:53:49: ( pseudo )*
                    while (stream_pseudo.hasNext()) {
                        adaptor.addChild(root_1, stream_pseudo.nextTree());
                    }
                    stream_pseudo.reset();
                    adaptor.addChild(root_0, root_1);
                }
            }
            retval.tree = root_0;
        }
        retval.stop = input.LT(-1);
        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 {
    }
    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 19 with RewriteRuleSubtreeStream

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

the class CssParser method attrib.

// $ANTLR start "attrib"
// /home/langera/dev/freud/src/grammar/Css.g:93:1: attrib : '[' IDENT ( attribRelate IDENT )? ']' -> ^( ATTRIB IDENT ( attribRelate ( IDENT )* )? ) ;
public final CssParser.attrib_return attrib() throws RecognitionException {
    CssParser.attrib_return retval = new CssParser.attrib_return();
    retval.start = input.LT(1);
    CommonTree root_0 = null;
    Token char_literal46 = null;
    Token IDENT47 = null;
    Token IDENT49 = null;
    Token char_literal50 = null;
    CssParser.attribRelate_return attribRelate48 = null;
    CommonTree char_literal46_tree = null;
    CommonTree IDENT47_tree = null;
    CommonTree IDENT49_tree = null;
    CommonTree char_literal50_tree = null;
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleTokenStream stream_41 = new RewriteRuleTokenStream(adaptor, "token 41");
    RewriteRuleTokenStream stream_40 = new RewriteRuleTokenStream(adaptor, "token 40");
    RewriteRuleSubtreeStream stream_attribRelate = new RewriteRuleSubtreeStream(adaptor, "rule attribRelate");
    try {
        // /home/langera/dev/freud/src/grammar/Css.g:94:2: ( '[' IDENT ( attribRelate IDENT )? ']' -> ^( ATTRIB IDENT ( attribRelate ( IDENT )* )? ) )
        // /home/langera/dev/freud/src/grammar/Css.g:94:4: '[' IDENT ( attribRelate IDENT )? ']'
        {
            char_literal46 = (Token) match(input, 40, FOLLOW_40_in_attrib540);
            stream_40.add(char_literal46);
            IDENT47 = (Token) match(input, IDENT, FOLLOW_IDENT_in_attrib542);
            stream_IDENT.add(IDENT47);
            // /home/langera/dev/freud/src/grammar/Css.g:94:14: ( attribRelate IDENT )?
            int alt21 = 2;
            int LA21_0 = input.LA(1);
            if (((LA21_0 >= 42 && LA21_0 <= 44))) {
                alt21 = 1;
            }
            switch(alt21) {
                case 1:
                    // /home/langera/dev/freud/src/grammar/Css.g:94:15: attribRelate IDENT
                    {
                        pushFollow(FOLLOW_attribRelate_in_attrib545);
                        attribRelate48 = attribRelate();
                        state._fsp--;
                        stream_attribRelate.add(attribRelate48.getTree());
                        IDENT49 = (Token) match(input, IDENT, FOLLOW_IDENT_in_attrib547);
                        stream_IDENT.add(IDENT49);
                    }
                    break;
            }
            char_literal50 = (Token) match(input, 41, FOLLOW_41_in_attrib551);
            stream_41.add(char_literal50);
            // AST REWRITE
            // elements: attribRelate, IDENT, IDENT
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
            root_0 = (CommonTree) adaptor.nil();
            // 94:40: -> ^( ATTRIB IDENT ( attribRelate ( IDENT )* )? )
            {
                // /home/langera/dev/freud/src/grammar/Css.g:94:43: ^( ATTRIB IDENT ( attribRelate ( IDENT )* )? )
                {
                    CommonTree root_1 = (CommonTree) adaptor.nil();
                    root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ATTRIB, "ATTRIB"), root_1);
                    adaptor.addChild(root_1, stream_IDENT.nextNode());
                    // /home/langera/dev/freud/src/grammar/Css.g:94:59: ( attribRelate ( IDENT )* )?
                    if (stream_attribRelate.hasNext() || stream_IDENT.hasNext()) {
                        adaptor.addChild(root_1, stream_attribRelate.nextTree());
                        // /home/langera/dev/freud/src/grammar/Css.g:94:73: ( IDENT )*
                        while (stream_IDENT.hasNext()) {
                            adaptor.addChild(root_1, stream_IDENT.nextNode());
                        }
                        stream_IDENT.reset();
                    }
                    stream_attribRelate.reset();
                    stream_IDENT.reset();
                    adaptor.addChild(root_0, root_1);
                }
            }
            retval.tree = root_0;
        }
        retval.stop = input.LT(-1);
        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 {
    }
    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 20 with RewriteRuleSubtreeStream

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

the class CssParser method pseudo.

// $ANTLR start "pseudo"
// /home/langera/dev/freud/src/grammar/Css.g:88:1: pseudo : ( ( ':' | '::' ) IDENT -> ^( PSEUDO IDENT ) | ( ':' | '::' ) function -> ^( PSEUDO function ) );
public final CssParser.pseudo_return pseudo() throws RecognitionException {
    CssParser.pseudo_return retval = new CssParser.pseudo_return();
    retval.start = input.LT(1);
    CommonTree root_0 = null;
    Token char_literal40 = null;
    Token string_literal41 = null;
    Token IDENT42 = null;
    Token char_literal43 = null;
    Token string_literal44 = null;
    CssParser.function_return function45 = null;
    CommonTree char_literal40_tree = null;
    CommonTree string_literal41_tree = null;
    CommonTree IDENT42_tree = null;
    CommonTree char_literal43_tree = null;
    CommonTree string_literal44_tree = null;
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleTokenStream stream_39 = new RewriteRuleTokenStream(adaptor, "token 39");
    RewriteRuleTokenStream stream_38 = new RewriteRuleTokenStream(adaptor, "token 38");
    RewriteRuleSubtreeStream stream_function = new RewriteRuleSubtreeStream(adaptor, "rule function");
    try {
        // /home/langera/dev/freud/src/grammar/Css.g:89:2: ( ( ':' | '::' ) IDENT -> ^( PSEUDO IDENT ) | ( ':' | '::' ) function -> ^( PSEUDO function ) )
        int alt20 = 2;
        alt20 = dfa20.predict(input);
        switch(alt20) {
            case 1:
                // /home/langera/dev/freud/src/grammar/Css.g:89:4: ( ':' | '::' ) IDENT
                {
                    // /home/langera/dev/freud/src/grammar/Css.g:89:4: ( ':' | '::' )
                    int alt18 = 2;
                    int LA18_0 = input.LA(1);
                    if ((LA18_0 == 38)) {
                        alt18 = 1;
                    } else if ((LA18_0 == 39)) {
                        alt18 = 2;
                    } else {
                        NoViableAltException nvae = new NoViableAltException("", 18, 0, input);
                        throw nvae;
                    }
                    switch(alt18) {
                        case 1:
                            // /home/langera/dev/freud/src/grammar/Css.g:89:5: ':'
                            {
                                char_literal40 = (Token) match(input, 38, FOLLOW_38_in_pseudo493);
                                stream_38.add(char_literal40);
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/src/grammar/Css.g:89:9: '::'
                            {
                                string_literal41 = (Token) match(input, 39, FOLLOW_39_in_pseudo495);
                                stream_39.add(string_literal41);
                            }
                            break;
                    }
                    IDENT42 = (Token) match(input, IDENT, FOLLOW_IDENT_in_pseudo498);
                    stream_IDENT.add(IDENT42);
                    // AST REWRITE
                    // elements: IDENT
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                    root_0 = (CommonTree) adaptor.nil();
                    // 89:21: -> ^( PSEUDO IDENT )
                    {
                        // /home/langera/dev/freud/src/grammar/Css.g:89:24: ^( PSEUDO IDENT )
                        {
                            CommonTree root_1 = (CommonTree) adaptor.nil();
                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(PSEUDO, "PSEUDO"), root_1);
                            adaptor.addChild(root_1, stream_IDENT.nextNode());
                            adaptor.addChild(root_0, root_1);
                        }
                    }
                    retval.tree = root_0;
                }
                break;
            case 2:
                // /home/langera/dev/freud/src/grammar/Css.g:90:4: ( ':' | '::' ) function
                {
                    // /home/langera/dev/freud/src/grammar/Css.g:90:4: ( ':' | '::' )
                    int alt19 = 2;
                    int LA19_0 = input.LA(1);
                    if ((LA19_0 == 38)) {
                        alt19 = 1;
                    } else if ((LA19_0 == 39)) {
                        alt19 = 2;
                    } else {
                        NoViableAltException nvae = new NoViableAltException("", 19, 0, input);
                        throw nvae;
                    }
                    switch(alt19) {
                        case 1:
                            // /home/langera/dev/freud/src/grammar/Css.g:90:5: ':'
                            {
                                char_literal43 = (Token) match(input, 38, FOLLOW_38_in_pseudo514);
                                stream_38.add(char_literal43);
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/src/grammar/Css.g:90:9: '::'
                            {
                                string_literal44 = (Token) match(input, 39, FOLLOW_39_in_pseudo516);
                                stream_39.add(string_literal44);
                            }
                            break;
                    }
                    pushFollow(FOLLOW_function_in_pseudo519);
                    function45 = function();
                    state._fsp--;
                    stream_function.add(function45.getTree());
                    // AST REWRITE
                    // elements: function
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                    root_0 = (CommonTree) adaptor.nil();
                    // 90:24: -> ^( PSEUDO function )
                    {
                        // /home/langera/dev/freud/src/grammar/Css.g:90:27: ^( PSEUDO function )
                        {
                            CommonTree root_1 = (CommonTree) adaptor.nil();
                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(PSEUDO, "PSEUDO"), root_1);
                            adaptor.addChild(root_1, stream_function.nextTree());
                            adaptor.addChild(root_0, root_1);
                        }
                    }
                    retval.tree = root_0;
                }
                break;
        }
        retval.stop = input.LT(-1);
        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 {
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

RecognitionException (org.antlr.runtime.RecognitionException)98 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)98 CommonTree (org.antlr.runtime.tree.CommonTree)81 Token (org.antlr.runtime.Token)74 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)74 NoViableAltException (org.antlr.runtime.NoViableAltException)24 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)16 CommonToken (org.antlr.runtime.CommonToken)9 ParserRuleReturnScope (org.antlr.runtime.ParserRuleReturnScope)9 EarlyExitException (org.antlr.runtime.EarlyExitException)5 FailedPredicateException (org.antlr.runtime.FailedPredicateException)4 RewriteEmptyStreamException (org.antlr.runtime.tree.RewriteEmptyStreamException)1