Exemple #1
0
		public void Visit(CommaOperatorStatement expression)
		{
			var first = true;
			foreach (var parameter in expression.Statements)
			{
				if (first == false)
					Builder.Append(", ");
				first = false;
				parameter.Accept(this);
			}
		}
Exemple #2
0
        public void Visit(CommaOperatorStatement statement)
        {
            foreach (var s in statement.Statements) {
                if (DebugMode) {
                    OnStep(CreateDebugInformation(s));
                }

                s.Accept(this);

                if (StopStatementFlow()) {
                    return;
                }
            }
        }
Exemple #3
0
    // $ANTLR start "forControlVar"
    // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1582:1: forControlVar returns [IForStatement value] : VAR first= variableDeclarationNoIn ( ( IN ex= expression ) | ( ( COMMA follow= variableDeclarationNoIn )* SEMIC (ex1= expression )? SEMIC (ex2= expression )? ) ) ;
    public ES3Parser.forControlVar_return forControlVar() // throws RecognitionException [1]
    {   
        ES3Parser.forControlVar_return retval = new ES3Parser.forControlVar_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken VAR132 = null;
        IToken IN133 = null;
        IToken COMMA134 = null;
        IToken SEMIC135 = null;
        IToken SEMIC136 = null;
        ES3Parser.variableDeclarationNoIn_return first = null;

        ES3Parser.expression_return ex = null;

        ES3Parser.variableDeclarationNoIn_return follow = null;

        ES3Parser.expression_return ex1 = null;

        ES3Parser.expression_return ex2 = null;


        object VAR132_tree=null;
        object IN133_tree=null;
        object COMMA134_tree=null;
        object SEMIC135_tree=null;
        object SEMIC136_tree=null;


        	var forStatement = new ForStatement();
        	var foreachStatement = new ForEachInStatement();
        	var cs = new CommaOperatorStatement();

        try 
    	{
            // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1589:2: ( VAR first= variableDeclarationNoIn ( ( IN ex= expression ) | ( ( COMMA follow= variableDeclarationNoIn )* SEMIC (ex1= expression )? SEMIC (ex2= expression )? ) ) )
            // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1589:4: VAR first= variableDeclarationNoIn ( ( IN ex= expression ) | ( ( COMMA follow= variableDeclarationNoIn )* SEMIC (ex1= expression )? SEMIC (ex2= expression )? ) )
            {
            	root_0 = (object)adaptor.GetNilNode();

            	VAR132=(IToken)Match(input,VAR,FOLLOW_VAR_in_forControlVar5819); 
            		VAR132_tree = (object)adaptor.Create(VAR132);
            		adaptor.AddChild(root_0, VAR132_tree);

            	PushFollow(FOLLOW_variableDeclarationNoIn_in_forControlVar5823);
            	first = variableDeclarationNoIn();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, first.Tree);
            	 foreachStatement.InitialisationStatement = forStatement.InitialisationStatement = first.value; first.value.Global = false;  
            	// I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1590:2: ( ( IN ex= expression ) | ( ( COMMA follow= variableDeclarationNoIn )* SEMIC (ex1= expression )? SEMIC (ex2= expression )? ) )
            	int alt69 = 2;
            	int LA69_0 = input.LA(1);

            	if ( (LA69_0 == IN) )
            	{
            	    alt69 = 1;
            	}
            	else if ( ((LA69_0 >= SEMIC && LA69_0 <= COMMA)) )
            	{
            	    alt69 = 2;
            	}
            	else 
            	{
            	    NoViableAltException nvae_d69s0 =
            	        new NoViableAltException("", 69, 0, input);

            	    throw nvae_d69s0;
            	}
            	switch (alt69) 
            	{
            	    case 1 :
            	        // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1591:3: ( IN ex= expression )
            	        {
            	        	// I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1591:3: ( IN ex= expression )
            	        	// I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1592:4: IN ex= expression
            	        	{
            	        		IN133=(IToken)Match(input,IN,FOLLOW_IN_in_forControlVar5837); 
            	        			IN133_tree = (object)adaptor.Create(IN133);
            	        			adaptor.AddChild(root_0, IN133_tree);

            	        		PushFollow(FOLLOW_expression_in_forControlVar5841);
            	        		ex = expression();
            	        		state.followingStackPointer--;

            	        		adaptor.AddChild(root_0, ex.Tree);
            	        		 retval.value =  foreachStatement; foreachStatement.Expression = ((ex != null) ? ex.value : null); 

            	        	}


            	        }
            	        break;
            	    case 2 :
            	        // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1596:3: ( ( COMMA follow= variableDeclarationNoIn )* SEMIC (ex1= expression )? SEMIC (ex2= expression )? )
            	        {
            	        	// I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1596:3: ( ( COMMA follow= variableDeclarationNoIn )* SEMIC (ex1= expression )? SEMIC (ex2= expression )? )
            	        	// I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1597:4: ( COMMA follow= variableDeclarationNoIn )* SEMIC (ex1= expression )? SEMIC (ex2= expression )?
            	        	{
            	        		// I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1597:4: ( COMMA follow= variableDeclarationNoIn )*
            	        		do 
            	        		{
            	        		    int alt66 = 2;
            	        		    int LA66_0 = input.LA(1);

            	        		    if ( (LA66_0 == COMMA) )
            	        		    {
            	        		        alt66 = 1;
            	        		    }


            	        		    switch (alt66) 
            	        			{
            	        				case 1 :
            	        				    // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1597:6: COMMA follow= variableDeclarationNoIn
            	        				    {
            	        				    	COMMA134=(IToken)Match(input,COMMA,FOLLOW_COMMA_in_forControlVar5866); 
            	        				    		COMMA134_tree = (object)adaptor.Create(COMMA134);
            	        				    		adaptor.AddChild(root_0, COMMA134_tree);

            	        				    	 if( cs.Statements.Count == 0) { foreachStatement.InitialisationStatement = forStatement.InitialisationStatement = cs; cs.Statements.Add(first.value); } 
            	        				    	PushFollow(FOLLOW_variableDeclarationNoIn_in_forControlVar5872);
            	        				    	follow = variableDeclarationNoIn();
            	        				    	state.followingStackPointer--;

            	        				    	adaptor.AddChild(root_0, follow.Tree);
            	        				    	  follow.value.Global = false; cs.Statements.Add(follow.value); 

            	        				    }
            	        				    break;

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

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

            	        		SEMIC135=(IToken)Match(input,SEMIC,FOLLOW_SEMIC_in_forControlVar5883); 
            	        			SEMIC135_tree = (object)adaptor.Create(SEMIC135);
            	        			adaptor.AddChild(root_0, SEMIC135_tree);

            	        		// I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1598:10: (ex1= expression )?
            	        		int alt67 = 2;
            	        		int LA67_0 = input.LA(1);

            	        		if ( ((LA67_0 >= NULL && LA67_0 <= FALSE) || LA67_0 == DELETE || LA67_0 == FUNCTION || LA67_0 == NEW || LA67_0 == THIS || LA67_0 == TYPEOF || LA67_0 == VOID || LA67_0 == LBRACE || LA67_0 == LPAREN || LA67_0 == LBRACK || (LA67_0 >= ADD && LA67_0 <= SUB) || (LA67_0 >= INC && LA67_0 <= DEC) || (LA67_0 >= NOT && LA67_0 <= INV) || (LA67_0 >= Identifier && LA67_0 <= StringLiteral) || LA67_0 == RegularExpressionLiteral || (LA67_0 >= DecimalLiteral && LA67_0 <= HexIntegerLiteral)) )
            	        		{
            	        		    alt67 = 1;
            	        		}
            	        		switch (alt67) 
            	        		{
            	        		    case 1 :
            	        		        // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1598:12: ex1= expression
            	        		        {
            	        		        	PushFollow(FOLLOW_expression_in_forControlVar5889);
            	        		        	ex1 = expression();
            	        		        	state.followingStackPointer--;

            	        		        	adaptor.AddChild(root_0, ex1.Tree);
            	        		        	 forStatement.ConditionExpression = ((ex1 != null) ? ex1.value : null);

            	        		        }
            	        		        break;

            	        		}

            	        		SEMIC136=(IToken)Match(input,SEMIC,FOLLOW_SEMIC_in_forControlVar5897); 
            	        			SEMIC136_tree = (object)adaptor.Create(SEMIC136);
            	        			adaptor.AddChild(root_0, SEMIC136_tree);

            	        		// I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1598:87: (ex2= expression )?
            	        		int alt68 = 2;
            	        		int LA68_0 = input.LA(1);

            	        		if ( ((LA68_0 >= NULL && LA68_0 <= FALSE) || LA68_0 == DELETE || LA68_0 == FUNCTION || LA68_0 == NEW || LA68_0 == THIS || LA68_0 == TYPEOF || LA68_0 == VOID || LA68_0 == LBRACE || LA68_0 == LPAREN || LA68_0 == LBRACK || (LA68_0 >= ADD && LA68_0 <= SUB) || (LA68_0 >= INC && LA68_0 <= DEC) || (LA68_0 >= NOT && LA68_0 <= INV) || (LA68_0 >= Identifier && LA68_0 <= StringLiteral) || LA68_0 == RegularExpressionLiteral || (LA68_0 >= DecimalLiteral && LA68_0 <= HexIntegerLiteral)) )
            	        		{
            	        		    alt68 = 1;
            	        		}
            	        		switch (alt68) 
            	        		{
            	        		    case 1 :
            	        		        // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1598:88: ex2= expression
            	        		        {
            	        		        	PushFollow(FOLLOW_expression_in_forControlVar5902);
            	        		        	ex2 = expression();
            	        		        	state.followingStackPointer--;

            	        		        	adaptor.AddChild(root_0, ex2.Tree);
            	        		        	  forStatement.IncrementExpression = ((ex2 != null) ? ex2.value : null); 

            	        		        }
            	        		        break;

            	        		}

            	        		 retval.value =  forStatement; 

            	        	}


            	        }
            	        break;

            	}


            }

            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;
    }
Exemple #4
0
    // $ANTLR start "variableStatement"
    // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1451:1: variableStatement returns [Statement value] : VAR first= variableDeclaration ( COMMA follow= variableDeclaration )* semic ;
    public ES3Parser.variableStatement_return variableStatement() // throws RecognitionException [1]
    {   
        ES3Parser.variableStatement_return retval = new ES3Parser.variableStatement_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken VAR104 = null;
        IToken COMMA105 = null;
        ES3Parser.variableDeclaration_return first = null;

        ES3Parser.variableDeclaration_return follow = null;

        ES3Parser.semic_return semic106 = null;


        object VAR104_tree=null;
        object COMMA105_tree=null;


        	var cs = new CommaOperatorStatement();

        try 
    	{
            // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1455:2: ( VAR first= variableDeclaration ( COMMA follow= variableDeclaration )* semic )
            // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1455:4: VAR first= variableDeclaration ( COMMA follow= variableDeclaration )* semic
            {
            	root_0 = (object)adaptor.GetNilNode();

            	VAR104=(IToken)Match(input,VAR,FOLLOW_VAR_in_variableStatement5408); 
            		VAR104_tree = (object)adaptor.Create(VAR104);
            		adaptor.AddChild(root_0, VAR104_tree);

            	PushFollow(FOLLOW_variableDeclaration_in_variableStatement5412);
            	first = variableDeclaration();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, first.Tree);
            	 first.value.Global = false; retval.value =  first.value; 
            	// I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1455:88: ( COMMA follow= variableDeclaration )*
            	do 
            	{
            	    int alt60 = 2;
            	    int LA60_0 = input.LA(1);

            	    if ( (LA60_0 == COMMA) )
            	    {
            	        alt60 = 1;
            	    }


            	    switch (alt60) 
            		{
            			case 1 :
            			    // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1455:90: COMMA follow= variableDeclaration
            			    {
            			    	COMMA105=(IToken)Match(input,COMMA,FOLLOW_COMMA_in_variableStatement5418); 
            			    		COMMA105_tree = (object)adaptor.Create(COMMA105);
            			    		adaptor.AddChild(root_0, COMMA105_tree);

            			    	 if( cs.Statements.Count == 0) { cs.Statements.Add(retval.value); retval.value =  cs; } 
            			    	PushFollow(FOLLOW_variableDeclaration_in_variableStatement5424);
            			    	follow = variableDeclaration();
            			    	state.followingStackPointer--;

            			    	adaptor.AddChild(root_0, follow.Tree);
            			    	 cs.Statements.Add(follow.value); follow.value.Global = false; 

            			    }
            			    break;

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

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

            	PushFollow(FOLLOW_semic_in_variableStatement5432);
            	semic106 = semic();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, semic106.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;
    }
Exemple #5
0
    // $ANTLR start "expressionNoIn"
    // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1356:1: expressionNoIn returns [Expression value] : first= assignmentExpressionNoIn ( COMMA follow= assignmentExpressionNoIn )* ;
    public ES3Parser.expressionNoIn_return expressionNoIn() // throws RecognitionException [1]
    {   
        ES3Parser.expressionNoIn_return retval = new ES3Parser.expressionNoIn_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken COMMA81 = null;
        ES3Parser.assignmentExpressionNoIn_return first = null;

        ES3Parser.assignmentExpressionNoIn_return follow = null;


        object COMMA81_tree=null;


        	var cs = new CommaOperatorStatement();

        try 
    	{
            // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1360:2: (first= assignmentExpressionNoIn ( COMMA follow= assignmentExpressionNoIn )* )
            // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1360:4: first= assignmentExpressionNoIn ( COMMA follow= assignmentExpressionNoIn )*
            {
            	root_0 = (object)adaptor.GetNilNode();

            	PushFollow(FOLLOW_assignmentExpressionNoIn_in_expressionNoIn5117);
            	first = assignmentExpressionNoIn();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, first.Tree);
            	 retval.value =  first.value; 
            	// I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1360:61: ( COMMA follow= assignmentExpressionNoIn )*
            	do 
            	{
            	    int alt55 = 2;
            	    int LA55_0 = input.LA(1);

            	    if ( (LA55_0 == COMMA) )
            	    {
            	        alt55 = 1;
            	    }


            	    switch (alt55) 
            		{
            			case 1 :
            			    // I:\\Developpement\\Evaluant - R&D\\Jint\\trunk\\Jint\\ES3.g:1360:63: COMMA follow= assignmentExpressionNoIn
            			    {
            			    	COMMA81=(IToken)Match(input,COMMA,FOLLOW_COMMA_in_expressionNoIn5123); 
            			    		COMMA81_tree = (object)adaptor.Create(COMMA81);
            			    		adaptor.AddChild(root_0, COMMA81_tree);

            			    	if(cs.Statements.Count == 0) { cs.Statements.Add(retval.value); retval.value =  cs; } 
            			    	PushFollow(FOLLOW_assignmentExpressionNoIn_in_expressionNoIn5129);
            			    	follow = assignmentExpressionNoIn();
            			    	state.followingStackPointer--;

            			    	adaptor.AddChild(root_0, follow.Tree);
            			    	 cs.Statements.Add(follow.value); 

            			    }
            			    break;

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

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


            }

            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;
    }
Exemple #6
0
 void Analyze(CommaOperatorStatement Stmt)
 {
     SetCurrentLineAndCharNos(Stmt);
     if (Stmt.Statements != null) Analyze(Stmt.Statements);
 }