Inheritance: Antlr.Runtime.ParserRuleReturnScope
Beispiel #1
0
    // $ANTLR start "scalarvardec"
    // C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:203:1: scalarvardec returns [ScalarVariableDeclaration ret] : ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT ;
    public spinachParser.scalarvardec_return scalarvardec() // throws RecognitionException [1]
    {   
        spinachParser.scalarvardec_return retval = new spinachParser.scalarvardec_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken VARTYPE84 = null;
        IToken STRINGTYPE85 = null;
        IToken END_OF_STATEMENT87 = null;
        spinachParser.variable_return variable86 = null;


        object VARTYPE84_tree=null;
        object STRINGTYPE85_tree=null;
        object END_OF_STATEMENT87_tree=null;


        	retval.ret = new ScalarVariableDeclaration();
        	
        try 
    	{
            // C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:207:2: ( ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT )
            // C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:207:3: ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT
            {
            	root_0 = (object)adaptor.GetNilNode();

            	// C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:207:3: ( ( VARTYPE | STRINGTYPE ) variable )
            	// C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:207:4: ( VARTYPE | STRINGTYPE ) variable
            	{
            		// C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:207:4: ( VARTYPE | STRINGTYPE )
            		int alt27 = 2;
            		int LA27_0 = input.LA(1);

            		if ( (LA27_0 == VARTYPE) )
            		{
            		    alt27 = 1;
            		}
            		else if ( (LA27_0 == STRINGTYPE) )
            		{
            		    alt27 = 2;
            		}
            		else 
            		{
            		    NoViableAltException nvae_d27s0 =
            		        new NoViableAltException("", 27, 0, input);

            		    throw nvae_d27s0;
            		}
            		switch (alt27) 
            		{
            		    case 1 :
            		        // C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:207:5: VARTYPE
            		        {
            		        	VARTYPE84=(IToken)Match(input,VARTYPE,FOLLOW_VARTYPE_in_scalarvardec1184); 
            		        		VARTYPE84_tree = (object)adaptor.Create(VARTYPE84);
            		        		adaptor.AddChild(root_0, VARTYPE84_tree);

            		        	 retval.ret.setType(((VARTYPE84 != null) ? VARTYPE84.Text : null));

            		        }
            		        break;
            		    case 2 :
            		        // C:\\Documents and Settings\\Administrator\\Desktop\\Spinach\\InterpreterFrontEnd\\spinach.g:208:4: STRINGTYPE
            		        {
            		        	STRINGTYPE85=(IToken)Match(input,STRINGTYPE,FOLLOW_STRINGTYPE_in_scalarvardec1191); 
            		        		STRINGTYPE85_tree = (object)adaptor.Create(STRINGTYPE85);
            		        		adaptor.AddChild(root_0, STRINGTYPE85_tree);

            		        	 retval.ret.setType(((STRINGTYPE85 != null) ? STRINGTYPE85.Text : null));

            		        }
            		        break;

            		}

            		PushFollow(FOLLOW_variable_in_scalarvardec1198);
            		variable86 = variable();
            		state.followingStackPointer--;

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

            	}

            	END_OF_STATEMENT87=(IToken)Match(input,END_OF_STATEMENT,FOLLOW_END_OF_STATEMENT_in_scalarvardec1202); 
            		END_OF_STATEMENT87_tree = (object)adaptor.Create(END_OF_STATEMENT87);
            		adaptor.AddChild(root_0, END_OF_STATEMENT87_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;
    }
Beispiel #2
0
    // throws RecognitionException [1]
    // $ANTLR start "scalarvardec"
    // C:\\Users\\Jegan\\Documents\\MSCE\\FALL 09\\SoftwareStudio\\SPINACH-Srinivasan\\ConsoleApplication1\\ConsoleApplication1\\spinach.g:123:1: scalarvardec returns [ScalarVariableDeclaration ret] : ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT ;
    public spinachParser.scalarvardec_return scalarvardec()
    {
        spinachParser.scalarvardec_return retval = new spinachParser.scalarvardec_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken VARTYPE63 = null;
        IToken STRINGTYPE64 = null;
        IToken END_OF_STATEMENT66 = null;
        spinachParser.variable_return variable65 = null;

        object VARTYPE63_tree=null;
        object STRINGTYPE64_tree=null;
        object END_OF_STATEMENT66_tree=null;

            retval.ret = new ScalarVariableDeclaration();

        try
        {
            // C:\\Users\\Jegan\\Documents\\MSCE\\FALL 09\\SoftwareStudio\\SPINACH-Srinivasan\\ConsoleApplication1\\ConsoleApplication1\\spinach.g:127:2: ( ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT )
            // C:\\Users\\Jegan\\Documents\\MSCE\\FALL 09\\SoftwareStudio\\SPINACH-Srinivasan\\ConsoleApplication1\\ConsoleApplication1\\spinach.g:127:3: ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT
            {
                root_0 = (object)adaptor.GetNilNode();

                // C:\\Users\\Jegan\\Documents\\MSCE\\FALL 09\\SoftwareStudio\\SPINACH-Srinivasan\\ConsoleApplication1\\ConsoleApplication1\\spinach.g:127:3: ( ( VARTYPE | STRINGTYPE ) variable )
                // C:\\Users\\Jegan\\Documents\\MSCE\\FALL 09\\SoftwareStudio\\SPINACH-Srinivasan\\ConsoleApplication1\\ConsoleApplication1\\spinach.g:127:4: ( VARTYPE | STRINGTYPE ) variable
                {
                    // C:\\Users\\Jegan\\Documents\\MSCE\\FALL 09\\SoftwareStudio\\SPINACH-Srinivasan\\ConsoleApplication1\\ConsoleApplication1\\spinach.g:127:4: ( VARTYPE | STRINGTYPE )
                    int alt12 = 2;
                    int LA12_0 = input.LA(1);

                    if ( (LA12_0 == VARTYPE) )
                    {
                        alt12 = 1;
                    }
                    else if ( (LA12_0 == STRINGTYPE) )
                    {
                        alt12 = 2;
                    }
                    else
                    {
                        NoViableAltException nvae_d12s0 =
                            new NoViableAltException("", 12, 0, input);

                        throw nvae_d12s0;
                    }
                    switch (alt12)
                    {
                        case 1 :
                            // C:\\Users\\Jegan\\Documents\\MSCE\\FALL 09\\SoftwareStudio\\SPINACH-Srinivasan\\ConsoleApplication1\\ConsoleApplication1\\spinach.g:127:5: VARTYPE
                            {
                                VARTYPE63=(IToken)Match(input,VARTYPE,FOLLOW_VARTYPE_in_scalarvardec697);
                                    VARTYPE63_tree = (object)adaptor.Create(VARTYPE63);
                                    adaptor.AddChild(root_0, VARTYPE63_tree);

                                 retval.ret.setType(((VARTYPE63 != null) ? VARTYPE63.Text : null));

                            }
                            break;
                        case 2 :
                            // C:\\Users\\Jegan\\Documents\\MSCE\\FALL 09\\SoftwareStudio\\SPINACH-Srinivasan\\ConsoleApplication1\\ConsoleApplication1\\spinach.g:128:4: STRINGTYPE
                            {
                                STRINGTYPE64=(IToken)Match(input,STRINGTYPE,FOLLOW_STRINGTYPE_in_scalarvardec704);
                                    STRINGTYPE64_tree = (object)adaptor.Create(STRINGTYPE64);
                                    adaptor.AddChild(root_0, STRINGTYPE64_tree);

                                 retval.ret.setType(((STRINGTYPE64 != null) ? STRINGTYPE64.Text : null));

                            }
                            break;

                    }

                    PushFollow(FOLLOW_variable_in_scalarvardec711);
                    variable65 = variable();
                    state.followingStackPointer--;

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

                }

                END_OF_STATEMENT66=(IToken)Match(input,END_OF_STATEMENT,FOLLOW_END_OF_STATEMENT_in_scalarvardec715);
                    END_OF_STATEMENT66_tree = (object)adaptor.Create(END_OF_STATEMENT66);
                    adaptor.AddChild(root_0, END_OF_STATEMENT66_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;
    }
Beispiel #3
0
    // $ANTLR start "scalarvardec"
    // spinach.g:180:1: scalarvardec returns [ScalarVariableDeclaration ret] : ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT ;
    public spinachParser.scalarvardec_return scalarvardec() // throws RecognitionException [1]
    {   
        spinachParser.scalarvardec_return retval = new spinachParser.scalarvardec_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken VARTYPE68 = null;
        IToken STRINGTYPE69 = null;
        IToken END_OF_STATEMENT71 = null;
        spinachParser.variable_return variable70 = null;


        object VARTYPE68_tree=null;
        object STRINGTYPE69_tree=null;
        object END_OF_STATEMENT71_tree=null;


        	retval.ret = new ScalarVariableDeclaration();
        	
        try 
    	{
            // spinach.g:184:2: ( ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT )
            // spinach.g:184:3: ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT
            {
            	root_0 = (object)adaptor.GetNilNode();

            	// spinach.g:184:3: ( ( VARTYPE | STRINGTYPE ) variable )
            	// spinach.g:184:4: ( VARTYPE | STRINGTYPE ) variable
            	{
            		// spinach.g:184:4: ( VARTYPE | STRINGTYPE )
            		int alt21 = 2;
            		int LA21_0 = input.LA(1);

            		if ( (LA21_0 == VARTYPE) )
            		{
            		    alt21 = 1;
            		}
            		else if ( (LA21_0 == STRINGTYPE) )
            		{
            		    alt21 = 2;
            		}
            		else 
            		{
            		    NoViableAltException nvae_d21s0 =
            		        new NoViableAltException("", 21, 0, input);

            		    throw nvae_d21s0;
            		}
            		switch (alt21) 
            		{
            		    case 1 :
            		        // spinach.g:184:5: VARTYPE
            		        {
            		        	VARTYPE68=(IToken)Match(input,VARTYPE,FOLLOW_VARTYPE_in_scalarvardec1091); 
            		        		VARTYPE68_tree = (object)adaptor.Create(VARTYPE68);
            		        		adaptor.AddChild(root_0, VARTYPE68_tree);

            		        	 retval.ret.setType(((VARTYPE68 != null) ? VARTYPE68.Text : null));

            		        }
            		        break;
            		    case 2 :
            		        // spinach.g:185:4: STRINGTYPE
            		        {
            		        	STRINGTYPE69=(IToken)Match(input,STRINGTYPE,FOLLOW_STRINGTYPE_in_scalarvardec1098); 
            		        		STRINGTYPE69_tree = (object)adaptor.Create(STRINGTYPE69);
            		        		adaptor.AddChild(root_0, STRINGTYPE69_tree);

            		        	 retval.ret.setType(((STRINGTYPE69 != null) ? STRINGTYPE69.Text : null));

            		        }
            		        break;

            		}

            		PushFollow(FOLLOW_variable_in_scalarvardec1105);
            		variable70 = variable();
            		state.followingStackPointer--;

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

            	}

            	END_OF_STATEMENT71=(IToken)Match(input,END_OF_STATEMENT,FOLLOW_END_OF_STATEMENT_in_scalarvardec1109); 
            		END_OF_STATEMENT71_tree = (object)adaptor.Create(END_OF_STATEMENT71);
            		adaptor.AddChild(root_0, END_OF_STATEMENT71_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;
    }
Beispiel #4
0
    // $ANTLR start "scalarvardec"
    // C:\\Users\\KULDEEP GANDHI\\Desktop\\pinac\\Spinach\\InterpreterFrontEnd\\spinach.g:194:1: scalarvardec returns [ScalarVariableDeclaration ret] : ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT ;
    public spinachParser.scalarvardec_return scalarvardec() // throws RecognitionException [1]
    {   
        spinachParser.scalarvardec_return retval = new spinachParser.scalarvardec_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken VARTYPE76 = null;
        IToken STRINGTYPE77 = null;
        IToken END_OF_STATEMENT79 = null;
        spinachParser.variable_return variable78 = null;


        object VARTYPE76_tree=null;
        object STRINGTYPE77_tree=null;
        object END_OF_STATEMENT79_tree=null;


        	retval.ret = new ScalarVariableDeclaration();
        	
        try 
    	{
            // C:\\Users\\KULDEEP GANDHI\\Desktop\\pinac\\Spinach\\InterpreterFrontEnd\\spinach.g:198:2: ( ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT )
            // C:\\Users\\KULDEEP GANDHI\\Desktop\\pinac\\Spinach\\InterpreterFrontEnd\\spinach.g:198:3: ( ( VARTYPE | STRINGTYPE ) variable ) END_OF_STATEMENT
            {
            	root_0 = (object)adaptor.GetNilNode();

            	// C:\\Users\\KULDEEP GANDHI\\Desktop\\pinac\\Spinach\\InterpreterFrontEnd\\spinach.g:198:3: ( ( VARTYPE | STRINGTYPE ) variable )
            	// C:\\Users\\KULDEEP GANDHI\\Desktop\\pinac\\Spinach\\InterpreterFrontEnd\\spinach.g:198:4: ( VARTYPE | STRINGTYPE ) variable
            	{
            		// C:\\Users\\KULDEEP GANDHI\\Desktop\\pinac\\Spinach\\InterpreterFrontEnd\\spinach.g:198:4: ( VARTYPE | STRINGTYPE )
            		int alt25 = 2;
            		int LA25_0 = input.LA(1);

            		if ( (LA25_0 == VARTYPE) )
            		{
            		    alt25 = 1;
            		}
            		else if ( (LA25_0 == STRINGTYPE) )
            		{
            		    alt25 = 2;
            		}
            		else 
            		{
            		    NoViableAltException nvae_d25s0 =
            		        new NoViableAltException("", 25, 0, input);

            		    throw nvae_d25s0;
            		}
            		switch (alt25) 
            		{
            		    case 1 :
            		        // C:\\Users\\KULDEEP GANDHI\\Desktop\\pinac\\Spinach\\InterpreterFrontEnd\\spinach.g:198:5: VARTYPE
            		        {
            		        	VARTYPE76=(IToken)Match(input,VARTYPE,FOLLOW_VARTYPE_in_scalarvardec1123); 
            		        		VARTYPE76_tree = (object)adaptor.Create(VARTYPE76);
            		        		adaptor.AddChild(root_0, VARTYPE76_tree);

            		        	 retval.ret.setType(((VARTYPE76 != null) ? VARTYPE76.Text : null));

            		        }
            		        break;
            		    case 2 :
            		        // C:\\Users\\KULDEEP GANDHI\\Desktop\\pinac\\Spinach\\InterpreterFrontEnd\\spinach.g:199:4: STRINGTYPE
            		        {
            		        	STRINGTYPE77=(IToken)Match(input,STRINGTYPE,FOLLOW_STRINGTYPE_in_scalarvardec1130); 
            		        		STRINGTYPE77_tree = (object)adaptor.Create(STRINGTYPE77);
            		        		adaptor.AddChild(root_0, STRINGTYPE77_tree);

            		        	 retval.ret.setType(((STRINGTYPE77 != null) ? STRINGTYPE77.Text : null));

            		        }
            		        break;

            		}

            		PushFollow(FOLLOW_variable_in_scalarvardec1137);
            		variable78 = variable();
            		state.followingStackPointer--;

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

            	}

            	END_OF_STATEMENT79=(IToken)Match(input,END_OF_STATEMENT,FOLLOW_END_OF_STATEMENT_in_scalarvardec1141); 
            		END_OF_STATEMENT79_tree = (object)adaptor.Create(END_OF_STATEMENT79);
            		adaptor.AddChild(root_0, END_OF_STATEMENT79_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;
    }