Inheritance: Antlr.Runtime.ParserRuleReturnScope
示例#1
0
    // $ANTLR start "structvardec"
    // Interp.g:101:1: structvardec returns [StructVariableDeclaration ret] : ( TYPE variable ';' ) ;
    public InterpParser.structvardec_return structvardec() // throws RecognitionException [1]
    {   
        InterpParser.structvardec_return retval = new InterpParser.structvardec_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken TYPE31 = null;
        IToken char_literal33 = null;
        InterpParser.variable_return variable32 = null;


        object TYPE31_tree=null;
        object char_literal33_tree=null;


        	retval.ret = new StructVariableDeclaration();
        	
        try 
    	{
            // Interp.g:105:2: ( ( TYPE variable ';' ) )
            // Interp.g:105:3: ( TYPE variable ';' )
            {
            	root_0 = (object)adaptor.GetNilNode();

            	// Interp.g:105:3: ( TYPE variable ';' )
            	// Interp.g:105:4: TYPE variable ';'
            	{
            		TYPE31=(IToken)Match(input,TYPE,FOLLOW_TYPE_in_structvardec487); 
            			TYPE31_tree = (object)adaptor.Create(TYPE31);
            			adaptor.AddChild(root_0, TYPE31_tree);

            		 retval.ret.setType(((TYPE31 != null) ? TYPE31.Text : null));
            		PushFollow(FOLLOW_variable_in_structvardec493);
            		variable32 = variable();
            		state.followingStackPointer--;

            		adaptor.AddChild(root_0, variable32.Tree);
            		 retval.ret.setVar(((variable32 != null) ? variable32.ret : null));
            		char_literal33=(IToken)Match(input,END_OF_STATEMENT,FOLLOW_END_OF_STATEMENT_in_structvardec496); 
            			char_literal33_tree = (object)adaptor.Create(char_literal33);
            			adaptor.AddChild(root_0, char_literal33_tree);


            	}


            }

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

            	retval.Tree = (object)adaptor.RulePostProcessing(root_0);
            	adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);
        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
    	// Conversion of the second argument necessary, but harmless
    	retval.Tree = (object)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re);

        }
        finally 
    	{
        }
        return retval;
    }
示例#2
0
    // $ANTLR start "structvardec"
    // C:\\Documents and Settings\\Administrator\\Desktop\\SPINA\\Interp_CSharp\\Interp_CSharp\\Interp.g:101:1: structvardec returns [StructVariableDeclaration ret] : ( TYPE WHITESPACE variable ';' ) ;
    public InterpParser.structvardec_return structvardec() // throws RecognitionException [1]
    {   
        InterpParser.structvardec_return retval = new InterpParser.structvardec_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken TYPE31 = null;
        IToken WHITESPACE32 = null;
        IToken char_literal34 = null;
        InterpParser.variable_return variable33 = null;


        object TYPE31_tree=null;
        object WHITESPACE32_tree=null;
        object char_literal34_tree=null;


        	retval.ret = new StructVariableDeclaration();
        	
        try {
        	dbg.EnterRule(GrammarFileName, "structvardec");
        	if ( RuleLevel==0 ) {dbg.Commence();}
        	IncRuleLevel();
        	dbg.Location(101, 1);

        try 
    	{
            // C:\\Documents and Settings\\Administrator\\Desktop\\SPINA\\Interp_CSharp\\Interp_CSharp\\Interp.g:105:2: ( ( TYPE WHITESPACE variable ';' ) )
            dbg.EnterAlt(1);

            // C:\\Documents and Settings\\Administrator\\Desktop\\SPINA\\Interp_CSharp\\Interp_CSharp\\Interp.g:105:3: ( TYPE WHITESPACE variable ';' )
            {
            	root_0 = (object)adaptor.GetNilNode();

            	dbg.Location(105,3);
            	// C:\\Documents and Settings\\Administrator\\Desktop\\SPINA\\Interp_CSharp\\Interp_CSharp\\Interp.g:105:3: ( TYPE WHITESPACE variable ';' )
            	dbg.EnterAlt(1);

            	// C:\\Documents and Settings\\Administrator\\Desktop\\SPINA\\Interp_CSharp\\Interp_CSharp\\Interp.g:105:4: TYPE WHITESPACE variable ';'
            	{
            		dbg.Location(105,4);
            		TYPE31=(IToken)Match(input,TYPE,FOLLOW_TYPE_in_structvardec487); 
            			TYPE31_tree = (object)adaptor.Create(TYPE31);
            			adaptor.AddChild(root_0, TYPE31_tree);

            		dbg.Location(105,9);
            		 retval.ret.setType(((TYPE31 != null) ? TYPE31.Text : null));
            		dbg.Location(106,2);
            		WHITESPACE32=(IToken)Match(input,WHITESPACE,FOLLOW_WHITESPACE_in_structvardec493); 
            			WHITESPACE32_tree = (object)adaptor.Create(WHITESPACE32);
            			adaptor.AddChild(root_0, WHITESPACE32_tree);

            		dbg.Location(106,13);
            		PushFollow(FOLLOW_variable_in_structvardec495);
            		variable33 = variable();
            		state.followingStackPointer--;

            		adaptor.AddChild(root_0, variable33.Tree);
            		dbg.Location(106,22);
            		 retval.ret.setVar(((variable33 != null) ? variable33.ret : null));
            		dbg.Location(106,58);
            		char_literal34=(IToken)Match(input,END_OF_STATEMENT,FOLLOW_END_OF_STATEMENT_in_structvardec498); 
            			char_literal34_tree = (object)adaptor.Create(char_literal34);
            			adaptor.AddChild(root_0, char_literal34_tree);


            	}


            }

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

            	retval.Tree = (object)adaptor.RulePostProcessing(root_0);
            	adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);
        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
    	// Conversion of the second argument necessary, but harmless
    	retval.Tree = (object)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re);

        }
        finally 
    	{
        }
        dbg.Location(106, 62);

        }
        finally {
            dbg.ExitRule(GrammarFileName, "structvardec");
            DecRuleLevel();
            if ( RuleLevel==0 ) {dbg.Terminate();}
        }

        return retval;
    }