Beispiel #1
0
    // $ANTLR start "variableDeclarationNoInList"
    // AS3_ex.g3:2109:1: variableDeclarationNoInList : (V= VAR )? variableDeclarationNoIn (C= COMMA variableDeclarationNoIn )* ;
    public AS3_exParser.variableDeclarationNoInList_return variableDeclarationNoInList() // throws RecognitionException [1]
    {   
        AS3_exParser.variableDeclarationNoInList_return retval = new AS3_exParser.variableDeclarationNoInList_return();
        retval.Start = input.LT(1);
        int variableDeclarationNoInList_StartIndex = input.Index();
        object root_0 = null;

        IToken V = null;
        IToken C = null;
        AS3_exParser.variableDeclarationNoIn_return variableDeclarationNoIn214 = null;

        AS3_exParser.variableDeclarationNoIn_return variableDeclarationNoIn215 = null;


        object V_tree=null;
        object C_tree=null;

        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 89) ) 
    	    {
    	    	return retval; 
    	    }
            // AS3_ex.g3:2110:5: ( (V= VAR )? variableDeclarationNoIn (C= COMMA variableDeclarationNoIn )* )
            // AS3_ex.g3:2110:10: (V= VAR )? variableDeclarationNoIn (C= COMMA variableDeclarationNoIn )*
            {
            	root_0 = (object)adaptor.GetNilNode();

            	// AS3_ex.g3:2110:10: (V= VAR )?
            	int alt102 = 2;
            	int LA102_0 = input.LA(1);

            	if ( (LA102_0 == VAR) )
            	{
            	    alt102 = 1;
            	}
            	switch (alt102) 
            	{
            	    case 1 :
            	        // AS3_ex.g3:2110:11: V= VAR
            	        {
            	        	V=(IToken)Match(input,VAR,FOLLOW_VAR_in_variableDeclarationNoInList9710); if (state.failed) return retval;
            	        	if ( state.backtracking == 0 )
            	        	{V_tree = (object)adaptor.Create(V);
            	        		adaptor.AddChild(root_0, V_tree);
            	        	}
            	        	if ( state.backtracking == 0 ) 
            	        	{
            	        	  Emit((CommonToken)V);
            	        	}

            	        }
            	        break;

            	}

            	PushFollow(FOLLOW_variableDeclarationNoIn_in_variableDeclarationNoInList9716);
            	variableDeclarationNoIn214 = variableDeclarationNoIn();
            	state.followingStackPointer--;
            	if (state.failed) return retval;
            	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, variableDeclarationNoIn214.Tree);
            	// AS3_ex.g3:2110:68: (C= COMMA variableDeclarationNoIn )*
            	do 
            	{
            	    int alt103 = 2;
            	    int LA103_0 = input.LA(1);

            	    if ( (LA103_0 == COMMA) )
            	    {
            	        alt103 = 1;
            	    }


            	    switch (alt103) 
            		{
            			case 1 :
            			    // AS3_ex.g3:2110:70: C= COMMA variableDeclarationNoIn
            			    {
            			    	if ( state.backtracking == 0 ) 
            			    	{
            			    	  InsertWS(mPrinter.GetSpacesBeforeComma());
            			    	}
            			    	C=(IToken)Match(input,COMMA,FOLLOW_COMMA_in_variableDeclarationNoInList9724); if (state.failed) return retval;
            			    	if ( state.backtracking == 0 )
            			    	{C_tree = (object)adaptor.Create(C);
            			    		adaptor.AddChild(root_0, C_tree);
            			    	}
            			    	if ( state.backtracking == 0 ) 
            			    	{
            			    	  Emit((CommonToken)C);
            			    	}
            			    	if ( state.backtracking == 0 ) 
            			    	{
            			    	  InsertWS(mPrinter.GetSpacesAfterComma());
            			    	}
            			    	PushFollow(FOLLOW_variableDeclarationNoIn_in_variableDeclarationNoInList9729);
            			    	variableDeclarationNoIn215 = variableDeclarationNoIn();
            			    	state.followingStackPointer--;
            			    	if (state.failed) return retval;
            			    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, variableDeclarationNoIn215.Tree);

            			    }
            			    break;

            			default:
            			    goto loop103;
            	    }
            	} while (true);

            	loop103:
            		;	// Stops C# compiler whining that label 'loop103' has no statements


            }

            retval.Stop = input.LT(-1);

            if ( state.backtracking==0 )
            {	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 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 89, variableDeclarationNoInList_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR start "variableDeclarationNoInList"
    // AS3_ex.g3:2836:1: variableDeclarationNoInList : variableDeclarationNoIn (C= COMMA variableDeclarationNoIn )* ;
    public AS3_exParser.variableDeclarationNoInList_return variableDeclarationNoInList() // throws RecognitionException [1]
    {   
        AS3_exParser.variableDeclarationNoInList_return retval = new AS3_exParser.variableDeclarationNoInList_return();
        retval.Start = input.LT(1);
        int variableDeclarationNoInList_StartIndex = input.Index();
        object root_0 = null;

        IToken C = null;
        AS3_exParser.variableDeclarationNoIn_return variableDeclarationNoIn225 = null;

        AS3_exParser.variableDeclarationNoIn_return variableDeclarationNoIn226 = null;


        object C_tree=null;


            WrapOptions options=mPrinter.getExpressionWrapOptions();
            bool pushedFormat=false;
            bool pushedWrapInfo=false;
            bool pushedIndent=false;

        try 
        {
            if ( (state.backtracking > 0) && AlreadyParsedRule(input, 89) ) 
            {
                return retval; 
            }
            // AS3_ex.g3:2843:5: ( variableDeclarationNoIn (C= COMMA variableDeclarationNoIn )* )
            // AS3_ex.g3:2844:6: variableDeclarationNoIn (C= COMMA variableDeclarationNoIn )*
            {
                root_0 = (object)adaptor.GetNilNode();

                if ( state.backtracking == 0 ) 
                {
                  pushedFormat=pushFormatType(options, true);
                         pushedWrapInfo=pushWrapInfo(options, true);
                        
                }
                PushFollow(FOLLOW_variableDeclarationNoIn_in_variableDeclarationNoInList10803);
                variableDeclarationNoIn225 = variableDeclarationNoIn();
                state.followingStackPointer--;
                if (state.failed) return retval;
                if ( state.backtracking == 0 ) adaptor.AddChild(root_0, variableDeclarationNoIn225.Tree);
                // AS3_ex.g3:2847:33: (C= COMMA variableDeclarationNoIn )*
                do 
                {
                    int alt109 = 2;
                    int LA109_0 = input.LA(1);

                    if ( (LA109_0 == COMMA) )
                    {
                        alt109 = 1;
                    }


                    switch (alt109) 
                    {
                        case 1 :
                            // AS3_ex.g3:2847:35: C= COMMA variableDeclarationNoIn
                            {
                                C=(IToken)Match(input,COMMA,FOLLOW_COMMA_in_variableDeclarationNoInList10809); if (state.failed) return retval;
                                if ( state.backtracking == 0 )
                                {C_tree = (object)adaptor.Create(C);
                                    adaptor.AddChild(root_0, C_tree);
                                }
                                if ( state.backtracking == 0 ) 
                                {
                                  pushedIndent=emitCommaWithSpacingAndCRs(options, C, pushedIndent, -1, ASPrettyPrinter.Break_SubType_Other);
                                }
                                PushFollow(FOLLOW_variableDeclarationNoIn_in_variableDeclarationNoInList10813);
                                variableDeclarationNoIn226 = variableDeclarationNoIn();
                                state.followingStackPointer--;
                                if (state.failed) return retval;
                                if ( state.backtracking == 0 ) adaptor.AddChild(root_0, variableDeclarationNoIn226.Tree);

                            }
                            break;

                        default:
                            goto loop109;
                    }
                } while (true);

                loop109:
                    ;   // Stops C# compiler whining that label 'loop109' has no statements

                if ( state.backtracking == 0 ) 
                {

                            if (pushedIndent)
                                popIndent();
                            if (pushedFormat)
                            {
                                mPrinter.popFormatMode();
                            }
                            if (pushedWrapInfo)
                                mPrinter.popWrapContext();
                        
                }

            }

            retval.Stop = input.LT(-1);

            if ( state.backtracking==0 )
            {   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 
        {
            if ( state.backtracking > 0 ) 
            {
                Memoize(input, 89, variableDeclarationNoInList_StartIndex); 
            }
        }
        return retval;
    }