Inheritance: Antlr.Runtime.ParserRuleReturnScope
Ejemplo n.º 1
0
    // $ANTLR start "multiplication"
    // Interp.g:85:1: multiplication returns [MultiplicationOperationElement ret] : el1= var_or_int_literal '*' el2= var_or_int_literal ;
    public InterpParser.multiplication_return multiplication() // throws RecognitionException [1]
    {   
        InterpParser.multiplication_return retval = new InterpParser.multiplication_return();
        retval.Start = input.LT(1);

        object root_0 = null;

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

        InterpParser.var_or_int_literal_return el2 = null;


        object char_literal25_tree=null;


          retval.ret = new MultiplicationOperationElement();

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

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

            	adaptor.AddChild(root_0, el1.Tree);
            	 retval.ret.setLhs(((el1 != null) ? el1.ret : null)); 
            	char_literal25=(IToken)Match(input,MULTIPLY,FOLLOW_MULTIPLY_in_multiplication408); 
            		char_literal25_tree = (object)adaptor.Create(char_literal25);
            		adaptor.AddChild(root_0, char_literal25_tree);

            	PushFollow(FOLLOW_var_or_int_literal_in_multiplication417);
            	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;
    }
Ejemplo n.º 2
0
    // $ANTLR start "multiplication"
    // C:\\Documents and Settings\\Administrator\\Desktop\\SPINA\\Interp_CSharp\\Interp_CSharp\\Interp.g:85:1: multiplication returns [MultiplicationOperationElement ret] : el1= var_or_int_literal '*' el2= var_or_int_literal ;
    public InterpParser.multiplication_return multiplication() // throws RecognitionException [1]
    {   
        InterpParser.multiplication_return retval = new InterpParser.multiplication_return();
        retval.Start = input.LT(1);

        object root_0 = null;

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

        InterpParser.var_or_int_literal_return el2 = null;


        object char_literal25_tree=null;


          retval.ret = new MultiplicationOperationElement();

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

        try 
    	{
            // C:\\Documents and Settings\\Administrator\\Desktop\\SPINA\\Interp_CSharp\\Interp_CSharp\\Interp.g:89:3: (el1= var_or_int_literal '*' el2= var_or_int_literal )
            dbg.EnterAlt(1);

            // C:\\Documents and Settings\\Administrator\\Desktop\\SPINA\\Interp_CSharp\\Interp_CSharp\\Interp.g:89:5: el1= var_or_int_literal '*' el2= var_or_int_literal
            {
            	root_0 = (object)adaptor.GetNilNode();

            	dbg.Location(89,8);
            	PushFollow(FOLLOW_var_or_int_literal_in_multiplication399);
            	el1 = var_or_int_literal();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, el1.Tree);
            	dbg.Location(89,28);
            	 retval.ret.setLhs(((el1 != null) ? el1.ret : null)); 
            	dbg.Location(90,5);
            	char_literal25=(IToken)Match(input,MULTIPLY,FOLLOW_MULTIPLY_in_multiplication408); 
            		char_literal25_tree = (object)adaptor.Create(char_literal25);
            		adaptor.AddChild(root_0, char_literal25_tree);

            	dbg.Location(91,8);
            	PushFollow(FOLLOW_var_or_int_literal_in_multiplication417);
            	el2 = var_or_int_literal();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, el2.Tree);
            	dbg.Location(91,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(91, 60);

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

        return retval;
    }