Package org.antlr.runtime.tree

Examples of org.antlr.runtime.tree.RewriteRuleTokenStream


        Object root_0 = null;

        Token value=null;

        Object value_tree=null;
        RewriteRuleTokenStream stream_LITERAL=new RewriteRuleTokenStream(adaptor,"token LITERAL");

        try {
            // src/main/resources/org/drools/lang/dsl/DSLMap.g:257:4: ({...}?value= LITERAL -> VT_KEYWORD[$value] )
            // src/main/resources/org/drools/lang/dsl/DSLMap.g:257:4: {...}?value= LITERAL
            {
            if ( !(validateIdentifierKey("keyword")) ) {
                if (backtracking>0) {failed=true; return retval;}
                throw new FailedPredicateException(input, "keyword_key", "validateIdentifierKey(\"keyword\")");
            }
            value=(Token)input.LT(1);
            match(input,LITERAL,FOLLOW_LITERAL_in_keyword_key1305); if (failed) return retval;
            if ( backtracking==0 ) stream_LITERAL.add(value);


            // AST REWRITE
            // elements:
            // token labels:
View Full Code Here


        Object root_0 = null;

        Token value=null;

        Object value_tree=null;
        RewriteRuleTokenStream stream_LITERAL=new RewriteRuleTokenStream(adaptor,"token LITERAL");

        try {
            // src/main/resources/org/drools/lang/dsl/DSLMap.g:262:4: ({...}?value= LITERAL -> VT_ANY[$value] )
            // src/main/resources/org/drools/lang/dsl/DSLMap.g:262:4: {...}?value= LITERAL
            {
            if ( !(validateIdentifierKey("*")) ) {
                if (backtracking>0) {failed=true; return retval;}
                throw new FailedPredicateException(input, "any_key", "validateIdentifierKey(\"*\")");
            }
            value=(Token)input.LT(1);
            match(input,LITERAL,FOLLOW_LITERAL_in_any_key1328); if (failed) return retval;
            if ( backtracking==0 ) stream_LITERAL.add(value);


            // AST REWRITE
            // elements:
            // token labels:
View Full Code Here

        Token IDENT6 = null;

        CommonTree string_literal4_tree = null;
        CommonTree string_literal5_tree = null;
        CommonTree IDENT6_tree = null;
        RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
        RewriteRuleTokenStream stream_26 = new RewriteRuleTokenStream(adaptor, "token 26");
        RewriteRuleTokenStream stream_27 = new RewriteRuleTokenStream(adaptor, "token 27");

        try {
            // /home/langera/dev/freud/src/grammar/Css.g:45:2: ( ( '@import' | '@include' ) IDENT -> ^( IMPORT IDENT ) )
            // /home/langera/dev/freud/src/grammar/Css.g:45:4: ( '@import' | '@include' ) IDENT
            {
                // /home/langera/dev/freud/src/grammar/Css.g:45:4: ( '@import' | '@include' )
                int alt3 = 2;
                int LA3_0 = input.LA(1);

                if ((LA3_0 == 26)) {
                    alt3 = 1;
                }
                else if ((LA3_0 == 27)) {
                    alt3 = 2;
                }
                else {
                    NoViableAltException nvae =
                            new NoViableAltException("", 3, 0, input);

                    throw nvae;
                }
                switch (alt3) {
                    case 1:
                        // /home/langera/dev/freud/src/grammar/Css.g:45:5: '@import'
                    {
                        string_literal4 = (Token) match(input, 26, FOLLOW_26_in_importRule153);
                        stream_26.add(string_literal4);


                    }
                    break;
                    case 2:
                        // /home/langera/dev/freud/src/grammar/Css.g:45:17: '@include'
                    {
                        string_literal5 = (Token) match(input, 27, FOLLOW_27_in_importRule157);
                        stream_27.add(string_literal5);


                    }
                    break;
View Full Code Here


        CommonTree char_literal7_tree = null;
        CommonTree char_literal9_tree = null;
        CommonTree char_literal12_tree = null;
        RewriteRuleTokenStream stream_30 = new RewriteRuleTokenStream(adaptor, "token 30");
        RewriteRuleTokenStream stream_28 = new RewriteRuleTokenStream(adaptor, "token 28");
        RewriteRuleTokenStream stream_29 = new RewriteRuleTokenStream(adaptor, "token 29");
        RewriteRuleSubtreeStream stream_nested = new RewriteRuleSubtreeStream(adaptor, "rule nested");
        RewriteRuleSubtreeStream stream_nest = new RewriteRuleSubtreeStream(adaptor, "rule nest");
        RewriteRuleSubtreeStream stream_properties = new RewriteRuleSubtreeStream(adaptor, "rule properties");
        try {
            // /home/langera/dev/freud/src/grammar/Css.g:49:3: ( '@' nest '{' ( properties )? ( nested )* '}' -> ^( NESTED nest ( properties )* ( nested )* ) )
            // /home/langera/dev/freud/src/grammar/Css.g:49:5: '@' nest '{' ( properties )? ( nested )* '}'
            {
                char_literal7 = (Token) match(input, 28, FOLLOW_28_in_nested183);
                stream_28.add(char_literal7);

                pushFollow(FOLLOW_nest_in_nested185);
                nest8 = nest();

                state._fsp--;

                stream_nest.add(nest8.getTree());
                char_literal9 = (Token) match(input, 29, FOLLOW_29_in_nested187);
                stream_29.add(char_literal9);

                // /home/langera/dev/freud/src/grammar/Css.g:49:18: ( properties )?
                int alt4 = 2;
                int LA4_0 = input.LA(1);

View Full Code Here

        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());

                        }
View Full Code Here

        CssParser.properties_return properties18 = null;


        CommonTree char_literal17_tree = null;
        CommonTree char_literal19_tree = null;
        RewriteRuleTokenStream stream_30 = new RewriteRuleTokenStream(adaptor, "token 30");
        RewriteRuleTokenStream stream_29 = new RewriteRuleTokenStream(adaptor, "token 29");
        RewriteRuleSubtreeStream stream_selectors = new RewriteRuleSubtreeStream(adaptor, "rule selectors");
        RewriteRuleSubtreeStream stream_properties = new RewriteRuleSubtreeStream(adaptor, "rule properties");
        try {
            // /home/langera/dev/freud/src/grammar/Css.g:57:3: ( selectors '{' ( properties )? '}' -> ^( RULE selectors ( properties )* ) )
            // /home/langera/dev/freud/src/grammar/Css.g:57:5: selectors '{' ( properties )? '}'
            {
                pushFollow(FOLLOW_selectors_in_ruleset257);
                selectors16 = selectors();

                state._fsp--;

                stream_selectors.add(selectors16.getTree());
                char_literal17 = (Token) match(input, 29, FOLLOW_29_in_ruleset259);
                stream_29.add(char_literal17);

                // /home/langera/dev/freud/src/grammar/Css.g:57:19: ( properties )?
                int alt8 = 2;
                int LA8_0 = input.LA(1);

View Full Code Here

        Token char_literal29 = null;
        Token char_literal30 = null;

        CommonTree char_literal29_tree = null;
        CommonTree char_literal30_tree = null;
        RewriteRuleTokenStream stream_32 = new RewriteRuleTokenStream(adaptor, "token 32");
        RewriteRuleTokenStream stream_33 = new RewriteRuleTokenStream(adaptor, "token 33");

        try {
            // /home/langera/dev/freud/src/grammar/Css.g:73:2: ( '>' -> CHILD | '+' -> ADJACENT_SIBLING )
            int alt14 = 2;
            int LA14_0 = input.LA(1);

            if ((LA14_0 == 32)) {
                alt14 = 1;
            }
            else if ((LA14_0 == 33)) {
                alt14 = 2;
            }
            else {
                NoViableAltException nvae =
                        new NoViableAltException("", 14, 0, input);

                throw nvae;
            }
            switch (alt14) {
                case 1:
                    // /home/langera/dev/freud/src/grammar/Css.g:73:4: '>'
                {
                    char_literal29 = (Token) match(input, 32, FOLLOW_32_in_selectop363);
                    stream_32.add(char_literal29);


                    // AST REWRITE
                    // elements:
                    // 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();
                    // 73:8: -> CHILD
                    {
                        adaptor.addChild(root_0, (CommonTree) adaptor.create(CHILD, "CHILD"));

                    }

                    retval.tree = root_0;
                }
                break;
                case 2:
                    // /home/langera/dev/freud/src/grammar/Css.g:74:11: '+'
                {
                    char_literal30 = (Token) match(input, 33, FOLLOW_33_in_selectop379);
                    stream_33.add(char_literal30);


                    // AST REWRITE
                    // elements:
                    // token labels:
View Full Code Here

        CssParser.declaration_return declaration33 = null;


        CommonTree char_literal32_tree = null;
        RewriteRuleTokenStream stream_34 = new RewriteRuleTokenStream(adaptor, "token 34");
        RewriteRuleSubtreeStream stream_declaration = new RewriteRuleSubtreeStream(adaptor, "rule declaration");
        try {
            // /home/langera/dev/freud/src/grammar/Css.g:78:2: ( declaration ( ';' ( declaration )? )* -> ( declaration )+ )
            // /home/langera/dev/freud/src/grammar/Css.g:78:4: declaration ( ';' ( declaration )? )*
            {
                pushFollow(FOLLOW_declaration_in_properties395);
                declaration31 = declaration();

                state._fsp--;

                stream_declaration.add(declaration31.getTree());
                // /home/langera/dev/freud/src/grammar/Css.g:78:16: ( ';' ( declaration )? )*
                loop16:
                do {
                    int alt16 = 2;
                    int LA16_0 = input.LA(1);

                    if ((LA16_0 == 34)) {
                        alt16 = 1;
                    }


                    switch (alt16) {
                        case 1:
                            // /home/langera/dev/freud/src/grammar/Css.g:78:17: ';' ( declaration )?
                        {
                            char_literal32 = (Token) match(input, 34, FOLLOW_34_in_properties398);
                            stream_34.add(char_literal32);

                            // /home/langera/dev/freud/src/grammar/Css.g:78:21: ( declaration )?
                            int alt15 = 2;
                            int LA15_0 = input.LA(1);

View Full Code Here

        CommonTree char_literal35_tree = null;
        CommonTree IDENT36_tree = null;
        CommonTree char_literal37_tree = null;
        CommonTree IDENT38_tree = null;
        CommonTree IDENT39_tree = null;
        RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
        RewriteRuleTokenStream stream_35 = new RewriteRuleTokenStream(adaptor, "token 35");
        RewriteRuleTokenStream stream_36 = new RewriteRuleTokenStream(adaptor, "token 36");
        RewriteRuleTokenStream stream_37 = new RewriteRuleTokenStream(adaptor, "token 37");

        try {
            // /home/langera/dev/freud/src/grammar/Css.g:82:2: ( '*' -> ^( UNIVERSAL ) | '#' IDENT -> ^( ID IDENT ) | '.' IDENT -> ^( CLASS IDENT ) | IDENT -> ^( TAG IDENT ) )
            int alt17 = 4;
            switch (input.LA(1)) {
                case 35: {
                    alt17 = 1;
                }
                break;
                case 36: {
                    alt17 = 2;
                }
                break;
                case 37: {
                    alt17 = 3;
                }
                break;
                case IDENT: {
                    alt17 = 4;
                }
                break;
                default:
                    NoViableAltException nvae =
                            new NoViableAltException("", 17, 0, input);

                    throw nvae;
            }

            switch (alt17) {
                case 1:
                    // /home/langera/dev/freud/src/grammar/Css.g:82:4: '*'
                {
                    char_literal34 = (Token) match(input, 35, FOLLOW_35_in_elem421);
                    stream_35.add(char_literal34);


                    // AST REWRITE
                    // elements:
                    // 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();
                    // 82:8: -> ^( UNIVERSAL )
                    {
                        // /home/langera/dev/freud/src/grammar/Css.g:82:11: ^( UNIVERSAL )
                        {
                            CommonTree root_1 = (CommonTree) adaptor.nil();
                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(UNIVERSAL, "UNIVERSAL"), root_1);

                            adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;
                }
                break;
                case 2:
                    // /home/langera/dev/freud/src/grammar/Css.g:83:4: '#' IDENT
                {
                    char_literal35 = (Token) match(input, 36, FOLLOW_36_in_elem434);
                    stream_36.add(char_literal35);

                    IDENT36 = (Token) match(input, IDENT, FOLLOW_IDENT_in_elem436);
                    stream_IDENT.add(IDENT36);


                    // 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();
                    // 83:14: -> ^( ID IDENT )
                    {
                        // /home/langera/dev/freud/src/grammar/Css.g:83:17: ^( ID IDENT )
                        {
                            CommonTree root_1 = (CommonTree) adaptor.nil();
                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ID, "ID"), root_1);

                            adaptor.addChild(root_1, stream_IDENT.nextNode());

                            adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;
                }
                break;
                case 3:
                    // /home/langera/dev/freud/src/grammar/Css.g:84:4: '.' IDENT
                {
                    char_literal37 = (Token) match(input, 37, FOLLOW_37_in_elem451);
                    stream_37.add(char_literal37);

                    IDENT38 = (Token) match(input, IDENT, FOLLOW_IDENT_in_elem453);
                    stream_IDENT.add(IDENT38);


View Full Code Here

        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:
View Full Code Here

TOP

Related Classes of org.antlr.runtime.tree.RewriteRuleTokenStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.