Наследование: Antlr.Runtime.ParserRuleReturnScope
Пример #1
0
    // $ANTLR start "nonequality"
    // spinach.g:273:1: nonequality returns [NonEqualityOperationElement ret] : e11= variable NONEQUALITYEXPRESSION var_int_or_double_literal ;
    public spinachParser.nonequality_return nonequality() // throws RecognitionException [1]
    {   
        spinachParser.nonequality_return retval = new spinachParser.nonequality_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken NONEQUALITYEXPRESSION114 = null;
        spinachParser.variable_return e11 = null;

        spinachParser.var_int_or_double_literal_return var_int_or_double_literal115 = null;


        object NONEQUALITYEXPRESSION114_tree=null;


          retval.ret = new NonEqualityOperationElement();

        try 
    	{
            // spinach.g:279:1: (e11= variable NONEQUALITYEXPRESSION var_int_or_double_literal )
            // spinach.g:279:3: e11= variable NONEQUALITYEXPRESSION var_int_or_double_literal
            {
            	root_0 = (object)adaptor.GetNilNode();

            	PushFollow(FOLLOW_variable_in_nonequality1609);
            	e11 = variable();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, e11.Tree);
            	retval.ret.setnonequalityLhs(((e11 != null) ? e11.ret : null)); 
            	NONEQUALITYEXPRESSION114=(IToken)Match(input,NONEQUALITYEXPRESSION,FOLLOW_NONEQUALITYEXPRESSION_in_nonequality1618); 
            		NONEQUALITYEXPRESSION114_tree = (object)adaptor.Create(NONEQUALITYEXPRESSION114);
            		adaptor.AddChild(root_0, NONEQUALITYEXPRESSION114_tree);

            	PushFollow(FOLLOW_var_int_or_double_literal_in_nonequality1623);
            	var_int_or_double_literal115 = var_int_or_double_literal();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, var_int_or_double_literal115.Tree);
            	retval.ret.setnonequalityRhs(((var_int_or_double_literal115 != null) ? var_int_or_double_literal115.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;
    }
Пример #2
0
    // throws RecognitionException [1]
    // $ANTLR start "nonequality"
    // C:\\Users\\Jegan\\Documents\\MSCE\\FALL 09\\SoftwareStudio\\SPINACH-Srinivasan\\ConsoleApplication1\\ConsoleApplication1\\spinach.g:209:1: nonequality returns [NonEqualityOperationElement ret] : variable NONEQUALITYEXPRESSION var_int_or_double_literal ;
    public spinachParser.nonequality_return nonequality()
    {
        spinachParser.nonequality_return retval = new spinachParser.nonequality_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken NONEQUALITYEXPRESSION105 = null;
        spinachParser.variable_return variable104 = null;

        spinachParser.var_int_or_double_literal_return var_int_or_double_literal106 = null;

        object NONEQUALITYEXPRESSION105_tree=null;

          retval.ret = new NonEqualityOperationElement();

        try
        {
            // C:\\Users\\Jegan\\Documents\\MSCE\\FALL 09\\SoftwareStudio\\SPINACH-Srinivasan\\ConsoleApplication1\\ConsoleApplication1\\spinach.g:215:1: ( variable NONEQUALITYEXPRESSION var_int_or_double_literal )
            // C:\\Users\\Jegan\\Documents\\MSCE\\FALL 09\\SoftwareStudio\\SPINACH-Srinivasan\\ConsoleApplication1\\ConsoleApplication1\\spinach.g:215:3: variable NONEQUALITYEXPRESSION var_int_or_double_literal
            {
                root_0 = (object)adaptor.GetNilNode();

                PushFollow(FOLLOW_variable_in_nonequality1168);
                variable104 = variable();
                state.followingStackPointer--;

                adaptor.AddChild(root_0, variable104.Tree);
                retval.ret.setnonequalityLhs(((variable104 != null) ? variable104.ret : null));
                NONEQUALITYEXPRESSION105=(IToken)Match(input,NONEQUALITYEXPRESSION,FOLLOW_NONEQUALITYEXPRESSION_in_nonequality1177);
                    NONEQUALITYEXPRESSION105_tree = (object)adaptor.Create(NONEQUALITYEXPRESSION105);
                    adaptor.AddChild(root_0, NONEQUALITYEXPRESSION105_tree);

                PushFollow(FOLLOW_var_int_or_double_literal_in_nonequality1182);
                var_int_or_double_literal106 = var_int_or_double_literal();
                state.followingStackPointer--;

                adaptor.AddChild(root_0, var_int_or_double_literal106.Tree);
                retval.ret.setnonequalityRhs(((var_int_or_double_literal106 != null) ? var_int_or_double_literal106.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;
    }