Exemplo n.º 1
0
    // $ANTLR start "arguments"
    // JavaScript.g:228:1: arguments : '(' ( ( LT )* assignmentExpression ( ( LT )* ',' ( LT )* assignmentExpression )* )? ( LT )* ')' ;
    public JavaScriptParser.arguments_return arguments() // throws RecognitionException [1]
    {   
        JavaScriptParser.arguments_return retval = new JavaScriptParser.arguments_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken char_literal257 = null;
        IToken LT258 = null;
        IToken LT260 = null;
        IToken char_literal261 = null;
        IToken LT262 = null;
        IToken LT264 = null;
        IToken char_literal265 = null;
        JavaScriptParser.assignmentExpression_return assignmentExpression259 = default(JavaScriptParser.assignmentExpression_return);

        JavaScriptParser.assignmentExpression_return assignmentExpression263 = default(JavaScriptParser.assignmentExpression_return);


        object char_literal257_tree=null;
        object LT258_tree=null;
        object LT260_tree=null;
        object char_literal261_tree=null;
        object LT262_tree=null;
        object LT264_tree=null;
        object char_literal265_tree=null;

        try 
    	{
            // JavaScript.g:229:2: ( '(' ( ( LT )* assignmentExpression ( ( LT )* ',' ( LT )* assignmentExpression )* )? ( LT )* ')' )
            // JavaScript.g:229:4: '(' ( ( LT )* assignmentExpression ( ( LT )* ',' ( LT )* assignmentExpression )* )? ( LT )* ')'
            {
            	root_0 = (object)adaptor.GetNilNode();

            	char_literal257=(IToken)Match(input,42,FOLLOW_42_in_arguments2001); if (state.failed) return retval;
            	if ( state.backtracking == 0 )
            	{char_literal257_tree = new baseNode(char_literal257) ;
            		root_0 = (object)adaptor.BecomeRoot(char_literal257_tree, root_0);
            	}
            	// JavaScript.g:229:19: ( ( LT )* assignmentExpression ( ( LT )* ',' ( LT )* assignmentExpression )* )?
            	int alt140 = 2;
            	alt140 = dfa140.Predict(input);
            	switch (alt140) 
            	{
            	    case 1 :
            	        // JavaScript.g:229:20: ( LT )* assignmentExpression ( ( LT )* ',' ( LT )* assignmentExpression )*
            	        {
            	        	// JavaScript.g:229:22: ( LT )*
            	        	do 
            	        	{
            	        	    int alt136 = 2;
            	        	    int LA136_0 = input.LA(1);

            	        	    if ( (LA136_0 == LT) )
            	        	    {
            	        	        alt136 = 1;
            	        	    }


            	        	    switch (alt136) 
            	        		{
            	        			case 1 :
            	        			    // JavaScript.g:229:22: LT
            	        			    {
            	        			    	LT258=(IToken)Match(input,LT,FOLLOW_LT_in_arguments2008); if (state.failed) return retval;

            	        			    }
            	        			    break;

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

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

            	        	PushFollow(FOLLOW_assignmentExpression_in_arguments2012);
            	        	assignmentExpression259 = assignmentExpression();
            	        	state.followingStackPointer--;
            	        	if (state.failed) return retval;
            	        	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, assignmentExpression259.Tree);
            	        	// JavaScript.g:229:46: ( ( LT )* ',' ( LT )* assignmentExpression )*
            	        	do 
            	        	{
            	        	    int alt139 = 2;
            	        	    alt139 = dfa139.Predict(input);
            	        	    switch (alt139) 
            	        		{
            	        			case 1 :
            	        			    // JavaScript.g:229:47: ( LT )* ',' ( LT )* assignmentExpression
            	        			    {
            	        			    	// JavaScript.g:229:49: ( LT )*
            	        			    	do 
            	        			    	{
            	        			    	    int alt137 = 2;
            	        			    	    int LA137_0 = input.LA(1);

            	        			    	    if ( (LA137_0 == LT) )
            	        			    	    {
            	        			    	        alt137 = 1;
            	        			    	    }


            	        			    	    switch (alt137) 
            	        			    		{
            	        			    			case 1 :
            	        			    			    // JavaScript.g:229:49: LT
            	        			    			    {
            	        			    			    	LT260=(IToken)Match(input,LT,FOLLOW_LT_in_arguments2015); if (state.failed) return retval;

            	        			    			    }
            	        			    			    break;

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

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

            	        			    	char_literal261=(IToken)Match(input,43,FOLLOW_43_in_arguments2019); if (state.failed) return retval;
            	        			    	// JavaScript.g:229:59: ( LT )*
            	        			    	do 
            	        			    	{
            	        			    	    int alt138 = 2;
            	        			    	    int LA138_0 = input.LA(1);

            	        			    	    if ( (LA138_0 == LT) )
            	        			    	    {
            	        			    	        alt138 = 1;
            	        			    	    }


            	        			    	    switch (alt138) 
            	        			    		{
            	        			    			case 1 :
            	        			    			    // JavaScript.g:229:59: LT
            	        			    			    {
            	        			    			    	LT262=(IToken)Match(input,LT,FOLLOW_LT_in_arguments2022); if (state.failed) return retval;

            	        			    			    }
            	        			    			    break;

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

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

            	        			    	PushFollow(FOLLOW_assignmentExpression_in_arguments2026);
            	        			    	assignmentExpression263 = assignmentExpression();
            	        			    	state.followingStackPointer--;
            	        			    	if (state.failed) return retval;
            	        			    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, assignmentExpression263.Tree);

            	        			    }
            	        			    break;

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

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


            	        }
            	        break;

            	}

            	// JavaScript.g:229:89: ( LT )*
            	do 
            	{
            	    int alt141 = 2;
            	    int LA141_0 = input.LA(1);

            	    if ( (LA141_0 == LT) )
            	    {
            	        alt141 = 1;
            	    }


            	    switch (alt141) 
            		{
            			case 1 :
            			    // JavaScript.g:229:89: LT
            			    {
            			    	LT264=(IToken)Match(input,LT,FOLLOW_LT_in_arguments2032); if (state.failed) return retval;

            			    }
            			    break;

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

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

            	char_literal265=(IToken)Match(input,44,FOLLOW_44_in_arguments2036); if (state.failed) return retval;

            }

            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 
    	{
        }
        return retval;
    }
Exemplo n.º 2
0
 protected bool NeedLeave(baseNode destNode, out tryStatementNode FinallyNode)
 {
     FinallyNode = null;
     bool need = false;
     for (baseNode n = base.parent as baseNode; !(n is TopStatementList); n = n.parent as baseNode)
     {
         if (n.TryCatchLevels > 0)
         {
             need = true;
         }
         if (n is tryStatementNode)
         {
             FinallyNode = (tryStatementNode) n;
             return need;
         }
         if (n == destNode)
         {
             return need;
         }
     }
     return need;
 }
Exemplo n.º 3
0
 internal void GenFinallyForward(CompileContext compileContext, Label dest, baseNode destNode, bool bNeedLeave)
 {
     int n = this.PostFinallyLabels.Count;
     this.PostFinallyLabels.Add(new PostFinallyLabel() { destNode = destNode, lbl = dest, switchlabel = compileContext.gen.DefineLabel() });
     compileContext.gen.Emit(OpCodes.Ldc_I4, n);
     compileContext.gen.Emit(OpCodes.Stloc, this.FinallyFwdDest);
     compileContext.gen.Emit(bNeedLeave ? OpCodes.Leave : OpCodes.Br, this.FinEnd);
 }
Exemplo n.º 4
0
 protected void GenInterStatementBreak(CompileContext compileContext, Label lbl, baseNode destNode)
 {
     tryStatementNode FinallyNode;
     bool bNeedLeave = this.NeedLeave(destNode, out FinallyNode);
     if (FinallyNode != null)
     {
         FinallyNode.GenFinallyForward(compileContext, lbl, destNode, bNeedLeave);
     }
     else
     {
         compileContext.gen.Emit(bNeedLeave ? OpCodes.Leave : OpCodes.Br, lbl);
     }
 }