Inheritance: Antlr.Runtime.ParserRuleReturnScope
Example #1
0
    // $ANTLR start "varorstruct"
    // C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:68:1: varorstruct returns [Element ret] : ( variable | structassign ) ;
    public spinachParser.varorstruct_return varorstruct() // throws RecognitionException [1]
    {   
        spinachParser.varorstruct_return retval = new spinachParser.varorstruct_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        spinachParser.variable_return variable17 = null;

        spinachParser.structassign_return structassign18 = null;



        try 
    	{
            // C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:69:1: ( ( variable | structassign ) )
            // C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:69:3: ( variable | structassign )
            {
            	root_0 = (object)adaptor.GetNilNode();

            	// C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:69:3: ( variable | structassign )
            	int alt7 = 2;
            	int LA7_0 = input.LA(1);

            	if ( (LA7_0 == VARIABLE) )
            	{
            	    int LA7_1 = input.LA(2);

            	    if ( (LA7_1 == DOT) )
            	    {
            	        alt7 = 2;
            	    }
            	    else if ( (LA7_1 == EOF || (LA7_1 >= VARIABLE && LA7_1 <= VARTYPE) || (LA7_1 >= END_OF_STATEMENT && LA7_1 <= STRINGTYPE) || LA7_1 == RIGHTBRACE || LA7_1 == RIGHTPARANTHESIS || (LA7_1 >= PLUS && LA7_1 <= MULTIPLY) || (LA7_1 >= EQUALITYEXPRESSION && LA7_1 <= 28) || (LA7_1 >= 31 && LA7_1 <= 37) || (LA7_1 >= 39 && LA7_1 <= 40) || (LA7_1 >= 42 && LA7_1 <= 43) || (LA7_1 >= 46 && LA7_1 <= 48) || (LA7_1 >= 52 && LA7_1 <= 56)) )
            	    {
            	        alt7 = 1;
            	    }
            	    else 
            	    {
            	        NoViableAltException nvae_d7s1 =
            	            new NoViableAltException("", 7, 1, input);

            	        throw nvae_d7s1;
            	    }
            	}
            	else 
            	{
            	    NoViableAltException nvae_d7s0 =
            	        new NoViableAltException("", 7, 0, input);

            	    throw nvae_d7s0;
            	}
            	switch (alt7) 
            	{
            	    case 1 :
            	        // C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:69:4: variable
            	        {
            	        	PushFollow(FOLLOW_variable_in_varorstruct349);
            	        	variable17 = variable();
            	        	state.followingStackPointer--;

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

            	        }
            	        break;
            	    case 2 :
            	        // C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:69:42: structassign
            	        {
            	        	PushFollow(FOLLOW_structassign_in_varorstruct352);
            	        	structassign18 = structassign();
            	        	state.followingStackPointer--;

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

            	        }
            	        break;

            	}


            }

            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;
    }
Example #2
0
    // $ANTLR start "varorstruct"
    // spinach.g:68:1: varorstruct returns [Element ret] : ( variable | matrixelem | vectorelem | structassign ) ;
    public spinachParser.varorstruct_return varorstruct() // throws RecognitionException [1]
    {   
        spinachParser.varorstruct_return retval = new spinachParser.varorstruct_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        spinachParser.variable_return variable19 = null;

        spinachParser.matrixelem_return matrixelem20 = null;

        spinachParser.vectorelem_return vectorelem21 = null;

        spinachParser.structassign_return structassign22 = null;



        try 
    	{
            // spinach.g:69:1: ( ( variable | matrixelem | vectorelem | structassign ) )
            // spinach.g:69:3: ( variable | matrixelem | vectorelem | structassign )
            {
            	root_0 = (object)adaptor.GetNilNode();

            	// spinach.g:69:3: ( variable | matrixelem | vectorelem | structassign )
            	int alt7 = 4;
            	alt7 = dfa7.Predict(input);
            	switch (alt7) 
            	{
            	    case 1 :
            	        // spinach.g:69:4: variable
            	        {
            	        	PushFollow(FOLLOW_variable_in_varorstruct351);
            	        	variable19 = variable();
            	        	state.followingStackPointer--;

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

            	        }
            	        break;
            	    case 2 :
            	        // spinach.g:70:2: matrixelem
            	        {
            	        	PushFollow(FOLLOW_matrixelem_in_varorstruct355);
            	        	matrixelem20 = matrixelem();
            	        	state.followingStackPointer--;

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

            	        }
            	        break;
            	    case 3 :
            	        // spinach.g:71:2: vectorelem
            	        {
            	        	PushFollow(FOLLOW_vectorelem_in_varorstruct359);
            	        	vectorelem21 = vectorelem();
            	        	state.followingStackPointer--;

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

            	        }
            	        break;
            	    case 4 :
            	        // spinach.g:72:2: structassign
            	        {
            	        	PushFollow(FOLLOW_structassign_in_varorstruct365);
            	        	structassign22 = structassign();
            	        	state.followingStackPointer--;

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

            	        }
            	        break;

            	}


            }

            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;
    }