Пример #1
0
    // $ANTLR start "variableDeclarationList"
    // AS3_ex.g3:2105:1: variableDeclarationList : variableDeclaration (C= COMMA variableDeclaration )* ;
    public AS3_exParser.variableDeclarationList_return variableDeclarationList() // throws RecognitionException [1]
    {   
        AS3_exParser.variableDeclarationList_return retval = new AS3_exParser.variableDeclarationList_return();
        retval.Start = input.LT(1);
        int variableDeclarationList_StartIndex = input.Index();
        object root_0 = null;

        IToken C = null;
        AS3_exParser.variableDeclaration_return variableDeclaration212 = null;

        AS3_exParser.variableDeclaration_return variableDeclaration213 = null;


        object C_tree=null;

        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 88) ) 
    	    {
    	    	return retval; 
    	    }
            // AS3_ex.g3:2106:5: ( variableDeclaration (C= COMMA variableDeclaration )* )
            // AS3_ex.g3:2106:11: variableDeclaration (C= COMMA variableDeclaration )*
            {
            	root_0 = (object)adaptor.GetNilNode();

            	PushFollow(FOLLOW_variableDeclaration_in_variableDeclarationList9668);
            	variableDeclaration212 = variableDeclaration();
            	state.followingStackPointer--;
            	if (state.failed) return retval;
            	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, variableDeclaration212.Tree);
            	// AS3_ex.g3:2106:31: (C= COMMA variableDeclaration )*
            	do 
            	{
            	    int alt101 = 2;
            	    int LA101_0 = input.LA(1);

            	    if ( (LA101_0 == COMMA) )
            	    {
            	        alt101 = 1;
            	    }


            	    switch (alt101) 
            		{
            			case 1 :
            			    // AS3_ex.g3:2106:33: C= COMMA variableDeclaration
            			    {
            			    	if ( state.backtracking == 0 ) 
            			    	{
            			    	  InsertWS(mPrinter.GetSpacesBeforeComma());
            			    	}
            			    	C=(IToken)Match(input,COMMA,FOLLOW_COMMA_in_variableDeclarationList9676); 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_variableDeclaration_in_variableDeclarationList9681);
            			    	variableDeclaration213 = variableDeclaration();
            			    	state.followingStackPointer--;
            			    	if (state.failed) return retval;
            			    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, variableDeclaration213.Tree);

            			    }
            			    break;

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

            	loop101:
            		;	// Stops C# compiler whining that label 'loop101' 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, 88, variableDeclarationList_StartIndex); 
            }
        }
        return retval;
    }
Пример #2
0
    // $ANTLR start "variableDeclarationList"
    // AS3_ex.g3:2812:1: variableDeclarationList : variableDeclaration (C= COMMA variableDeclaration )* ;
    public AS3_exParser.variableDeclarationList_return variableDeclarationList() // throws RecognitionException [1]
    {   
        AS3_exParser.variableDeclarationList_return retval = new AS3_exParser.variableDeclarationList_return();
        retval.Start = input.LT(1);
        int variableDeclarationList_StartIndex = input.Index();
        object root_0 = null;

        IToken C = null;
        AS3_exParser.variableDeclaration_return variableDeclaration223 = null;

        AS3_exParser.variableDeclaration_return variableDeclaration224 = 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, 88) ) 
            {
                return retval; 
            }
            // AS3_ex.g3:2819:5: ( variableDeclaration (C= COMMA variableDeclaration )* )
            // AS3_ex.g3:2820:6: variableDeclaration (C= COMMA variableDeclaration )*
            {
                root_0 = (object)adaptor.GetNilNode();

                if ( state.backtracking == 0 ) 
                {
                  pushedFormat=pushFormatType(options, true);
                         pushedWrapInfo=pushWrapInfo(options, true);
                        
                }
                PushFollow(FOLLOW_variableDeclaration_in_variableDeclarationList10743);
                variableDeclaration223 = variableDeclaration();
                state.followingStackPointer--;
                if (state.failed) return retval;
                if ( state.backtracking == 0 ) adaptor.AddChild(root_0, variableDeclaration223.Tree);
                // AS3_ex.g3:2823:30: (C= COMMA variableDeclaration )*
                do 
                {
                    int alt108 = 2;
                    int LA108_0 = input.LA(1);

                    if ( (LA108_0 == COMMA) )
                    {
                        alt108 = 1;
                    }


                    switch (alt108) 
                    {
                        case 1 :
                            // AS3_ex.g3:2823:33: C= COMMA variableDeclaration
                            {
                                C=(IToken)Match(input,COMMA,FOLLOW_COMMA_in_variableDeclarationList10750); 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_variableDeclaration_in_variableDeclarationList10754);
                                variableDeclaration224 = variableDeclaration();
                                state.followingStackPointer--;
                                if (state.failed) return retval;
                                if ( state.backtracking == 0 ) adaptor.AddChild(root_0, variableDeclaration224.Tree);

                            }
                            break;

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

                loop108:
                    ;   // Stops C# compiler whining that label 'loop108' 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, 88, variableDeclarationList_StartIndex); 
            }
        }
        return retval;
    }