Exemple #1
0
    // $ANTLR end "variableDeclaration"


    // $ANTLR start "variableAssignment"
    // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:224:1: variableAssignment returns [SGLNode node] : ^( ASSIGN variableName expression ) ;
    public SGLNode variableAssignment() // throws RecognitionException [1]
    {   
        SGLNode node = default(SGLNode);

        String variableName36 = default(String);

        SGLNode expression37 = default(SGLNode);


        try 
    	{
            // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:225:2: ( ^( ASSIGN variableName expression ) )
            // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:225:4: ^( ASSIGN variableName expression )
            {
            	Match(input,ASSIGN,FOLLOW_ASSIGN_in_variableAssignment680); 

            	Match(input, Token.DOWN, null); 
            	PushFollow(FOLLOW_variableName_in_variableAssignment682);
            	variableName36 = variableName();
            	state.followingStackPointer--;

            	PushFollow(FOLLOW_expression_in_variableAssignment684);
            	expression37 = expression();
            	state.followingStackPointer--;


            	Match(input, Token.UP, null); 
            	 node = new AssignVariableNode(variableName36,expression37, spriteObjects, currentScope); 

            }

        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return node;
    }
Exemple #2
0
    // $ANTLR end "variable"


    // $ANTLR start "assignment"
    // D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:246:1: assignment returns [SGLNode node] : ( ^( ASSIGN variable ( indexes )? ( expression )? ) | ^( GLOBAL_ASSIGN variable ( indexes )? ( expression )? ) );
    public SGLNode assignment() // throws RecognitionException [1]
    {   
        SGLNode node = default(SGLNode);

        String variable29 = default(String);

        List<SGLNode> indexes30 = default(List<SGLNode>);

        SGLNode expression31 = default(SGLNode);

        String variable32 = default(String);

        List<SGLNode> indexes33 = default(List<SGLNode>);

        SGLNode expression34 = default(SGLNode);


        try 
    	{
            // D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:247:2: ( ^( ASSIGN variable ( indexes )? ( expression )? ) | ^( GLOBAL_ASSIGN variable ( indexes )? ( expression )? ) )
            int alt18 = 2;
            int LA18_0 = input.LA(1);

            if ( (LA18_0 == ASSIGN) )
            {
                alt18 = 1;
            }
            else if ( (LA18_0 == GLOBAL_ASSIGN) )
            {
                alt18 = 2;
            }
            else 
            {
                NoViableAltException nvae_d18s0 =
                    new NoViableAltException("", 18, 0, input);

                throw nvae_d18s0;
            }
            switch (alt18) 
            {
                case 1 :
                    // D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:247:4: ^( ASSIGN variable ( indexes )? ( expression )? )
                    {
                    	Match(input,ASSIGN,FOLLOW_ASSIGN_in_assignment692); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_variable_in_assignment694);
                    	variable29 = variable();
                    	state.followingStackPointer--;

                    	// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:247:22: ( indexes )?
                    	int alt14 = 2;
                    	int LA14_0 = input.LA(1);

                    	if ( (LA14_0 == INDEXES) )
                    	{
                    	    alt14 = 1;
                    	}
                    	switch (alt14) 
                    	{
                    	    case 1 :
                    	        // D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:247:22: indexes
                    	        {
                    	        	PushFollow(FOLLOW_indexes_in_assignment696);
                    	        	indexes30 = indexes();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:247:31: ( expression )?
                    	int alt15 = 2;
                    	int LA15_0 = input.LA(1);

                    	if ( ((LA15_0 >= STRING && LA15_0 <= VARDEC) || LA15_0 == LOOKUP || (LA15_0 >= IntAtom && LA15_0 <= LoopTypeAtom) || (LA15_0 >= Null && LA15_0 <= List) || LA15_0 == 63 || (LA15_0 >= 65 && LA15_0 <= 78)) )
                    	{
                    	    alt15 = 1;
                    	}
                    	switch (alt15) 
                    	{
                    	    case 1 :
                    	        // D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:247:31: expression
                    	        {
                    	        	PushFollow(FOLLOW_expression_in_assignment699);
                    	        	expression31 = expression();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); 
                    	 node = new AssignVariableNode(variable29,indexes30,expression31,spriteObjects,currentScope); 

                    }
                    break;
                case 2 :
                    // D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:250:4: ^( GLOBAL_ASSIGN variable ( indexes )? ( expression )? )
                    {
                    	Match(input,GLOBAL_ASSIGN,FOLLOW_GLOBAL_ASSIGN_in_assignment724); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_variable_in_assignment726);
                    	variable32 = variable();
                    	state.followingStackPointer--;

                    	// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:250:29: ( indexes )?
                    	int alt16 = 2;
                    	int LA16_0 = input.LA(1);

                    	if ( (LA16_0 == INDEXES) )
                    	{
                    	    alt16 = 1;
                    	}
                    	switch (alt16) 
                    	{
                    	    case 1 :
                    	        // D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:250:29: indexes
                    	        {
                    	        	PushFollow(FOLLOW_indexes_in_assignment728);
                    	        	indexes33 = indexes();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:250:38: ( expression )?
                    	int alt17 = 2;
                    	int LA17_0 = input.LA(1);

                    	if ( ((LA17_0 >= STRING && LA17_0 <= VARDEC) || LA17_0 == LOOKUP || (LA17_0 >= IntAtom && LA17_0 <= LoopTypeAtom) || (LA17_0 >= Null && LA17_0 <= List) || LA17_0 == 63 || (LA17_0 >= 65 && LA17_0 <= 78)) )
                    	{
                    	    alt17 = 1;
                    	}
                    	switch (alt17) 
                    	{
                    	    case 1 :
                    	        // D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:250:38: expression
                    	        {
                    	        	PushFollow(FOLLOW_expression_in_assignment731);
                    	        	expression34 = expression();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); 
                    	 node = new AssignVariableNode(variable32,indexes33,expression34,spriteObjects,globalScope); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return node;
    }