Inheritance: Antlr.Runtime.ParserRuleReturnScope
Beispiel #1
0
    // $ANTLR start "addition"
    // H:\\Interp_CSharp\\Interp_CSharp\\Interp_CSharp\\Interp.g:115:1: addition returns [AdditionOperationElement ret] : el1= var_or_int_literal '+' el2= var_or_int_literal ;
    public InterpParser.addition_return addition() // throws RecognitionException [1]
    {   
        InterpParser.addition_return retval = new InterpParser.addition_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken char_literal13 = null;
        InterpParser.var_or_int_literal_return el1 = null;

        InterpParser.var_or_int_literal_return el2 = null;


        object char_literal13_tree=null;


          retval.ret = new AdditionOperationElement();

        try {
        	dbg.EnterRule(GrammarFileName, "addition");
        	if ( RuleLevel==0 ) {dbg.Commence();}
        	IncRuleLevel();
        	dbg.Location(115, 1);

        try 
    	{
            // H:\\Interp_CSharp\\Interp_CSharp\\Interp_CSharp\\Interp.g:123:3: (el1= var_or_int_literal '+' el2= var_or_int_literal )
            dbg.EnterAlt(1);

            // H:\\Interp_CSharp\\Interp_CSharp\\Interp_CSharp\\Interp.g:123:5: el1= var_or_int_literal '+' el2= var_or_int_literal
            {
            	root_0 = (object)adaptor.GetNilNode();

            	dbg.Location(123,8);
            	PushFollow(FOLLOW_var_or_int_literal_in_addition315);
            	el1 = var_or_int_literal();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, el1.Tree);
            	dbg.Location(123,28);
            	 retval.ret.setLhs(((el1 != null) ? el1.ret : null)); 
            	dbg.Location(125,3);
            	char_literal13=(IToken)Match(input,PLUS,FOLLOW_PLUS_in_addition327); 
            		char_literal13_tree = (object)adaptor.Create(char_literal13);
            		adaptor.AddChild(root_0, char_literal13_tree);

            	dbg.Location(127,8);
            	PushFollow(FOLLOW_var_or_int_literal_in_addition341);
            	el2 = var_or_int_literal();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, el2.Tree);
            	dbg.Location(127,28);
            	 retval.ret.setRhs(((el2 != null) ? el2.ret : null)); 

            }

            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(127, 60);

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

        return retval;
    }
Beispiel #2
0
    // $ANTLR start "addition"
    // Interp.g:77:1: addition returns [AdditionOperationElement ret] : el1= var_or_int_literal '+' el2= var_or_int_literal ;
    public InterpParser.addition_return addition() // throws RecognitionException [1]
    {   
        InterpParser.addition_return retval = new InterpParser.addition_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken char_literal24 = null;
        InterpParser.var_or_int_literal_return el1 = null;

        InterpParser.var_or_int_literal_return el2 = null;


        object char_literal24_tree=null;


          retval.ret = new AdditionOperationElement();

        try 
    	{
            // Interp.g:81:3: (el1= var_or_int_literal '+' el2= var_or_int_literal )
            // Interp.g:81:5: el1= var_or_int_literal '+' el2= var_or_int_literal
            {
            	root_0 = (object)adaptor.GetNilNode();

            	PushFollow(FOLLOW_var_or_int_literal_in_addition354);
            	el1 = var_or_int_literal();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, el1.Tree);
            	 retval.ret.setLhs(((el1 != null) ? el1.ret : null)); 
            	char_literal24=(IToken)Match(input,PLUS,FOLLOW_PLUS_in_addition363); 
            		char_literal24_tree = (object)adaptor.Create(char_literal24);
            		adaptor.AddChild(root_0, char_literal24_tree);

            	PushFollow(FOLLOW_var_or_int_literal_in_addition372);
            	el2 = var_or_int_literal();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, el2.Tree);
            	 retval.ret.setRhs(((el2 != null) ? el2.ret : null)); 

            }

            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;
    }
Beispiel #3
0
    // throws RecognitionException [1]
    // $ANTLR start "addition"
    // Interp.g:114:1: addition returns [AdditionOperationElement ret] : el1= var_or_int_literal '+' el2= var_or_int_literal ;
    public InterpParser.addition_return addition()
    {
        InterpParser.addition_return retval = new InterpParser.addition_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken char_literal22 = null;
        InterpParser.var_or_int_literal_return el1 = null;

        InterpParser.var_or_int_literal_return el2 = null;

        object char_literal22_tree=null;

          retval.ret = new AdditionOperationElement();

        try
        {
            // Interp.g:118:3: (el1= var_or_int_literal '+' el2= var_or_int_literal )
            // Interp.g:118:5: el1= var_or_int_literal '+' el2= var_or_int_literal
            {
                root_0 = (object)adaptor.GetNilNode();

                PushFollow(FOLLOW_var_or_int_literal_in_addition427);
                el1 = var_or_int_literal();
                state.followingStackPointer--;

                adaptor.AddChild(root_0, el1.Tree);
                 retval.ret.setLhs(((el1 != null) ? el1.ret : null));
                char_literal22=(IToken)Match(input,PLUS,FOLLOW_PLUS_in_addition436);
                    char_literal22_tree = (object)adaptor.Create(char_literal22);
                    adaptor.AddChild(root_0, char_literal22_tree);

                PushFollow(FOLLOW_var_or_int_literal_in_addition445);
                el2 = var_or_int_literal();
                state.followingStackPointer--;

                adaptor.AddChild(root_0, el2.Tree);
                 retval.ret.setRhs(((el2 != null) ? el2.ret : null));

            }

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

                retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);
        }

            catch (RecognitionException e) {
                throw e;
            }
        finally
        {
        }
        return retval;
    }