All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.antlr.grammar.v3.ANTLRv3Tree Maven / Gradle / Ivy

There is a newer version: 8.1.2
Show newest version
// $ANTLR 3.2 Sep 23, 2009 14:05:07 org/antlr/grammar/v3/ANTLRv3Tree.g 2010-11-29 17:55:06

package org.antlr.grammar.v3;


import org.antlr.runtime.*;
import org.antlr.runtime.tree.*;import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

/** ANTLR v3 tree grammar to walk trees created by ANTLRv3.g */
public class ANTLRv3Tree extends TreeParser {
    public static final String[] tokenNames = new String[] {
        "", "", "", "", "DOC_COMMENT", "PARSER", "LEXER", "RULE", "BLOCK", "OPTIONAL", "CLOSURE", "POSITIVE_CLOSURE", "SYNPRED", "RANGE", "CHAR_RANGE", "EPSILON", "ALT", "EOR", "EOB", "EOA", "ID", "ARG", "ARGLIST", "RET", "LEXER_GRAMMAR", "PARSER_GRAMMAR", "TREE_GRAMMAR", "COMBINED_GRAMMAR", "LABEL", "TEMPLATE", "SCOPE", "SEMPRED", "GATED_SEMPRED", "SYN_SEMPRED", "BACKTRACK_SEMPRED", "FRAGMENT", "TREE_BEGIN", "ROOT", "BANG", "REWRITE", "AT", "LABEL_ASSIGN", "LIST_LABEL_ASSIGN", "TOKENS", "TOKEN_REF", "STRING_LITERAL", "CHAR_LITERAL", "ACTION", "OPTIONS", "INT", "ARG_ACTION", "RULE_REF", "DOUBLE_QUOTE_STRING_LITERAL", "DOUBLE_ANGLE_STRING_LITERAL", "SRC", "SL_COMMENT", "ML_COMMENT", "LITERAL_CHAR", "ESC", "XDIGIT", "NESTED_ARG_ACTION", "ACTION_STRING_LITERAL", "ACTION_CHAR_LITERAL", "NESTED_ACTION", "ACTION_ESC", "WS_LOOP", "WS", "'lexer'", "'parser'", "'tree'", "'grammar'", "';'", "'}'", "'::'", "'*'", "'protected'", "'public'", "'private'", "':'", "'throws'", "','", "'('", "'|'", "')'", "'catch'", "'finally'", "'=>'", "'~'", "'<'", "'>'", "'.'", "'?'", "'+'", "'$'"
    };
    public static final int BACKTRACK_SEMPRED=34;
    public static final int DOUBLE_ANGLE_STRING_LITERAL=53;
    public static final int LEXER_GRAMMAR=24;
    public static final int EOA=19;
    public static final int ARGLIST=22;
    public static final int EOF=-1;
    public static final int SEMPRED=31;
    public static final int ACTION=47;
    public static final int EOB=18;
    public static final int TOKEN_REF=44;
    public static final int T__93=93;
    public static final int T__91=91;
    public static final int RET=23;
    public static final int T__92=92;
    public static final int STRING_LITERAL=45;
    public static final int T__90=90;
    public static final int ARG=21;
    public static final int EOR=17;
    public static final int ARG_ACTION=50;
    public static final int DOUBLE_QUOTE_STRING_LITERAL=52;
    public static final int NESTED_ARG_ACTION=60;
    public static final int ACTION_CHAR_LITERAL=62;
    public static final int T__80=80;
    public static final int T__81=81;
    public static final int T__82=82;
    public static final int RULE=7;
    public static final int ACTION_ESC=64;
    public static final int T__83=83;
    public static final int PARSER_GRAMMAR=25;
    public static final int SRC=54;
    public static final int INT=49;
    public static final int CHAR_RANGE=14;
    public static final int EPSILON=15;
    public static final int T__85=85;
    public static final int T__84=84;
    public static final int T__87=87;
    public static final int T__86=86;
    public static final int REWRITE=39;
    public static final int T__89=89;
    public static final int T__88=88;
    public static final int WS=66;
    public static final int T__71=71;
    public static final int T__72=72;
    public static final int COMBINED_GRAMMAR=27;
    public static final int T__70=70;
    public static final int LEXER=6;
    public static final int SL_COMMENT=55;
    public static final int TREE_GRAMMAR=26;
    public static final int T__76=76;
    public static final int CLOSURE=10;
    public static final int T__75=75;
    public static final int PARSER=5;
    public static final int T__74=74;
    public static final int T__73=73;
    public static final int T__79=79;
    public static final int T__78=78;
    public static final int T__77=77;
    public static final int T__68=68;
    public static final int T__69=69;
    public static final int T__67=67;
    public static final int NESTED_ACTION=63;
    public static final int ESC=58;
    public static final int FRAGMENT=35;
    public static final int ID=20;
    public static final int TREE_BEGIN=36;
    public static final int AT=40;
    public static final int ML_COMMENT=56;
    public static final int ALT=16;
    public static final int SCOPE=30;
    public static final int LABEL_ASSIGN=41;
    public static final int DOC_COMMENT=4;
    public static final int WS_LOOP=65;
    public static final int RANGE=13;
    public static final int TOKENS=43;
    public static final int GATED_SEMPRED=32;
    public static final int LITERAL_CHAR=57;
    public static final int BANG=38;
    public static final int LIST_LABEL_ASSIGN=42;
    public static final int ACTION_STRING_LITERAL=61;
    public static final int ROOT=37;
    public static final int RULE_REF=51;
    public static final int SYNPRED=12;
    public static final int OPTIONAL=9;
    public static final int CHAR_LITERAL=46;
    public static final int LABEL=28;
    public static final int TEMPLATE=29;
    public static final int SYN_SEMPRED=33;
    public static final int XDIGIT=59;
    public static final int BLOCK=8;
    public static final int POSITIVE_CLOSURE=11;
    public static final int OPTIONS=48;

    // delegates
    // delegators


        public ANTLRv3Tree(TreeNodeStream input) {
            this(input, new RecognizerSharedState());
        }
        public ANTLRv3Tree(TreeNodeStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        

    public String[] getTokenNames() { return ANTLRv3Tree.tokenNames; }
    public String getGrammarFileName() { return "org/antlr/grammar/v3/ANTLRv3Tree.g"; }



    // $ANTLR start "grammarDef"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:41:1: grammarDef : ^( grammarType ID ( DOC_COMMENT )? ( optionsSpec )? ( tokensSpec )? ( attrScope )* ( action )* ( rule )+ ) ;
    public final void grammarDef() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:42:5: ( ^( grammarType ID ( DOC_COMMENT )? ( optionsSpec )? ( tokensSpec )? ( attrScope )* ( action )* ( rule )+ ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:42:9: ^( grammarType ID ( DOC_COMMENT )? ( optionsSpec )? ( tokensSpec )? ( attrScope )* ( action )* ( rule )+ )
            {
            pushFollow(FOLLOW_grammarType_in_grammarDef52);
            grammarType();

            state._fsp--;


            match(input, Token.DOWN, null); 
            match(input,ID,FOLLOW_ID_in_grammarDef54); 
            // org/antlr/grammar/v3/ANTLRv3Tree.g:42:27: ( DOC_COMMENT )?
            int alt1=2;
            switch ( input.LA(1) ) {
                case DOC_COMMENT:
                    {
                    alt1=1;
                    }
                    break;
            }

            switch (alt1) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:42:27: DOC_COMMENT
                    {
                    match(input,DOC_COMMENT,FOLLOW_DOC_COMMENT_in_grammarDef56); 

                    }
                    break;

            }

            // org/antlr/grammar/v3/ANTLRv3Tree.g:42:40: ( optionsSpec )?
            int alt2=2;
            switch ( input.LA(1) ) {
                case OPTIONS:
                    {
                    alt2=1;
                    }
                    break;
            }

            switch (alt2) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:42:40: optionsSpec
                    {
                    pushFollow(FOLLOW_optionsSpec_in_grammarDef59);
                    optionsSpec();

                    state._fsp--;


                    }
                    break;

            }

            // org/antlr/grammar/v3/ANTLRv3Tree.g:42:53: ( tokensSpec )?
            int alt3=2;
            switch ( input.LA(1) ) {
                case TOKENS:
                    {
                    alt3=1;
                    }
                    break;
            }

            switch (alt3) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:42:53: tokensSpec
                    {
                    pushFollow(FOLLOW_tokensSpec_in_grammarDef62);
                    tokensSpec();

                    state._fsp--;


                    }
                    break;

            }

            // org/antlr/grammar/v3/ANTLRv3Tree.g:42:65: ( attrScope )*
            loop4:
            do {
                int alt4=2;
                switch ( input.LA(1) ) {
                case SCOPE:
                    {
                    alt4=1;
                    }
                    break;

                }

                switch (alt4) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:42:65: attrScope
            	    {
            	    pushFollow(FOLLOW_attrScope_in_grammarDef65);
            	    attrScope();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    break loop4;
                }
            } while (true);

            // org/antlr/grammar/v3/ANTLRv3Tree.g:42:76: ( action )*
            loop5:
            do {
                int alt5=2;
                switch ( input.LA(1) ) {
                case AT:
                    {
                    alt5=1;
                    }
                    break;

                }

                switch (alt5) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:42:76: action
            	    {
            	    pushFollow(FOLLOW_action_in_grammarDef68);
            	    action();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    break loop5;
                }
            } while (true);

            // org/antlr/grammar/v3/ANTLRv3Tree.g:42:84: ( rule )+
            int cnt6=0;
            loop6:
            do {
                int alt6=2;
                switch ( input.LA(1) ) {
                case RULE:
                    {
                    alt6=1;
                    }
                    break;

                }

                switch (alt6) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:42:84: rule
            	    {
            	    pushFollow(FOLLOW_rule_in_grammarDef71);
            	    rule();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    if ( cnt6 >= 1 ) break loop6;
                        EarlyExitException eee =
                            new EarlyExitException(6, input);
                        throw eee;
                }
                cnt6++;
            } while (true);


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "grammarDef"


    // $ANTLR start "grammarType"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:45:1: grammarType : ( LEXER_GRAMMAR | PARSER_GRAMMAR | TREE_GRAMMAR | COMBINED_GRAMMAR );
    public final void grammarType() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:46:2: ( LEXER_GRAMMAR | PARSER_GRAMMAR | TREE_GRAMMAR | COMBINED_GRAMMAR )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:
            {
            if ( (input.LA(1)>=LEXER_GRAMMAR && input.LA(1)<=COMBINED_GRAMMAR) ) {
                input.consume();
                state.errorRecovery=false;
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "grammarType"


    // $ANTLR start "tokensSpec"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:52:1: tokensSpec : ^( TOKENS ( tokenSpec )+ ) ;
    public final void tokensSpec() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:53:2: ( ^( TOKENS ( tokenSpec )+ ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:53:4: ^( TOKENS ( tokenSpec )+ )
            {
            match(input,TOKENS,FOLLOW_TOKENS_in_tokensSpec127); 

            match(input, Token.DOWN, null); 
            // org/antlr/grammar/v3/ANTLRv3Tree.g:53:13: ( tokenSpec )+
            int cnt7=0;
            loop7:
            do {
                int alt7=2;
                switch ( input.LA(1) ) {
                case LABEL_ASSIGN:
                case TOKEN_REF:
                    {
                    alt7=1;
                    }
                    break;

                }

                switch (alt7) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:53:13: tokenSpec
            	    {
            	    pushFollow(FOLLOW_tokenSpec_in_tokensSpec129);
            	    tokenSpec();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    if ( cnt7 >= 1 ) break loop7;
                        EarlyExitException eee =
                            new EarlyExitException(7, input);
                        throw eee;
                }
                cnt7++;
            } while (true);


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "tokensSpec"


    // $ANTLR start "tokenSpec"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:56:1: tokenSpec : ( ^( '=' TOKEN_REF STRING_LITERAL ) | ^( '=' TOKEN_REF CHAR_LITERAL ) | TOKEN_REF );
    public final void tokenSpec() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:57:2: ( ^( '=' TOKEN_REF STRING_LITERAL ) | ^( '=' TOKEN_REF CHAR_LITERAL ) | TOKEN_REF )
            int alt8=3;
            switch ( input.LA(1) ) {
            case LABEL_ASSIGN:
                {
                switch ( input.LA(2) ) {
                case DOWN:
                    {
                    switch ( input.LA(3) ) {
                    case TOKEN_REF:
                        {
                        switch ( input.LA(4) ) {
                        case STRING_LITERAL:
                            {
                            alt8=1;
                            }
                            break;
                        case CHAR_LITERAL:
                            {
                            alt8=2;
                            }
                            break;
                        default:
                            NoViableAltException nvae =
                                new NoViableAltException("", 8, 4, input);

                            throw nvae;
                        }

                        }
                        break;
                    default:
                        NoViableAltException nvae =
                            new NoViableAltException("", 8, 3, input);

                        throw nvae;
                    }

                    }
                    break;
                default:
                    NoViableAltException nvae =
                        new NoViableAltException("", 8, 1, input);

                    throw nvae;
                }

                }
                break;
            case TOKEN_REF:
                {
                alt8=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 8, 0, input);

                throw nvae;
            }

            switch (alt8) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:57:4: ^( '=' TOKEN_REF STRING_LITERAL )
                    {
                    match(input,LABEL_ASSIGN,FOLLOW_LABEL_ASSIGN_in_tokenSpec143); 

                    match(input, Token.DOWN, null); 
                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenSpec145); 
                    match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_tokenSpec147); 

                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:58:4: ^( '=' TOKEN_REF CHAR_LITERAL )
                    {
                    match(input,LABEL_ASSIGN,FOLLOW_LABEL_ASSIGN_in_tokenSpec154); 

                    match(input, Token.DOWN, null); 
                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenSpec156); 
                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_tokenSpec158); 

                    match(input, Token.UP, null); 

                    }
                    break;
                case 3 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:59:4: TOKEN_REF
                    {
                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenSpec164); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "tokenSpec"


    // $ANTLR start "attrScope"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:62:1: attrScope : ^( 'scope' ID ACTION ) ;
    public final void attrScope() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:63:2: ( ^( 'scope' ID ACTION ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:63:4: ^( 'scope' ID ACTION )
            {
            match(input,SCOPE,FOLLOW_SCOPE_in_attrScope176); 

            match(input, Token.DOWN, null); 
            match(input,ID,FOLLOW_ID_in_attrScope178); 
            match(input,ACTION,FOLLOW_ACTION_in_attrScope180); 

            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "attrScope"


    // $ANTLR start "action"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:66:1: action : ( ^( '@' ID ID ACTION ) | ^( '@' ID ACTION ) );
    public final void action() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:67:2: ( ^( '@' ID ID ACTION ) | ^( '@' ID ACTION ) )
            int alt9=2;
            switch ( input.LA(1) ) {
            case AT:
                {
                switch ( input.LA(2) ) {
                case DOWN:
                    {
                    switch ( input.LA(3) ) {
                    case ID:
                        {
                        switch ( input.LA(4) ) {
                        case ID:
                            {
                            alt9=1;
                            }
                            break;
                        case ACTION:
                            {
                            alt9=2;
                            }
                            break;
                        default:
                            NoViableAltException nvae =
                                new NoViableAltException("", 9, 3, input);

                            throw nvae;
                        }

                        }
                        break;
                    default:
                        NoViableAltException nvae =
                            new NoViableAltException("", 9, 2, input);

                        throw nvae;
                    }

                    }
                    break;
                default:
                    NoViableAltException nvae =
                        new NoViableAltException("", 9, 1, input);

                    throw nvae;
                }

                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 9, 0, input);

                throw nvae;
            }

            switch (alt9) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:67:4: ^( '@' ID ID ACTION )
                    {
                    match(input,AT,FOLLOW_AT_in_action193); 

                    match(input, Token.DOWN, null); 
                    match(input,ID,FOLLOW_ID_in_action195); 
                    match(input,ID,FOLLOW_ID_in_action197); 
                    match(input,ACTION,FOLLOW_ACTION_in_action199); 

                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:68:4: ^( '@' ID ACTION )
                    {
                    match(input,AT,FOLLOW_AT_in_action206); 

                    match(input, Token.DOWN, null); 
                    match(input,ID,FOLLOW_ID_in_action208); 
                    match(input,ACTION,FOLLOW_ACTION_in_action210); 

                    match(input, Token.UP, null); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "action"


    // $ANTLR start "optionsSpec"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:71:1: optionsSpec : ^( OPTIONS ( option )+ ) ;
    public final void optionsSpec() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:72:2: ( ^( OPTIONS ( option )+ ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:72:4: ^( OPTIONS ( option )+ )
            {
            match(input,OPTIONS,FOLLOW_OPTIONS_in_optionsSpec223); 

            match(input, Token.DOWN, null); 
            // org/antlr/grammar/v3/ANTLRv3Tree.g:72:14: ( option )+
            int cnt10=0;
            loop10:
            do {
                int alt10=2;
                switch ( input.LA(1) ) {
                case ID:
                case LABEL_ASSIGN:
                    {
                    alt10=1;
                    }
                    break;

                }

                switch (alt10) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:72:14: option
            	    {
            	    pushFollow(FOLLOW_option_in_optionsSpec225);
            	    option();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    if ( cnt10 >= 1 ) break loop10;
                        EarlyExitException eee =
                            new EarlyExitException(10, input);
                        throw eee;
                }
                cnt10++;
            } while (true);


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "optionsSpec"


    // $ANTLR start "option"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:75:1: option : ( qid | ^( '=' ID optionValue ) );
    public final void option() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:76:5: ( qid | ^( '=' ID optionValue ) )
            int alt11=2;
            switch ( input.LA(1) ) {
            case ID:
                {
                alt11=1;
                }
                break;
            case LABEL_ASSIGN:
                {
                alt11=2;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 11, 0, input);

                throw nvae;
            }

            switch (alt11) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:76:9: qid
                    {
                    pushFollow(FOLLOW_qid_in_option243);
                    qid();

                    state._fsp--;


                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:77:7: ^( '=' ID optionValue )
                    {
                    match(input,LABEL_ASSIGN,FOLLOW_LABEL_ASSIGN_in_option253); 

                    match(input, Token.DOWN, null); 
                    match(input,ID,FOLLOW_ID_in_option255); 
                    pushFollow(FOLLOW_optionValue_in_option257);
                    optionValue();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "option"


    // $ANTLR start "optionValue"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:80:1: optionValue : ( ID | STRING_LITERAL | CHAR_LITERAL | INT );
    public final void optionValue() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:81:5: ( ID | STRING_LITERAL | CHAR_LITERAL | INT )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:
            {
            if ( input.LA(1)==ID||(input.LA(1)>=STRING_LITERAL && input.LA(1)<=CHAR_LITERAL)||input.LA(1)==INT ) {
                input.consume();
                state.errorRecovery=false;
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "optionValue"


    // $ANTLR start "rule"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:87:1: rule : ^( RULE ID ( modifier )? ( ^( ARG ARG_ACTION ) )? ( ^( RET ARG_ACTION ) )? ( throwsSpec )? ( optionsSpec )? ( ruleScopeSpec )? ( ruleAction )* altList ( exceptionGroup )? EOR ) ;
    public final void rule() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:88:2: ( ^( RULE ID ( modifier )? ( ^( ARG ARG_ACTION ) )? ( ^( RET ARG_ACTION ) )? ( throwsSpec )? ( optionsSpec )? ( ruleScopeSpec )? ( ruleAction )* altList ( exceptionGroup )? EOR ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:88:4: ^( RULE ID ( modifier )? ( ^( ARG ARG_ACTION ) )? ( ^( RET ARG_ACTION ) )? ( throwsSpec )? ( optionsSpec )? ( ruleScopeSpec )? ( ruleAction )* altList ( exceptionGroup )? EOR )
            {
            match(input,RULE,FOLLOW_RULE_in_rule323); 

            match(input, Token.DOWN, null); 
            match(input,ID,FOLLOW_ID_in_rule325); 
            // org/antlr/grammar/v3/ANTLRv3Tree.g:88:15: ( modifier )?
            int alt12=2;
            switch ( input.LA(1) ) {
                case FRAGMENT:
                case 75:
                case 76:
                case 77:
                    {
                    alt12=1;
                    }
                    break;
            }

            switch (alt12) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:88:15: modifier
                    {
                    pushFollow(FOLLOW_modifier_in_rule327);
                    modifier();

                    state._fsp--;


                    }
                    break;

            }

            // org/antlr/grammar/v3/ANTLRv3Tree.g:88:25: ( ^( ARG ARG_ACTION ) )?
            int alt13=2;
            switch ( input.LA(1) ) {
                case ARG:
                    {
                    alt13=1;
                    }
                    break;
            }

            switch (alt13) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:88:26: ^( ARG ARG_ACTION )
                    {
                    match(input,ARG,FOLLOW_ARG_in_rule332); 

                    match(input, Token.DOWN, null); 
                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rule334); 

                    match(input, Token.UP, null); 

                    }
                    break;

            }

            // org/antlr/grammar/v3/ANTLRv3Tree.g:88:46: ( ^( RET ARG_ACTION ) )?
            int alt14=2;
            switch ( input.LA(1) ) {
                case RET:
                    {
                    alt14=1;
                    }
                    break;
            }

            switch (alt14) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:88:47: ^( RET ARG_ACTION )
                    {
                    match(input,RET,FOLLOW_RET_in_rule341); 

                    match(input, Token.DOWN, null); 
                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rule343); 

                    match(input, Token.UP, null); 

                    }
                    break;

            }

            // org/antlr/grammar/v3/ANTLRv3Tree.g:89:9: ( throwsSpec )?
            int alt15=2;
            switch ( input.LA(1) ) {
                case 79:
                    {
                    alt15=1;
                    }
                    break;
            }

            switch (alt15) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:89:9: throwsSpec
                    {
                    pushFollow(FOLLOW_throwsSpec_in_rule356);
                    throwsSpec();

                    state._fsp--;


                    }
                    break;

            }

            // org/antlr/grammar/v3/ANTLRv3Tree.g:89:21: ( optionsSpec )?
            int alt16=2;
            switch ( input.LA(1) ) {
                case OPTIONS:
                    {
                    alt16=1;
                    }
                    break;
            }

            switch (alt16) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:89:21: optionsSpec
                    {
                    pushFollow(FOLLOW_optionsSpec_in_rule359);
                    optionsSpec();

                    state._fsp--;


                    }
                    break;

            }

            // org/antlr/grammar/v3/ANTLRv3Tree.g:89:34: ( ruleScopeSpec )?
            int alt17=2;
            switch ( input.LA(1) ) {
                case SCOPE:
                    {
                    alt17=1;
                    }
                    break;
            }

            switch (alt17) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:89:34: ruleScopeSpec
                    {
                    pushFollow(FOLLOW_ruleScopeSpec_in_rule362);
                    ruleScopeSpec();

                    state._fsp--;


                    }
                    break;

            }

            // org/antlr/grammar/v3/ANTLRv3Tree.g:89:49: ( ruleAction )*
            loop18:
            do {
                int alt18=2;
                switch ( input.LA(1) ) {
                case AT:
                    {
                    alt18=1;
                    }
                    break;

                }

                switch (alt18) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:89:49: ruleAction
            	    {
            	    pushFollow(FOLLOW_ruleAction_in_rule365);
            	    ruleAction();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    break loop18;
                }
            } while (true);

            pushFollow(FOLLOW_altList_in_rule376);
            altList();

            state._fsp--;

            // org/antlr/grammar/v3/ANTLRv3Tree.g:91:9: ( exceptionGroup )?
            int alt19=2;
            switch ( input.LA(1) ) {
                case 84:
                case 85:
                    {
                    alt19=1;
                    }
                    break;
            }

            switch (alt19) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:91:9: exceptionGroup
                    {
                    pushFollow(FOLLOW_exceptionGroup_in_rule386);
                    exceptionGroup();

                    state._fsp--;


                    }
                    break;

            }

            match(input,EOR,FOLLOW_EOR_in_rule389); 

            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rule"


    // $ANTLR start "modifier"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:95:1: modifier : ( 'protected' | 'public' | 'private' | 'fragment' );
    public final void modifier() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:96:2: ( 'protected' | 'public' | 'private' | 'fragment' )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:
            {
            if ( input.LA(1)==FRAGMENT||(input.LA(1)>=75 && input.LA(1)<=77) ) {
                input.consume();
                state.errorRecovery=false;
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "modifier"


    // $ANTLR start "ruleAction"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:99:1: ruleAction : ^( '@' ID ACTION ) ;
    public final void ruleAction() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:101:2: ( ^( '@' ID ACTION ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:101:4: ^( '@' ID ACTION )
            {
            match(input,AT,FOLLOW_AT_in_ruleAction428); 

            match(input, Token.DOWN, null); 
            match(input,ID,FOLLOW_ID_in_ruleAction430); 
            match(input,ACTION,FOLLOW_ACTION_in_ruleAction432); 

            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "ruleAction"


    // $ANTLR start "throwsSpec"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:104:1: throwsSpec : ^( 'throws' ( ID )+ ) ;
    public final void throwsSpec() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:105:2: ( ^( 'throws' ( ID )+ ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:105:4: ^( 'throws' ( ID )+ )
            {
            match(input,79,FOLLOW_79_in_throwsSpec445); 

            match(input, Token.DOWN, null); 
            // org/antlr/grammar/v3/ANTLRv3Tree.g:105:15: ( ID )+
            int cnt20=0;
            loop20:
            do {
                int alt20=2;
                switch ( input.LA(1) ) {
                case ID:
                    {
                    alt20=1;
                    }
                    break;

                }

                switch (alt20) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:105:15: ID
            	    {
            	    match(input,ID,FOLLOW_ID_in_throwsSpec447); 

            	    }
            	    break;

            	default :
            	    if ( cnt20 >= 1 ) break loop20;
                        EarlyExitException eee =
                            new EarlyExitException(20, input);
                        throw eee;
                }
                cnt20++;
            } while (true);


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "throwsSpec"


    // $ANTLR start "ruleScopeSpec"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:108:1: ruleScopeSpec : ( ^( 'scope' ACTION ) | ^( 'scope' ACTION ( ID )+ ) | ^( 'scope' ( ID )+ ) );
    public final void ruleScopeSpec() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:109:2: ( ^( 'scope' ACTION ) | ^( 'scope' ACTION ( ID )+ ) | ^( 'scope' ( ID )+ ) )
            int alt23=3;
            switch ( input.LA(1) ) {
            case SCOPE:
                {
                switch ( input.LA(2) ) {
                case DOWN:
                    {
                    switch ( input.LA(3) ) {
                    case ACTION:
                        {
                        switch ( input.LA(4) ) {
                        case UP:
                            {
                            alt23=1;
                            }
                            break;
                        case ID:
                            {
                            alt23=2;
                            }
                            break;
                        default:
                            NoViableAltException nvae =
                                new NoViableAltException("", 23, 3, input);

                            throw nvae;
                        }

                        }
                        break;
                    case ID:
                        {
                        alt23=3;
                        }
                        break;
                    default:
                        NoViableAltException nvae =
                            new NoViableAltException("", 23, 2, input);

                        throw nvae;
                    }

                    }
                    break;
                default:
                    NoViableAltException nvae =
                        new NoViableAltException("", 23, 1, input);

                    throw nvae;
                }

                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 23, 0, input);

                throw nvae;
            }

            switch (alt23) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:109:4: ^( 'scope' ACTION )
                    {
                    match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec461); 

                    match(input, Token.DOWN, null); 
                    match(input,ACTION,FOLLOW_ACTION_in_ruleScopeSpec463); 

                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:110:4: ^( 'scope' ACTION ( ID )+ )
                    {
                    match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec470); 

                    match(input, Token.DOWN, null); 
                    match(input,ACTION,FOLLOW_ACTION_in_ruleScopeSpec472); 
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:110:21: ( ID )+
                    int cnt21=0;
                    loop21:
                    do {
                        int alt21=2;
                        switch ( input.LA(1) ) {
                        case ID:
                            {
                            alt21=1;
                            }
                            break;

                        }

                        switch (alt21) {
                    	case 1 :
                    	    // org/antlr/grammar/v3/ANTLRv3Tree.g:110:21: ID
                    	    {
                    	    match(input,ID,FOLLOW_ID_in_ruleScopeSpec474); 

                    	    }
                    	    break;

                    	default :
                    	    if ( cnt21 >= 1 ) break loop21;
                                EarlyExitException eee =
                                    new EarlyExitException(21, input);
                                throw eee;
                        }
                        cnt21++;
                    } while (true);


                    match(input, Token.UP, null); 

                    }
                    break;
                case 3 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:111:4: ^( 'scope' ( ID )+ )
                    {
                    match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec482); 

                    match(input, Token.DOWN, null); 
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:111:14: ( ID )+
                    int cnt22=0;
                    loop22:
                    do {
                        int alt22=2;
                        switch ( input.LA(1) ) {
                        case ID:
                            {
                            alt22=1;
                            }
                            break;

                        }

                        switch (alt22) {
                    	case 1 :
                    	    // org/antlr/grammar/v3/ANTLRv3Tree.g:111:14: ID
                    	    {
                    	    match(input,ID,FOLLOW_ID_in_ruleScopeSpec484); 

                    	    }
                    	    break;

                    	default :
                    	    if ( cnt22 >= 1 ) break loop22;
                                EarlyExitException eee =
                                    new EarlyExitException(22, input);
                                throw eee;
                        }
                        cnt22++;
                    } while (true);


                    match(input, Token.UP, null); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "ruleScopeSpec"


    // $ANTLR start "block"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:114:1: block : ^( BLOCK ( optionsSpec )? ( alternative rewrite )+ EOB ) ;
    public final void block() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:115:5: ( ^( BLOCK ( optionsSpec )? ( alternative rewrite )+ EOB ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:115:9: ^( BLOCK ( optionsSpec )? ( alternative rewrite )+ EOB )
            {
            match(input,BLOCK,FOLLOW_BLOCK_in_block504); 

            match(input, Token.DOWN, null); 
            // org/antlr/grammar/v3/ANTLRv3Tree.g:115:18: ( optionsSpec )?
            int alt24=2;
            switch ( input.LA(1) ) {
                case OPTIONS:
                    {
                    alt24=1;
                    }
                    break;
            }

            switch (alt24) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:115:18: optionsSpec
                    {
                    pushFollow(FOLLOW_optionsSpec_in_block506);
                    optionsSpec();

                    state._fsp--;


                    }
                    break;

            }

            // org/antlr/grammar/v3/ANTLRv3Tree.g:115:31: ( alternative rewrite )+
            int cnt25=0;
            loop25:
            do {
                int alt25=2;
                switch ( input.LA(1) ) {
                case ALT:
                    {
                    alt25=1;
                    }
                    break;

                }

                switch (alt25) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:115:32: alternative rewrite
            	    {
            	    pushFollow(FOLLOW_alternative_in_block510);
            	    alternative();

            	    state._fsp--;

            	    pushFollow(FOLLOW_rewrite_in_block512);
            	    rewrite();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    if ( cnt25 >= 1 ) break loop25;
                        EarlyExitException eee =
                            new EarlyExitException(25, input);
                        throw eee;
                }
                cnt25++;
            } while (true);

            match(input,EOB,FOLLOW_EOB_in_block516); 

            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "block"


    // $ANTLR start "altList"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:118:1: altList : ^( BLOCK ( alternative rewrite )+ EOB ) ;
    public final void altList() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:119:5: ( ^( BLOCK ( alternative rewrite )+ EOB ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:119:9: ^( BLOCK ( alternative rewrite )+ EOB )
            {
            match(input,BLOCK,FOLLOW_BLOCK_in_altList539); 

            match(input, Token.DOWN, null); 
            // org/antlr/grammar/v3/ANTLRv3Tree.g:119:18: ( alternative rewrite )+
            int cnt26=0;
            loop26:
            do {
                int alt26=2;
                switch ( input.LA(1) ) {
                case ALT:
                    {
                    alt26=1;
                    }
                    break;

                }

                switch (alt26) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:119:19: alternative rewrite
            	    {
            	    pushFollow(FOLLOW_alternative_in_altList542);
            	    alternative();

            	    state._fsp--;

            	    pushFollow(FOLLOW_rewrite_in_altList544);
            	    rewrite();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    if ( cnt26 >= 1 ) break loop26;
                        EarlyExitException eee =
                            new EarlyExitException(26, input);
                        throw eee;
                }
                cnt26++;
            } while (true);

            match(input,EOB,FOLLOW_EOB_in_altList548); 

            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "altList"


    // $ANTLR start "alternative"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:122:1: alternative : ( ^( ALT ( element )+ EOA ) | ^( ALT EPSILON EOA ) );
    public final void alternative() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:123:5: ( ^( ALT ( element )+ EOA ) | ^( ALT EPSILON EOA ) )
            int alt28=2;
            switch ( input.LA(1) ) {
            case ALT:
                {
                switch ( input.LA(2) ) {
                case DOWN:
                    {
                    switch ( input.LA(3) ) {
                    case EPSILON:
                        {
                        alt28=2;
                        }
                        break;
                    case BLOCK:
                    case OPTIONAL:
                    case CLOSURE:
                    case POSITIVE_CLOSURE:
                    case SYNPRED:
                    case CHAR_RANGE:
                    case SEMPRED:
                    case GATED_SEMPRED:
                    case SYN_SEMPRED:
                    case TREE_BEGIN:
                    case ROOT:
                    case BANG:
                    case LABEL_ASSIGN:
                    case LIST_LABEL_ASSIGN:
                    case TOKEN_REF:
                    case STRING_LITERAL:
                    case CHAR_LITERAL:
                    case ACTION:
                    case RULE_REF:
                    case 87:
                    case 90:
                        {
                        alt28=1;
                        }
                        break;
                    default:
                        NoViableAltException nvae =
                            new NoViableAltException("", 28, 2, input);

                        throw nvae;
                    }

                    }
                    break;
                default:
                    NoViableAltException nvae =
                        new NoViableAltException("", 28, 1, input);

                    throw nvae;
                }

                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 28, 0, input);

                throw nvae;
            }

            switch (alt28) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:123:9: ^( ALT ( element )+ EOA )
                    {
                    match(input,ALT,FOLLOW_ALT_in_alternative570); 

                    match(input, Token.DOWN, null); 
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:123:15: ( element )+
                    int cnt27=0;
                    loop27:
                    do {
                        int alt27=2;
                        switch ( input.LA(1) ) {
                        case BLOCK:
                        case OPTIONAL:
                        case CLOSURE:
                        case POSITIVE_CLOSURE:
                        case SYNPRED:
                        case CHAR_RANGE:
                        case SEMPRED:
                        case GATED_SEMPRED:
                        case SYN_SEMPRED:
                        case TREE_BEGIN:
                        case ROOT:
                        case BANG:
                        case LABEL_ASSIGN:
                        case LIST_LABEL_ASSIGN:
                        case TOKEN_REF:
                        case STRING_LITERAL:
                        case CHAR_LITERAL:
                        case ACTION:
                        case RULE_REF:
                        case 87:
                        case 90:
                            {
                            alt27=1;
                            }
                            break;

                        }

                        switch (alt27) {
                    	case 1 :
                    	    // org/antlr/grammar/v3/ANTLRv3Tree.g:123:15: element
                    	    {
                    	    pushFollow(FOLLOW_element_in_alternative572);
                    	    element();

                    	    state._fsp--;


                    	    }
                    	    break;

                    	default :
                    	    if ( cnt27 >= 1 ) break loop27;
                                EarlyExitException eee =
                                    new EarlyExitException(27, input);
                                throw eee;
                        }
                        cnt27++;
                    } while (true);

                    match(input,EOA,FOLLOW_EOA_in_alternative575); 

                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:124:9: ^( ALT EPSILON EOA )
                    {
                    match(input,ALT,FOLLOW_ALT_in_alternative587); 

                    match(input, Token.DOWN, null); 
                    match(input,EPSILON,FOLLOW_EPSILON_in_alternative589); 
                    match(input,EOA,FOLLOW_EOA_in_alternative591); 

                    match(input, Token.UP, null); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "alternative"


    // $ANTLR start "exceptionGroup"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:127:1: exceptionGroup : ( ( exceptionHandler )+ ( finallyClause )? | finallyClause );
    public final void exceptionGroup() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:128:2: ( ( exceptionHandler )+ ( finallyClause )? | finallyClause )
            int alt31=2;
            switch ( input.LA(1) ) {
            case 84:
                {
                alt31=1;
                }
                break;
            case 85:
                {
                alt31=2;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 31, 0, input);

                throw nvae;
            }

            switch (alt31) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:128:4: ( exceptionHandler )+ ( finallyClause )?
                    {
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:128:4: ( exceptionHandler )+
                    int cnt29=0;
                    loop29:
                    do {
                        int alt29=2;
                        switch ( input.LA(1) ) {
                        case 84:
                            {
                            alt29=1;
                            }
                            break;

                        }

                        switch (alt29) {
                    	case 1 :
                    	    // org/antlr/grammar/v3/ANTLRv3Tree.g:128:4: exceptionHandler
                    	    {
                    	    pushFollow(FOLLOW_exceptionHandler_in_exceptionGroup606);
                    	    exceptionHandler();

                    	    state._fsp--;


                    	    }
                    	    break;

                    	default :
                    	    if ( cnt29 >= 1 ) break loop29;
                                EarlyExitException eee =
                                    new EarlyExitException(29, input);
                                throw eee;
                        }
                        cnt29++;
                    } while (true);

                    // org/antlr/grammar/v3/ANTLRv3Tree.g:128:22: ( finallyClause )?
                    int alt30=2;
                    switch ( input.LA(1) ) {
                        case 85:
                            {
                            alt30=1;
                            }
                            break;
                    }

                    switch (alt30) {
                        case 1 :
                            // org/antlr/grammar/v3/ANTLRv3Tree.g:128:22: finallyClause
                            {
                            pushFollow(FOLLOW_finallyClause_in_exceptionGroup609);
                            finallyClause();

                            state._fsp--;


                            }
                            break;

                    }


                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:129:4: finallyClause
                    {
                    pushFollow(FOLLOW_finallyClause_in_exceptionGroup615);
                    finallyClause();

                    state._fsp--;


                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "exceptionGroup"


    // $ANTLR start "exceptionHandler"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:132:1: exceptionHandler : ^( 'catch' ARG_ACTION ACTION ) ;
    public final void exceptionHandler() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:133:5: ( ^( 'catch' ARG_ACTION ACTION ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:133:10: ^( 'catch' ARG_ACTION ACTION )
            {
            match(input,84,FOLLOW_84_in_exceptionHandler636); 

            match(input, Token.DOWN, null); 
            match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_exceptionHandler638); 
            match(input,ACTION,FOLLOW_ACTION_in_exceptionHandler640); 

            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "exceptionHandler"


    // $ANTLR start "finallyClause"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:136:1: finallyClause : ^( 'finally' ACTION ) ;
    public final void finallyClause() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:137:5: ( ^( 'finally' ACTION ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:137:10: ^( 'finally' ACTION )
            {
            match(input,85,FOLLOW_85_in_finallyClause662); 

            match(input, Token.DOWN, null); 
            match(input,ACTION,FOLLOW_ACTION_in_finallyClause664); 

            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "finallyClause"


    // $ANTLR start "element"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:140:1: element : ( ^( ( '=' | '+=' ) ID block ) | ^( ( '=' | '+=' ) ID atom ) | atom | ebnf | ACTION | SEMPRED | GATED_SEMPRED | ^( TREE_BEGIN ( element )+ ) );
    public final void element() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:141:2: ( ^( ( '=' | '+=' ) ID block ) | ^( ( '=' | '+=' ) ID atom ) | atom | ebnf | ACTION | SEMPRED | GATED_SEMPRED | ^( TREE_BEGIN ( element )+ ) )
            int alt33=8;
            alt33 = dfa33.predict(input);
            switch (alt33) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:141:4: ^( ( '=' | '+=' ) ID block )
                    {
                    if ( (input.LA(1)>=LABEL_ASSIGN && input.LA(1)<=LIST_LABEL_ASSIGN) ) {
                        input.consume();
                        state.errorRecovery=false;
                    }
                    else {
                        MismatchedSetException mse = new MismatchedSetException(null,input);
                        throw mse;
                    }


                    match(input, Token.DOWN, null); 
                    match(input,ID,FOLLOW_ID_in_element686); 
                    pushFollow(FOLLOW_block_in_element688);
                    block();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:142:4: ^( ( '=' | '+=' ) ID atom )
                    {
                    if ( (input.LA(1)>=LABEL_ASSIGN && input.LA(1)<=LIST_LABEL_ASSIGN) ) {
                        input.consume();
                        state.errorRecovery=false;
                    }
                    else {
                        MismatchedSetException mse = new MismatchedSetException(null,input);
                        throw mse;
                    }


                    match(input, Token.DOWN, null); 
                    match(input,ID,FOLLOW_ID_in_element701); 
                    pushFollow(FOLLOW_atom_in_element703);
                    atom();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 3 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:143:4: atom
                    {
                    pushFollow(FOLLOW_atom_in_element709);
                    atom();

                    state._fsp--;


                    }
                    break;
                case 4 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:144:4: ebnf
                    {
                    pushFollow(FOLLOW_ebnf_in_element714);
                    ebnf();

                    state._fsp--;


                    }
                    break;
                case 5 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:145:6: ACTION
                    {
                    match(input,ACTION,FOLLOW_ACTION_in_element721); 

                    }
                    break;
                case 6 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:146:6: SEMPRED
                    {
                    match(input,SEMPRED,FOLLOW_SEMPRED_in_element728); 

                    }
                    break;
                case 7 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:147:4: GATED_SEMPRED
                    {
                    match(input,GATED_SEMPRED,FOLLOW_GATED_SEMPRED_in_element733); 

                    }
                    break;
                case 8 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:148:6: ^( TREE_BEGIN ( element )+ )
                    {
                    match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_element741); 

                    match(input, Token.DOWN, null); 
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:148:19: ( element )+
                    int cnt32=0;
                    loop32:
                    do {
                        int alt32=2;
                        switch ( input.LA(1) ) {
                        case BLOCK:
                        case OPTIONAL:
                        case CLOSURE:
                        case POSITIVE_CLOSURE:
                        case SYNPRED:
                        case CHAR_RANGE:
                        case SEMPRED:
                        case GATED_SEMPRED:
                        case SYN_SEMPRED:
                        case TREE_BEGIN:
                        case ROOT:
                        case BANG:
                        case LABEL_ASSIGN:
                        case LIST_LABEL_ASSIGN:
                        case TOKEN_REF:
                        case STRING_LITERAL:
                        case CHAR_LITERAL:
                        case ACTION:
                        case RULE_REF:
                        case 87:
                        case 90:
                            {
                            alt32=1;
                            }
                            break;

                        }

                        switch (alt32) {
                    	case 1 :
                    	    // org/antlr/grammar/v3/ANTLRv3Tree.g:148:19: element
                    	    {
                    	    pushFollow(FOLLOW_element_in_element743);
                    	    element();

                    	    state._fsp--;


                    	    }
                    	    break;

                    	default :
                    	    if ( cnt32 >= 1 ) break loop32;
                                EarlyExitException eee =
                                    new EarlyExitException(32, input);
                                throw eee;
                        }
                        cnt32++;
                    } while (true);


                    match(input, Token.UP, null); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "element"


    // $ANTLR start "atom"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:151:1: atom : ( ^( ( '^' | '!' ) atom ) | ^( CHAR_RANGE CHAR_LITERAL CHAR_LITERAL ( optionsSpec )? ) | ^( '~' notTerminal ( optionsSpec )? ) | ^( '~' block ( optionsSpec )? ) | ^( RULE_REF ARG_ACTION ) | RULE_REF | CHAR_LITERAL | ^( CHAR_LITERAL optionsSpec ) | TOKEN_REF | ^( TOKEN_REF optionsSpec ) | ^( TOKEN_REF ARG_ACTION optionsSpec ) | ^( TOKEN_REF ARG_ACTION ) | STRING_LITERAL | ^( STRING_LITERAL optionsSpec ) | '.' | ^( '.' ( optionsSpec )? ) );
    public final void atom() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:151:5: ( ^( ( '^' | '!' ) atom ) | ^( CHAR_RANGE CHAR_LITERAL CHAR_LITERAL ( optionsSpec )? ) | ^( '~' notTerminal ( optionsSpec )? ) | ^( '~' block ( optionsSpec )? ) | ^( RULE_REF ARG_ACTION ) | RULE_REF | CHAR_LITERAL | ^( CHAR_LITERAL optionsSpec ) | TOKEN_REF | ^( TOKEN_REF optionsSpec ) | ^( TOKEN_REF ARG_ACTION optionsSpec ) | ^( TOKEN_REF ARG_ACTION ) | STRING_LITERAL | ^( STRING_LITERAL optionsSpec ) | '.' | ^( '.' ( optionsSpec )? ) )
            int alt38=16;
            alt38 = dfa38.predict(input);
            switch (alt38) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:151:9: ^( ( '^' | '!' ) atom )
                    {
                    if ( (input.LA(1)>=ROOT && input.LA(1)<=BANG) ) {
                        input.consume();
                        state.errorRecovery=false;
                    }
                    else {
                        MismatchedSetException mse = new MismatchedSetException(null,input);
                        throw mse;
                    }


                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_atom_in_atom763);
                    atom();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:152:4: ^( CHAR_RANGE CHAR_LITERAL CHAR_LITERAL ( optionsSpec )? )
                    {
                    match(input,CHAR_RANGE,FOLLOW_CHAR_RANGE_in_atom770); 

                    match(input, Token.DOWN, null); 
                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_atom772); 
                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_atom774); 
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:152:43: ( optionsSpec )?
                    int alt34=2;
                    switch ( input.LA(1) ) {
                        case OPTIONS:
                            {
                            alt34=1;
                            }
                            break;
                    }

                    switch (alt34) {
                        case 1 :
                            // org/antlr/grammar/v3/ANTLRv3Tree.g:152:43: optionsSpec
                            {
                            pushFollow(FOLLOW_optionsSpec_in_atom776);
                            optionsSpec();

                            state._fsp--;


                            }
                            break;

                    }


                    match(input, Token.UP, null); 

                    }
                    break;
                case 3 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:153:4: ^( '~' notTerminal ( optionsSpec )? )
                    {
                    match(input,87,FOLLOW_87_in_atom784); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_notTerminal_in_atom786);
                    notTerminal();

                    state._fsp--;

                    // org/antlr/grammar/v3/ANTLRv3Tree.g:153:22: ( optionsSpec )?
                    int alt35=2;
                    switch ( input.LA(1) ) {
                        case OPTIONS:
                            {
                            alt35=1;
                            }
                            break;
                    }

                    switch (alt35) {
                        case 1 :
                            // org/antlr/grammar/v3/ANTLRv3Tree.g:153:22: optionsSpec
                            {
                            pushFollow(FOLLOW_optionsSpec_in_atom788);
                            optionsSpec();

                            state._fsp--;


                            }
                            break;

                    }


                    match(input, Token.UP, null); 

                    }
                    break;
                case 4 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:154:4: ^( '~' block ( optionsSpec )? )
                    {
                    match(input,87,FOLLOW_87_in_atom796); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_block_in_atom798);
                    block();

                    state._fsp--;

                    // org/antlr/grammar/v3/ANTLRv3Tree.g:154:16: ( optionsSpec )?
                    int alt36=2;
                    switch ( input.LA(1) ) {
                        case OPTIONS:
                            {
                            alt36=1;
                            }
                            break;
                    }

                    switch (alt36) {
                        case 1 :
                            // org/antlr/grammar/v3/ANTLRv3Tree.g:154:16: optionsSpec
                            {
                            pushFollow(FOLLOW_optionsSpec_in_atom800);
                            optionsSpec();

                            state._fsp--;


                            }
                            break;

                    }


                    match(input, Token.UP, null); 

                    }
                    break;
                case 5 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:155:7: ^( RULE_REF ARG_ACTION )
                    {
                    match(input,RULE_REF,FOLLOW_RULE_REF_in_atom811); 

                    match(input, Token.DOWN, null); 
                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_atom813); 

                    match(input, Token.UP, null); 

                    }
                    break;
                case 6 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:156:7: RULE_REF
                    {
                    match(input,RULE_REF,FOLLOW_RULE_REF_in_atom822); 

                    }
                    break;
                case 7 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:157:9: CHAR_LITERAL
                    {
                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_atom832); 

                    }
                    break;
                case 8 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:158:9: ^( CHAR_LITERAL optionsSpec )
                    {
                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_atom843); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_optionsSpec_in_atom845);
                    optionsSpec();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 9 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:159:7: TOKEN_REF
                    {
                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_atom854); 

                    }
                    break;
                case 10 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:160:7: ^( TOKEN_REF optionsSpec )
                    {
                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_atom863); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_optionsSpec_in_atom865);
                    optionsSpec();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 11 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:161:7: ^( TOKEN_REF ARG_ACTION optionsSpec )
                    {
                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_atom875); 

                    match(input, Token.DOWN, null); 
                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_atom877); 
                    pushFollow(FOLLOW_optionsSpec_in_atom879);
                    optionsSpec();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 12 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:162:7: ^( TOKEN_REF ARG_ACTION )
                    {
                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_atom889); 

                    match(input, Token.DOWN, null); 
                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_atom891); 

                    match(input, Token.UP, null); 

                    }
                    break;
                case 13 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:163:7: STRING_LITERAL
                    {
                    match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_atom900); 

                    }
                    break;
                case 14 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:164:7: ^( STRING_LITERAL optionsSpec )
                    {
                    match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_atom909); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_optionsSpec_in_atom911);
                    optionsSpec();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 15 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:165:7: '.'
                    {
                    match(input,90,FOLLOW_90_in_atom920); 

                    }
                    break;
                case 16 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:166:7: ^( '.' ( optionsSpec )? )
                    {
                    match(input,90,FOLLOW_90_in_atom929); 

                    if ( input.LA(1)==Token.DOWN ) {
                        match(input, Token.DOWN, null); 
                        // org/antlr/grammar/v3/ANTLRv3Tree.g:166:13: ( optionsSpec )?
                        int alt37=2;
                        switch ( input.LA(1) ) {
                            case OPTIONS:
                                {
                                alt37=1;
                                }
                                break;
                        }

                        switch (alt37) {
                            case 1 :
                                // org/antlr/grammar/v3/ANTLRv3Tree.g:166:13: optionsSpec
                                {
                                pushFollow(FOLLOW_optionsSpec_in_atom931);
                                optionsSpec();

                                state._fsp--;


                                }
                                break;

                        }


                        match(input, Token.UP, null); 
                    }

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "atom"


    // $ANTLR start "ebnf"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:169:1: ebnf : ( ^( SYNPRED block ) | ^( OPTIONAL block ) | ^( CLOSURE block ) | ^( POSITIVE_CLOSURE block ) | SYN_SEMPRED | block );
    public final void ebnf() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:171:2: ( ^( SYNPRED block ) | ^( OPTIONAL block ) | ^( CLOSURE block ) | ^( POSITIVE_CLOSURE block ) | SYN_SEMPRED | block )
            int alt39=6;
            switch ( input.LA(1) ) {
            case SYNPRED:
                {
                alt39=1;
                }
                break;
            case OPTIONAL:
                {
                alt39=2;
                }
                break;
            case CLOSURE:
                {
                alt39=3;
                }
                break;
            case POSITIVE_CLOSURE:
                {
                alt39=4;
                }
                break;
            case SYN_SEMPRED:
                {
                alt39=5;
                }
                break;
            case BLOCK:
                {
                alt39=6;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 39, 0, input);

                throw nvae;
            }

            switch (alt39) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:171:4: ^( SYNPRED block )
                    {
                    match(input,SYNPRED,FOLLOW_SYNPRED_in_ebnf950); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_block_in_ebnf952);
                    block();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:172:4: ^( OPTIONAL block )
                    {
                    match(input,OPTIONAL,FOLLOW_OPTIONAL_in_ebnf959); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_block_in_ebnf961);
                    block();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 3 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:173:6: ^( CLOSURE block )
                    {
                    match(input,CLOSURE,FOLLOW_CLOSURE_in_ebnf970); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_block_in_ebnf972);
                    block();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 4 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:174:7: ^( POSITIVE_CLOSURE block )
                    {
                    match(input,POSITIVE_CLOSURE,FOLLOW_POSITIVE_CLOSURE_in_ebnf982); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_block_in_ebnf984);
                    block();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 5 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:175:4: SYN_SEMPRED
                    {
                    match(input,SYN_SEMPRED,FOLLOW_SYN_SEMPRED_in_ebnf990); 

                    }
                    break;
                case 6 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:176:4: block
                    {
                    pushFollow(FOLLOW_block_in_ebnf995);
                    block();

                    state._fsp--;


                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "ebnf"


    // $ANTLR start "notTerminal"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:179:1: notTerminal : ( CHAR_LITERAL | TOKEN_REF | STRING_LITERAL );
    public final void notTerminal() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:180:2: ( CHAR_LITERAL | TOKEN_REF | STRING_LITERAL )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:
            {
            if ( (input.LA(1)>=TOKEN_REF && input.LA(1)<=CHAR_LITERAL) ) {
                input.consume();
                state.errorRecovery=false;
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "notTerminal"


    // $ANTLR start "rewrite"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:187:1: rewrite : ( ( ^( '->' SEMPRED rewrite_alternative ) )* ^( '->' rewrite_alternative ) | );
    public final void rewrite() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:188:2: ( ( ^( '->' SEMPRED rewrite_alternative ) )* ^( '->' rewrite_alternative ) | )
            int alt41=2;
            switch ( input.LA(1) ) {
            case REWRITE:
                {
                alt41=1;
                }
                break;
            case ALT:
            case EOB:
                {
                alt41=2;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 41, 0, input);

                throw nvae;
            }

            switch (alt41) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:188:4: ( ^( '->' SEMPRED rewrite_alternative ) )* ^( '->' rewrite_alternative )
                    {
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:188:4: ( ^( '->' SEMPRED rewrite_alternative ) )*
                    loop40:
                    do {
                        int alt40=2;
                        switch ( input.LA(1) ) {
                        case REWRITE:
                            {
                            switch ( input.LA(2) ) {
                            case DOWN:
                                {
                                switch ( input.LA(3) ) {
                                case SEMPRED:
                                    {
                                    alt40=1;
                                    }
                                    break;

                                }

                                }
                                break;

                            }

                            }
                            break;

                        }

                        switch (alt40) {
                    	case 1 :
                    	    // org/antlr/grammar/v3/ANTLRv3Tree.g:188:5: ^( '->' SEMPRED rewrite_alternative )
                    	    {
                    	    match(input,REWRITE,FOLLOW_REWRITE_in_rewrite1035); 

                    	    match(input, Token.DOWN, null); 
                    	    match(input,SEMPRED,FOLLOW_SEMPRED_in_rewrite1037); 
                    	    pushFollow(FOLLOW_rewrite_alternative_in_rewrite1039);
                    	    rewrite_alternative();

                    	    state._fsp--;


                    	    match(input, Token.UP, null); 

                    	    }
                    	    break;

                    	default :
                    	    break loop40;
                        }
                    } while (true);

                    match(input,REWRITE,FOLLOW_REWRITE_in_rewrite1045); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_rewrite_alternative_in_rewrite1047);
                    rewrite_alternative();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:190:2: 
                    {
                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite"


    // $ANTLR start "rewrite_alternative"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:192:1: rewrite_alternative : ( rewrite_template | rewrite_tree_alternative | ^( ALT EPSILON EOA ) );
    public final void rewrite_alternative() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:193:2: ( rewrite_template | rewrite_tree_alternative | ^( ALT EPSILON EOA ) )
            int alt42=3;
            switch ( input.LA(1) ) {
            case TEMPLATE:
            case ACTION:
                {
                alt42=1;
                }
                break;
            case ALT:
                {
                switch ( input.LA(2) ) {
                case DOWN:
                    {
                    switch ( input.LA(3) ) {
                    case EPSILON:
                        {
                        alt42=3;
                        }
                        break;
                    case BLOCK:
                    case OPTIONAL:
                    case CLOSURE:
                    case POSITIVE_CLOSURE:
                    case LABEL:
                    case TREE_BEGIN:
                    case TOKEN_REF:
                    case STRING_LITERAL:
                    case CHAR_LITERAL:
                    case ACTION:
                    case RULE_REF:
                        {
                        alt42=2;
                        }
                        break;
                    default:
                        NoViableAltException nvae =
                            new NoViableAltException("", 42, 3, input);

                        throw nvae;
                    }

                    }
                    break;
                default:
                    NoViableAltException nvae =
                        new NoViableAltException("", 42, 2, input);

                    throw nvae;
                }

                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 42, 0, input);

                throw nvae;
            }

            switch (alt42) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:193:4: rewrite_template
                    {
                    pushFollow(FOLLOW_rewrite_template_in_rewrite_alternative1062);
                    rewrite_template();

                    state._fsp--;


                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:194:4: rewrite_tree_alternative
                    {
                    pushFollow(FOLLOW_rewrite_tree_alternative_in_rewrite_alternative1067);
                    rewrite_tree_alternative();

                    state._fsp--;


                    }
                    break;
                case 3 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:195:9: ^( ALT EPSILON EOA )
                    {
                    match(input,ALT,FOLLOW_ALT_in_rewrite_alternative1078); 

                    match(input, Token.DOWN, null); 
                    match(input,EPSILON,FOLLOW_EPSILON_in_rewrite_alternative1080); 
                    match(input,EOA,FOLLOW_EOA_in_rewrite_alternative1082); 

                    match(input, Token.UP, null); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_alternative"


    // $ANTLR start "rewrite_tree_block"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:198:1: rewrite_tree_block : ^( BLOCK rewrite_tree_alternative EOB ) ;
    public final void rewrite_tree_block() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:199:5: ( ^( BLOCK rewrite_tree_alternative EOB ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:199:9: ^( BLOCK rewrite_tree_alternative EOB )
            {
            match(input,BLOCK,FOLLOW_BLOCK_in_rewrite_tree_block1101); 

            match(input, Token.DOWN, null); 
            pushFollow(FOLLOW_rewrite_tree_alternative_in_rewrite_tree_block1103);
            rewrite_tree_alternative();

            state._fsp--;

            match(input,EOB,FOLLOW_EOB_in_rewrite_tree_block1105); 

            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_tree_block"


    // $ANTLR start "rewrite_tree_alternative"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:202:1: rewrite_tree_alternative : ^( ALT ( rewrite_tree_element )+ EOA ) ;
    public final void rewrite_tree_alternative() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:203:5: ( ^( ALT ( rewrite_tree_element )+ EOA ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:203:7: ^( ALT ( rewrite_tree_element )+ EOA )
            {
            match(input,ALT,FOLLOW_ALT_in_rewrite_tree_alternative1124); 

            match(input, Token.DOWN, null); 
            // org/antlr/grammar/v3/ANTLRv3Tree.g:203:13: ( rewrite_tree_element )+
            int cnt43=0;
            loop43:
            do {
                int alt43=2;
                switch ( input.LA(1) ) {
                case BLOCK:
                case OPTIONAL:
                case CLOSURE:
                case POSITIVE_CLOSURE:
                case LABEL:
                case TREE_BEGIN:
                case TOKEN_REF:
                case STRING_LITERAL:
                case CHAR_LITERAL:
                case ACTION:
                case RULE_REF:
                    {
                    alt43=1;
                    }
                    break;

                }

                switch (alt43) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:203:13: rewrite_tree_element
            	    {
            	    pushFollow(FOLLOW_rewrite_tree_element_in_rewrite_tree_alternative1126);
            	    rewrite_tree_element();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    if ( cnt43 >= 1 ) break loop43;
                        EarlyExitException eee =
                            new EarlyExitException(43, input);
                        throw eee;
                }
                cnt43++;
            } while (true);

            match(input,EOA,FOLLOW_EOA_in_rewrite_tree_alternative1129); 

            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_tree_alternative"


    // $ANTLR start "rewrite_tree_element"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:206:1: rewrite_tree_element : ( rewrite_tree_atom | rewrite_tree | rewrite_tree_block | rewrite_tree_ebnf );
    public final void rewrite_tree_element() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:207:2: ( rewrite_tree_atom | rewrite_tree | rewrite_tree_block | rewrite_tree_ebnf )
            int alt44=4;
            switch ( input.LA(1) ) {
            case LABEL:
            case TOKEN_REF:
            case STRING_LITERAL:
            case CHAR_LITERAL:
            case ACTION:
            case RULE_REF:
                {
                alt44=1;
                }
                break;
            case TREE_BEGIN:
                {
                alt44=2;
                }
                break;
            case BLOCK:
                {
                alt44=3;
                }
                break;
            case OPTIONAL:
            case CLOSURE:
            case POSITIVE_CLOSURE:
                {
                alt44=4;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 44, 0, input);

                throw nvae;
            }

            switch (alt44) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:207:4: rewrite_tree_atom
                    {
                    pushFollow(FOLLOW_rewrite_tree_atom_in_rewrite_tree_element1144);
                    rewrite_tree_atom();

                    state._fsp--;


                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:208:4: rewrite_tree
                    {
                    pushFollow(FOLLOW_rewrite_tree_in_rewrite_tree_element1149);
                    rewrite_tree();

                    state._fsp--;


                    }
                    break;
                case 3 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:209:6: rewrite_tree_block
                    {
                    pushFollow(FOLLOW_rewrite_tree_block_in_rewrite_tree_element1156);
                    rewrite_tree_block();

                    state._fsp--;


                    }
                    break;
                case 4 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:210:6: rewrite_tree_ebnf
                    {
                    pushFollow(FOLLOW_rewrite_tree_ebnf_in_rewrite_tree_element1163);
                    rewrite_tree_ebnf();

                    state._fsp--;


                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_tree_element"


    // $ANTLR start "rewrite_tree_atom"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:213:1: rewrite_tree_atom : ( CHAR_LITERAL | TOKEN_REF | ^( TOKEN_REF ARG_ACTION ) | RULE_REF | STRING_LITERAL | LABEL | ACTION );
    public final void rewrite_tree_atom() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:214:5: ( CHAR_LITERAL | TOKEN_REF | ^( TOKEN_REF ARG_ACTION ) | RULE_REF | STRING_LITERAL | LABEL | ACTION )
            int alt45=7;
            switch ( input.LA(1) ) {
            case CHAR_LITERAL:
                {
                alt45=1;
                }
                break;
            case TOKEN_REF:
                {
                switch ( input.LA(2) ) {
                case DOWN:
                    {
                    alt45=3;
                    }
                    break;
                case UP:
                case BLOCK:
                case OPTIONAL:
                case CLOSURE:
                case POSITIVE_CLOSURE:
                case EOA:
                case LABEL:
                case TREE_BEGIN:
                case TOKEN_REF:
                case STRING_LITERAL:
                case CHAR_LITERAL:
                case ACTION:
                case RULE_REF:
                    {
                    alt45=2;
                    }
                    break;
                default:
                    NoViableAltException nvae =
                        new NoViableAltException("", 45, 2, input);

                    throw nvae;
                }

                }
                break;
            case RULE_REF:
                {
                alt45=4;
                }
                break;
            case STRING_LITERAL:
                {
                alt45=5;
                }
                break;
            case LABEL:
                {
                alt45=6;
                }
                break;
            case ACTION:
                {
                alt45=7;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 45, 0, input);

                throw nvae;
            }

            switch (alt45) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:214:9: CHAR_LITERAL
                    {
                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_rewrite_tree_atom1179); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:215:6: TOKEN_REF
                    {
                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewrite_tree_atom1186); 

                    }
                    break;
                case 3 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:216:6: ^( TOKEN_REF ARG_ACTION )
                    {
                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewrite_tree_atom1194); 

                    match(input, Token.DOWN, null); 
                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewrite_tree_atom1196); 

                    match(input, Token.UP, null); 

                    }
                    break;
                case 4 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:217:9: RULE_REF
                    {
                    match(input,RULE_REF,FOLLOW_RULE_REF_in_rewrite_tree_atom1208); 

                    }
                    break;
                case 5 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:218:6: STRING_LITERAL
                    {
                    match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewrite_tree_atom1215); 

                    }
                    break;
                case 6 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:219:6: LABEL
                    {
                    match(input,LABEL,FOLLOW_LABEL_in_rewrite_tree_atom1222); 

                    }
                    break;
                case 7 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:220:4: ACTION
                    {
                    match(input,ACTION,FOLLOW_ACTION_in_rewrite_tree_atom1227); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_tree_atom"


    // $ANTLR start "rewrite_tree_ebnf"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:223:1: rewrite_tree_ebnf : ( ^( OPTIONAL rewrite_tree_block ) | ^( CLOSURE rewrite_tree_block ) | ^( POSITIVE_CLOSURE rewrite_tree_block ) );
    public final void rewrite_tree_ebnf() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:224:2: ( ^( OPTIONAL rewrite_tree_block ) | ^( CLOSURE rewrite_tree_block ) | ^( POSITIVE_CLOSURE rewrite_tree_block ) )
            int alt46=3;
            switch ( input.LA(1) ) {
            case OPTIONAL:
                {
                alt46=1;
                }
                break;
            case CLOSURE:
                {
                alt46=2;
                }
                break;
            case POSITIVE_CLOSURE:
                {
                alt46=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 46, 0, input);

                throw nvae;
            }

            switch (alt46) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:224:4: ^( OPTIONAL rewrite_tree_block )
                    {
                    match(input,OPTIONAL,FOLLOW_OPTIONAL_in_rewrite_tree_ebnf1239); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_rewrite_tree_block_in_rewrite_tree_ebnf1241);
                    rewrite_tree_block();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:225:6: ^( CLOSURE rewrite_tree_block )
                    {
                    match(input,CLOSURE,FOLLOW_CLOSURE_in_rewrite_tree_ebnf1250); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_rewrite_tree_block_in_rewrite_tree_ebnf1252);
                    rewrite_tree_block();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 3 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:226:7: ^( POSITIVE_CLOSURE rewrite_tree_block )
                    {
                    match(input,POSITIVE_CLOSURE,FOLLOW_POSITIVE_CLOSURE_in_rewrite_tree_ebnf1262); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_rewrite_tree_block_in_rewrite_tree_ebnf1264);
                    rewrite_tree_block();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_tree_ebnf"


    // $ANTLR start "rewrite_tree"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:229:1: rewrite_tree : ^( TREE_BEGIN rewrite_tree_atom ( rewrite_tree_element )* ) ;
    public final void rewrite_tree() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:230:2: ( ^( TREE_BEGIN rewrite_tree_atom ( rewrite_tree_element )* ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:230:4: ^( TREE_BEGIN rewrite_tree_atom ( rewrite_tree_element )* )
            {
            match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_rewrite_tree1278); 

            match(input, Token.DOWN, null); 
            pushFollow(FOLLOW_rewrite_tree_atom_in_rewrite_tree1280);
            rewrite_tree_atom();

            state._fsp--;

            // org/antlr/grammar/v3/ANTLRv3Tree.g:230:35: ( rewrite_tree_element )*
            loop47:
            do {
                int alt47=2;
                switch ( input.LA(1) ) {
                case BLOCK:
                case OPTIONAL:
                case CLOSURE:
                case POSITIVE_CLOSURE:
                case LABEL:
                case TREE_BEGIN:
                case TOKEN_REF:
                case STRING_LITERAL:
                case CHAR_LITERAL:
                case ACTION:
                case RULE_REF:
                    {
                    alt47=1;
                    }
                    break;

                }

                switch (alt47) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:230:35: rewrite_tree_element
            	    {
            	    pushFollow(FOLLOW_rewrite_tree_element_in_rewrite_tree1282);
            	    rewrite_tree_element();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    break loop47;
                }
            } while (true);


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_tree"


    // $ANTLR start "rewrite_template"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:233:1: rewrite_template : ( ^( TEMPLATE ID rewrite_template_args ( DOUBLE_QUOTE_STRING_LITERAL | DOUBLE_ANGLE_STRING_LITERAL ) ) | rewrite_template_ref | rewrite_indirect_template_head | ACTION );
    public final void rewrite_template() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:234:2: ( ^( TEMPLATE ID rewrite_template_args ( DOUBLE_QUOTE_STRING_LITERAL | DOUBLE_ANGLE_STRING_LITERAL ) ) | rewrite_template_ref | rewrite_indirect_template_head | ACTION )
            int alt48=4;
            alt48 = dfa48.predict(input);
            switch (alt48) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:234:6: ^( TEMPLATE ID rewrite_template_args ( DOUBLE_QUOTE_STRING_LITERAL | DOUBLE_ANGLE_STRING_LITERAL ) )
                    {
                    match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewrite_template1300); 

                    match(input, Token.DOWN, null); 
                    match(input,ID,FOLLOW_ID_in_rewrite_template1302); 
                    pushFollow(FOLLOW_rewrite_template_args_in_rewrite_template1304);
                    rewrite_template_args();

                    state._fsp--;

                    if ( (input.LA(1)>=DOUBLE_QUOTE_STRING_LITERAL && input.LA(1)<=DOUBLE_ANGLE_STRING_LITERAL) ) {
                        input.consume();
                        state.errorRecovery=false;
                    }
                    else {
                        MismatchedSetException mse = new MismatchedSetException(null,input);
                        throw mse;
                    }


                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:237:4: rewrite_template_ref
                    {
                    pushFollow(FOLLOW_rewrite_template_ref_in_rewrite_template1327);
                    rewrite_template_ref();

                    state._fsp--;


                    }
                    break;
                case 3 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:238:4: rewrite_indirect_template_head
                    {
                    pushFollow(FOLLOW_rewrite_indirect_template_head_in_rewrite_template1332);
                    rewrite_indirect_template_head();

                    state._fsp--;


                    }
                    break;
                case 4 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:239:4: ACTION
                    {
                    match(input,ACTION,FOLLOW_ACTION_in_rewrite_template1337); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_template"


    // $ANTLR start "rewrite_template_ref"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:242:1: rewrite_template_ref : ^( TEMPLATE ID rewrite_template_args ) ;
    public final void rewrite_template_ref() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:244:2: ( ^( TEMPLATE ID rewrite_template_args ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:244:4: ^( TEMPLATE ID rewrite_template_args )
            {
            match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewrite_template_ref1351); 

            match(input, Token.DOWN, null); 
            match(input,ID,FOLLOW_ID_in_rewrite_template_ref1353); 
            pushFollow(FOLLOW_rewrite_template_args_in_rewrite_template_ref1355);
            rewrite_template_args();

            state._fsp--;


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_template_ref"


    // $ANTLR start "rewrite_indirect_template_head"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:247:1: rewrite_indirect_template_head : ^( TEMPLATE ACTION rewrite_template_args ) ;
    public final void rewrite_indirect_template_head() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:249:2: ( ^( TEMPLATE ACTION rewrite_template_args ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:249:4: ^( TEMPLATE ACTION rewrite_template_args )
            {
            match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewrite_indirect_template_head1370); 

            match(input, Token.DOWN, null); 
            match(input,ACTION,FOLLOW_ACTION_in_rewrite_indirect_template_head1372); 
            pushFollow(FOLLOW_rewrite_template_args_in_rewrite_indirect_template_head1374);
            rewrite_template_args();

            state._fsp--;


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_indirect_template_head"


    // $ANTLR start "rewrite_template_args"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:252:1: rewrite_template_args : ( ^( ARGLIST ( rewrite_template_arg )+ ) | ARGLIST );
    public final void rewrite_template_args() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:253:2: ( ^( ARGLIST ( rewrite_template_arg )+ ) | ARGLIST )
            int alt50=2;
            switch ( input.LA(1) ) {
            case ARGLIST:
                {
                switch ( input.LA(2) ) {
                case DOWN:
                    {
                    alt50=1;
                    }
                    break;
                case UP:
                case DOUBLE_QUOTE_STRING_LITERAL:
                case DOUBLE_ANGLE_STRING_LITERAL:
                    {
                    alt50=2;
                    }
                    break;
                default:
                    NoViableAltException nvae =
                        new NoViableAltException("", 50, 1, input);

                    throw nvae;
                }

                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 50, 0, input);

                throw nvae;
            }

            switch (alt50) {
                case 1 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:253:4: ^( ARGLIST ( rewrite_template_arg )+ )
                    {
                    match(input,ARGLIST,FOLLOW_ARGLIST_in_rewrite_template_args1387); 

                    match(input, Token.DOWN, null); 
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:253:14: ( rewrite_template_arg )+
                    int cnt49=0;
                    loop49:
                    do {
                        int alt49=2;
                        switch ( input.LA(1) ) {
                        case ARG:
                            {
                            alt49=1;
                            }
                            break;

                        }

                        switch (alt49) {
                    	case 1 :
                    	    // org/antlr/grammar/v3/ANTLRv3Tree.g:253:14: rewrite_template_arg
                    	    {
                    	    pushFollow(FOLLOW_rewrite_template_arg_in_rewrite_template_args1389);
                    	    rewrite_template_arg();

                    	    state._fsp--;


                    	    }
                    	    break;

                    	default :
                    	    if ( cnt49 >= 1 ) break loop49;
                                EarlyExitException eee =
                                    new EarlyExitException(49, input);
                                throw eee;
                        }
                        cnt49++;
                    } while (true);


                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // org/antlr/grammar/v3/ANTLRv3Tree.g:254:4: ARGLIST
                    {
                    match(input,ARGLIST,FOLLOW_ARGLIST_in_rewrite_template_args1396); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_template_args"


    // $ANTLR start "rewrite_template_arg"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:257:1: rewrite_template_arg : ^( ARG ID ACTION ) ;
    public final void rewrite_template_arg() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:258:2: ( ^( ARG ID ACTION ) )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:258:6: ^( ARG ID ACTION )
            {
            match(input,ARG,FOLLOW_ARG_in_rewrite_template_arg1410); 

            match(input, Token.DOWN, null); 
            match(input,ID,FOLLOW_ID_in_rewrite_template_arg1412); 
            match(input,ACTION,FOLLOW_ACTION_in_rewrite_template_arg1414); 

            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "rewrite_template_arg"


    // $ANTLR start "qid"
    // org/antlr/grammar/v3/ANTLRv3Tree.g:261:1: qid : ID ( '.' ID )* ;
    public final void qid() throws RecognitionException {
        try {
            // org/antlr/grammar/v3/ANTLRv3Tree.g:261:5: ( ID ( '.' ID )* )
            // org/antlr/grammar/v3/ANTLRv3Tree.g:261:7: ID ( '.' ID )*
            {
            match(input,ID,FOLLOW_ID_in_qid1425); 
            // org/antlr/grammar/v3/ANTLRv3Tree.g:261:10: ( '.' ID )*
            loop51:
            do {
                int alt51=2;
                switch ( input.LA(1) ) {
                case 90:
                    {
                    alt51=1;
                    }
                    break;

                }

                switch (alt51) {
            	case 1 :
            	    // org/antlr/grammar/v3/ANTLRv3Tree.g:261:11: '.' ID
            	    {
            	    match(input,90,FOLLOW_90_in_qid1428); 
            	    match(input,ID,FOLLOW_ID_in_qid1430); 

            	    }
            	    break;

            	default :
            	    break loop51;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "qid"

    // Delegated rules


    protected DFA33 dfa33 = new DFA33(this);
    protected DFA38 dfa38 = new DFA38(this);
    protected DFA48 dfa48 = new DFA48(this);
    static final String DFA33_eotS =
        "\14\uffff";
    static final String DFA33_eofS =
        "\14\uffff";
    static final String DFA33_minS =
        "\1\10\1\2\6\uffff\1\24\1\10\2\uffff";
    static final String DFA33_maxS =
        "\1\132\1\2\6\uffff\1\24\1\132\2\uffff";
    static final String DFA33_acceptS =
        "\2\uffff\1\3\1\4\1\5\1\6\1\7\1\10\2\uffff\1\1\1\2";
    static final String DFA33_specialS =
        "\14\uffff}>";
    static final String[] DFA33_transitionS = {
            "\5\3\1\uffff\1\2\20\uffff\1\5\1\6\1\3\2\uffff\1\7\2\2\2\uffff"+
            "\2\1\1\uffff\3\2\1\4\3\uffff\1\2\43\uffff\1\2\2\uffff\1\2",
            "\1\10",
            "",
            "",
            "",
            "",
            "",
            "",
            "\1\11",
            "\1\12\5\uffff\1\13\26\uffff\2\13\5\uffff\3\13\4\uffff\1\13"+
            "\43\uffff\1\13\2\uffff\1\13",
            "",
            ""
    };

    static final short[] DFA33_eot = DFA.unpackEncodedString(DFA33_eotS);
    static final short[] DFA33_eof = DFA.unpackEncodedString(DFA33_eofS);
    static final char[] DFA33_min = DFA.unpackEncodedStringToUnsignedChars(DFA33_minS);
    static final char[] DFA33_max = DFA.unpackEncodedStringToUnsignedChars(DFA33_maxS);
    static final short[] DFA33_accept = DFA.unpackEncodedString(DFA33_acceptS);
    static final short[] DFA33_special = DFA.unpackEncodedString(DFA33_specialS);
    static final short[][] DFA33_transition;

    static {
        int numStates = DFA33_transitionS.length;
        DFA33_transition = new short[numStates][];
        for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy