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

org.jbehaviour.antlr.AnotherMethodGrammerParser Maven / Gradle / Ivy

The newest version!
// $ANTLR 3.4 org/jbehaviour/antlr/AnotherMethodGrammer.g 2012-12-20 23:28:16

    package org.jbehaviour.antlr;
    import java.io.IOException;
    import java.util.regex.Pattern;


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

import org.antlr.runtime.tree.*;


/**
 * @author Roffin Yannick
 */
@SuppressWarnings({"all", "warnings", "unchecked"})
public class AnotherMethodGrammerParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "", "", "", "", "Alphanumeric", "Arobase", "Comma", "Cote", "Digit", "Dollar", "Dot", "DoubleCote", "Eol", "EscapeSequence", "Exponent", "HexDigit", "Identifier", "LeftBrace", "Member", "Number", "Reference", "RightBrace", "String", "TOK_IDENTIFIER", "TOK_NUMBER", "TOK_STRING", "TOK_TEMPLATE", "UnderScrore", "UnicodeEscape", "WS"
    };

    public static final int EOF=-1;
    public static final int Alphanumeric=4;
    public static final int Arobase=5;
    public static final int Comma=6;
    public static final int Cote=7;
    public static final int Digit=8;
    public static final int Dollar=9;
    public static final int Dot=10;
    public static final int DoubleCote=11;
    public static final int Eol=12;
    public static final int EscapeSequence=13;
    public static final int Exponent=14;
    public static final int HexDigit=15;
    public static final int Identifier=16;
    public static final int LeftBrace=17;
    public static final int Member=18;
    public static final int Number=19;
    public static final int Reference=20;
    public static final int RightBrace=21;
    public static final int String=22;
    public static final int TOK_IDENTIFIER=23;
    public static final int TOK_NUMBER=24;
    public static final int TOK_STRING=25;
    public static final int TOK_TEMPLATE=26;
    public static final int UnderScrore=27;
    public static final int UnicodeEscape=28;
    public static final int WS=29;

    // delegates
    public Parser[] getDelegates() {
        return new Parser[] {};
    }

    // delegators


    public AnotherMethodGrammerParser(TokenStream input) {
        this(input, new RecognizerSharedState());
    }
    public AnotherMethodGrammerParser(TokenStream input, RecognizerSharedState state) {
        super(input, state);
    }

protected TreeAdaptor adaptor = new CommonTreeAdaptor();

public void setTreeAdaptor(TreeAdaptor adaptor) {
    this.adaptor = adaptor;
}
public TreeAdaptor getTreeAdaptor() {
    return adaptor;
}
    public String[] getTokenNames() { return AnotherMethodGrammerParser.tokenNames; }
    public String getGrammarFileName() { return "org/jbehaviour/antlr/AnotherMethodGrammer.g"; }


    	/**
    	 * debug
    	 */
        	public void onDebug(String where,String value) {
        		System.err.println(where+" "+value);
        	}
        	public void onIsMethod(String isMethod) {
    	    	onDebug("onIsMethod: ", isMethod);
        	}
        	public void onAnyReference(String reference) {
    	    	onDebug("onAnyReference: ", reference);
        	}
        	public void onAnyIdentifier(String identifier) {
    	    	onDebug("onAnyIdentifier: ", identifier);
        	}
        	public void onAnyString(String string) {
    	    	onDebug("onAnyString: ", string);
        	}
        	public void onAnyNumber(String number) {
    	    	onDebug("onAnyNumber: ", number);
        	}


    public static class template_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "template"
    // org/jbehaviour/antlr/AnotherMethodGrammer.g:85:1: template : Reference ( Dot identifier ( arguments )? )+ -> ^( TOK_TEMPLATE Reference ( Dot identifier ( arguments )? )+ ) ;
    public final AnotherMethodGrammerParser.template_return template() throws RecognitionException {
        AnotherMethodGrammerParser.template_return retval = new AnotherMethodGrammerParser.template_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token Reference1=null;
        Token Dot2=null;
        AnotherMethodGrammerParser.identifier_return identifier3 =null;

        AnotherMethodGrammerParser.arguments_return arguments4 =null;


        CommonTree Reference1_tree=null;
        CommonTree Dot2_tree=null;
        RewriteRuleTokenStream stream_Dot=new RewriteRuleTokenStream(adaptor,"token Dot");
        RewriteRuleTokenStream stream_Reference=new RewriteRuleTokenStream(adaptor,"token Reference");
        RewriteRuleSubtreeStream stream_arguments=new RewriteRuleSubtreeStream(adaptor,"rule arguments");
        RewriteRuleSubtreeStream stream_identifier=new RewriteRuleSubtreeStream(adaptor,"rule identifier");
        try {
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:86:2: ( Reference ( Dot identifier ( arguments )? )+ -> ^( TOK_TEMPLATE Reference ( Dot identifier ( arguments )? )+ ) )
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:86:4: Reference ( Dot identifier ( arguments )? )+
            {
            Reference1=(Token)match(input,Reference,FOLLOW_Reference_in_template103);  
            stream_Reference.add(Reference1);


            onAnyReference((Reference1!=null?Reference1.getText():null));

            // org/jbehaviour/antlr/AnotherMethodGrammer.g:86:49: ( Dot identifier ( arguments )? )+
            int cnt2=0;
            loop2:
            do {
                int alt2=2;
                switch ( input.LA(1) ) {
                case Dot:
                    {
                    alt2=1;
                    }
                    break;

                }

                switch (alt2) {
            	case 1 :
            	    // org/jbehaviour/antlr/AnotherMethodGrammer.g:86:50: Dot identifier ( arguments )?
            	    {
            	    Dot2=(Token)match(input,Dot,FOLLOW_Dot_in_template108);  
            	    stream_Dot.add(Dot2);


            	    pushFollow(FOLLOW_identifier_in_template110);
            	    identifier3=identifier();

            	    state._fsp--;

            	    stream_identifier.add(identifier3.getTree());

            	    onAnyIdentifier((identifier3!=null?input.toString(identifier3.start,identifier3.stop):null));

            	    // org/jbehaviour/antlr/AnotherMethodGrammer.g:86:102: ( arguments )?
            	    int alt1=2;
            	    switch ( input.LA(1) ) {
            	        case LeftBrace:
            	            {
            	            alt1=1;
            	            }
            	            break;
            	    }

            	    switch (alt1) {
            	        case 1 :
            	            // org/jbehaviour/antlr/AnotherMethodGrammer.g:86:102: arguments
            	            {
            	            pushFollow(FOLLOW_arguments_in_template114);
            	            arguments4=arguments();

            	            state._fsp--;

            	            stream_arguments.add(arguments4.getTree());

            	            }
            	            break;

            	    }


            	    }
            	    break;

            	default :
            	    if ( cnt2 >= 1 ) break loop2;
                        EarlyExitException eee =
                            new EarlyExitException(2, input);
                        throw eee;
                }
                cnt2++;
            } while (true);


            // AST REWRITE
            // elements: Dot, arguments, identifier, Reference
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 87:3: -> ^( TOK_TEMPLATE Reference ( Dot identifier ( arguments )? )+ )
            {
                // org/jbehaviour/antlr/AnotherMethodGrammer.g:87:6: ^( TOK_TEMPLATE Reference ( Dot identifier ( arguments )? )+ )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(
                (CommonTree)adaptor.create(TOK_TEMPLATE, "TOK_TEMPLATE")
                , root_1);

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

                if ( !(stream_Dot.hasNext()||stream_identifier.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_Dot.hasNext()||stream_identifier.hasNext() ) {
                    adaptor.addChild(root_1, 
                    stream_Dot.nextNode()
                    );

                    adaptor.addChild(root_1, stream_identifier.nextTree());

                    // org/jbehaviour/antlr/AnotherMethodGrammer.g:87:47: ( arguments )?
                    if ( stream_arguments.hasNext() ) {
                        adaptor.addChild(root_1, stream_arguments.nextTree());

                    }
                    stream_arguments.reset();

                }
                stream_Dot.reset();
                stream_identifier.reset();

                adaptor.addChild(root_0, root_1);
                }

            }


            retval.tree = root_0;

            }

            retval.stop = input.LT(-1);


            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
         
        catch (Exception e) { 
        //throw e; 
        } 

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "template"


    public static class arguments_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "arguments"
    // org/jbehaviour/antlr/AnotherMethodGrammer.g:90:1: arguments : ( LeftBrace ( number | string | WS | Comma )* RightBrace ) ;
    public final AnotherMethodGrammerParser.arguments_return arguments() throws RecognitionException {
        AnotherMethodGrammerParser.arguments_return retval = new AnotherMethodGrammerParser.arguments_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token LeftBrace5=null;
        Token WS8=null;
        Token Comma9=null;
        Token RightBrace10=null;
        AnotherMethodGrammerParser.number_return number6 =null;

        AnotherMethodGrammerParser.string_return string7 =null;


        CommonTree LeftBrace5_tree=null;
        CommonTree WS8_tree=null;
        CommonTree Comma9_tree=null;
        CommonTree RightBrace10_tree=null;

        try {
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:91:2: ( ( LeftBrace ( number | string | WS | Comma )* RightBrace ) )
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:91:4: ( LeftBrace ( number | string | WS | Comma )* RightBrace )
            {
            root_0 = (CommonTree)adaptor.nil();


            // org/jbehaviour/antlr/AnotherMethodGrammer.g:91:4: ( LeftBrace ( number | string | WS | Comma )* RightBrace )
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:91:5: LeftBrace ( number | string | WS | Comma )* RightBrace
            {
            LeftBrace5=(Token)match(input,LeftBrace,FOLLOW_LeftBrace_in_arguments151); 
            LeftBrace5_tree = 
            (CommonTree)adaptor.create(LeftBrace5)
            ;
            adaptor.addChild(root_0, LeftBrace5_tree);


            onIsMethod((LeftBrace5!=null?LeftBrace5.getText():null));

            // org/jbehaviour/antlr/AnotherMethodGrammer.g:91:46: ( number | string | WS | Comma )*
            loop3:
            do {
                int alt3=5;
                switch ( input.LA(1) ) {
                case Number:
                    {
                    alt3=1;
                    }
                    break;
                case String:
                    {
                    alt3=2;
                    }
                    break;
                case WS:
                    {
                    alt3=3;
                    }
                    break;
                case Comma:
                    {
                    alt3=4;
                    }
                    break;

                }

                switch (alt3) {
            	case 1 :
            	    // org/jbehaviour/antlr/AnotherMethodGrammer.g:91:47: number
            	    {
            	    pushFollow(FOLLOW_number_in_arguments156);
            	    number6=number();

            	    state._fsp--;

            	    adaptor.addChild(root_0, number6.getTree());

            	    onAnyNumber((number6!=null?input.toString(number6.start,number6.stop):null));

            	    }
            	    break;
            	case 2 :
            	    // org/jbehaviour/antlr/AnotherMethodGrammer.g:91:83: string
            	    {
            	    pushFollow(FOLLOW_string_in_arguments160);
            	    string7=string();

            	    state._fsp--;

            	    adaptor.addChild(root_0, string7.getTree());

            	    onAnyString((string7!=null?input.toString(string7.start,string7.stop):null));

            	    }
            	    break;
            	case 3 :
            	    // org/jbehaviour/antlr/AnotherMethodGrammer.g:91:119: WS
            	    {
            	    WS8=(Token)match(input,WS,FOLLOW_WS_in_arguments164); 
            	    WS8_tree = 
            	    (CommonTree)adaptor.create(WS8)
            	    ;
            	    adaptor.addChild(root_0, WS8_tree);


            	    }
            	    break;
            	case 4 :
            	    // org/jbehaviour/antlr/AnotherMethodGrammer.g:91:122: Comma
            	    {
            	    Comma9=(Token)match(input,Comma,FOLLOW_Comma_in_arguments166); 
            	    Comma9_tree = 
            	    (CommonTree)adaptor.create(Comma9)
            	    ;
            	    adaptor.addChild(root_0, Comma9_tree);


            	    }
            	    break;

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


            RightBrace10=(Token)match(input,RightBrace,FOLLOW_RightBrace_in_arguments170); 
            RightBrace10_tree = 
            (CommonTree)adaptor.create(RightBrace10)
            ;
            adaptor.addChild(root_0, RightBrace10_tree);


            }


            }

            retval.stop = input.LT(-1);


            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
         
        catch (Exception e) { 
        //throw e; 
        } 

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "arguments"


    public static class string_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "string"
    // org/jbehaviour/antlr/AnotherMethodGrammer.g:94:1: string : String -> ^( TOK_STRING String ) ;
    public final AnotherMethodGrammerParser.string_return string() throws RecognitionException {
        AnotherMethodGrammerParser.string_return retval = new AnotherMethodGrammerParser.string_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token String11=null;

        CommonTree String11_tree=null;
        RewriteRuleTokenStream stream_String=new RewriteRuleTokenStream(adaptor,"token String");

        try {
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:94:9: ( String -> ^( TOK_STRING String ) )
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:94:11: String
            {
            String11=(Token)match(input,String,FOLLOW_String_in_string182);  
            stream_String.add(String11);


            // AST REWRITE
            // elements: String
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 95:4: -> ^( TOK_STRING String )
            {
                // org/jbehaviour/antlr/AnotherMethodGrammer.g:95:7: ^( TOK_STRING String )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(
                (CommonTree)adaptor.create(TOK_STRING, "TOK_STRING")
                , root_1);

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

                adaptor.addChild(root_0, root_1);
                }

            }


            retval.tree = root_0;

            }

            retval.stop = input.LT(-1);


            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
         
        catch (Exception e) { 
        //throw e; 
        } 

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "string"


    public static class identifier_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "identifier"
    // org/jbehaviour/antlr/AnotherMethodGrammer.g:98:1: identifier : Identifier -> ^( TOK_IDENTIFIER Identifier ) ;
    public final AnotherMethodGrammerParser.identifier_return identifier() throws RecognitionException {
        AnotherMethodGrammerParser.identifier_return retval = new AnotherMethodGrammerParser.identifier_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token Identifier12=null;

        CommonTree Identifier12_tree=null;
        RewriteRuleTokenStream stream_Identifier=new RewriteRuleTokenStream(adaptor,"token Identifier");

        try {
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:99:2: ( Identifier -> ^( TOK_IDENTIFIER Identifier ) )
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:99:4: Identifier
            {
            Identifier12=(Token)match(input,Identifier,FOLLOW_Identifier_in_identifier204);  
            stream_Identifier.add(Identifier12);


            // AST REWRITE
            // elements: Identifier
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 100:4: -> ^( TOK_IDENTIFIER Identifier )
            {
                // org/jbehaviour/antlr/AnotherMethodGrammer.g:100:7: ^( TOK_IDENTIFIER Identifier )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(
                (CommonTree)adaptor.create(TOK_IDENTIFIER, "TOK_IDENTIFIER")
                , root_1);

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

                adaptor.addChild(root_0, root_1);
                }

            }


            retval.tree = root_0;

            }

            retval.stop = input.LT(-1);


            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
         
        catch (Exception e) { 
        //throw e; 
        } 

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "identifier"


    public static class integer_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "integer"
    // org/jbehaviour/antlr/AnotherMethodGrammer.g:103:1: integer : Number -> ^( TOK_NUMBER Number ) ;
    public final AnotherMethodGrammerParser.integer_return integer() throws RecognitionException {
        AnotherMethodGrammerParser.integer_return retval = new AnotherMethodGrammerParser.integer_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token Number13=null;

        CommonTree Number13_tree=null;
        RewriteRuleTokenStream stream_Number=new RewriteRuleTokenStream(adaptor,"token Number");

        try {
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:104:2: ( Number -> ^( TOK_NUMBER Number ) )
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:104:4: Number
            {
            Number13=(Token)match(input,Number,FOLLOW_Number_in_integer226);  
            stream_Number.add(Number13);


            // AST REWRITE
            // elements: Number
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 105:4: -> ^( TOK_NUMBER Number )
            {
                // org/jbehaviour/antlr/AnotherMethodGrammer.g:105:7: ^( TOK_NUMBER Number )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(
                (CommonTree)adaptor.create(TOK_NUMBER, "TOK_NUMBER")
                , root_1);

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

                adaptor.addChild(root_0, root_1);
                }

            }


            retval.tree = root_0;

            }

            retval.stop = input.LT(-1);


            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
         
        catch (Exception e) { 
        //throw e; 
        } 

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "integer"


    public static class reference_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "reference"
    // org/jbehaviour/antlr/AnotherMethodGrammer.g:108:1: reference : Reference ;
    public final AnotherMethodGrammerParser.reference_return reference() throws RecognitionException {
        AnotherMethodGrammerParser.reference_return retval = new AnotherMethodGrammerParser.reference_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token Reference14=null;

        CommonTree Reference14_tree=null;

        try {
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:109:2: ( Reference )
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:109:4: Reference
            {
            root_0 = (CommonTree)adaptor.nil();


            Reference14=(Token)match(input,Reference,FOLLOW_Reference_in_reference248); 
            Reference14_tree = 
            (CommonTree)adaptor.create(Reference14)
            ;
            adaptor.addChild(root_0, Reference14_tree);


            }

            retval.stop = input.LT(-1);


            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
         
        catch (Exception e) { 
        //throw e; 
        } 

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "reference"


    public static class number_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "number"
    // org/jbehaviour/antlr/AnotherMethodGrammer.g:112:1: number : n= Number {...}? ( Exponent )? -> ^( TOK_NUMBER Number ( Exponent )? ) ;
    public final AnotherMethodGrammerParser.number_return number() throws RecognitionException {
        AnotherMethodGrammerParser.number_return retval = new AnotherMethodGrammerParser.number_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token n=null;
        Token Exponent15=null;

        CommonTree n_tree=null;
        CommonTree Exponent15_tree=null;
        RewriteRuleTokenStream stream_Exponent=new RewriteRuleTokenStream(adaptor,"token Exponent");
        RewriteRuleTokenStream stream_Number=new RewriteRuleTokenStream(adaptor,"token Number");

        try {
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:112:8: (n= Number {...}? ( Exponent )? -> ^( TOK_NUMBER Number ( Exponent )? ) )
            // org/jbehaviour/antlr/AnotherMethodGrammer.g:112:10: n= Number {...}? ( Exponent )?
            {
            n=(Token)match(input,Number,FOLLOW_Number_in_number260);  
            stream_Number.add(n);


            if ( !((Pattern.matches("(0|(-?[1-9]\\d*))(\\.\\d+)?", n.getText()))) ) {
                throw new FailedPredicateException(input, "number", "Pattern.matches(\"(0|(-?[1-9]\\\\d*))(\\\\.\\\\d+)?\", n.getText())");
            }

            // org/jbehaviour/antlr/AnotherMethodGrammer.g:113:6: ( Exponent )?
            int alt4=2;
            switch ( input.LA(1) ) {
                case Exponent:
                    {
                    alt4=1;
                    }
                    break;
            }

            switch (alt4) {
                case 1 :
                    // org/jbehaviour/antlr/AnotherMethodGrammer.g:113:6: Exponent
                    {
                    Exponent15=(Token)match(input,Exponent,FOLLOW_Exponent_in_number270);  
                    stream_Exponent.add(Exponent15);


                    }
                    break;

            }


            // AST REWRITE
            // elements: Exponent, Number
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 114:4: -> ^( TOK_NUMBER Number ( Exponent )? )
            {
                // org/jbehaviour/antlr/AnotherMethodGrammer.g:114:7: ^( TOK_NUMBER Number ( Exponent )? )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(
                (CommonTree)adaptor.create(TOK_NUMBER, "TOK_NUMBER")
                , root_1);

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

                // org/jbehaviour/antlr/AnotherMethodGrammer.g:114:27: ( Exponent )?
                if ( stream_Exponent.hasNext() ) {
                    adaptor.addChild(root_1, 
                    stream_Exponent.nextNode()
                    );

                }
                stream_Exponent.reset();

                adaptor.addChild(root_0, root_1);
                }

            }


            retval.tree = root_0;

            }

            retval.stop = input.LT(-1);


            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
         
        catch (Exception e) { 
        //throw e; 
        } 

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "number"

    // Delegated rules


 

    public static final BitSet FOLLOW_Reference_in_template103 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_Dot_in_template108 = new BitSet(new long[]{0x0000000000010000L});
    public static final BitSet FOLLOW_identifier_in_template110 = new BitSet(new long[]{0x0000000000020402L});
    public static final BitSet FOLLOW_arguments_in_template114 = new BitSet(new long[]{0x0000000000000402L});
    public static final BitSet FOLLOW_LeftBrace_in_arguments151 = new BitSet(new long[]{0x0000000020680040L});
    public static final BitSet FOLLOW_number_in_arguments156 = new BitSet(new long[]{0x0000000020680040L});
    public static final BitSet FOLLOW_string_in_arguments160 = new BitSet(new long[]{0x0000000020680040L});
    public static final BitSet FOLLOW_WS_in_arguments164 = new BitSet(new long[]{0x0000000020680040L});
    public static final BitSet FOLLOW_Comma_in_arguments166 = new BitSet(new long[]{0x0000000020680040L});
    public static final BitSet FOLLOW_RightBrace_in_arguments170 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_String_in_string182 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Identifier_in_identifier204 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Number_in_integer226 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Reference_in_reference248 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Number_in_number260 = new BitSet(new long[]{0x0000000000004002L});
    public static final BitSet FOLLOW_Exponent_in_number270 = new BitSet(new long[]{0x0000000000000002L});

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy