示例#1
0
    // $ANTLR end "simpleAlias"


    // $ANTLR start "simpleBind"
    // D:\\Documents\\Visual Studio 2010\\Projects\\Installer\\Installer\\Model\\DAL\\SourceEval.g:73:1: simpleBind returns [Bind simpleBind] : ( ^( BIND i1= ID ) | ^( BIND i1= ID c= command ) );
    public Bind simpleBind() // throws RecognitionException [1]
    {   
        Bind simpleBind = default(Bind);

        CommonTree i1 = null;
        Command c = default(Command);


         string id1 = null; List<IStatement> statList = new List<IStatement>(); 
        try 
    	{
            // D:\\Documents\\Visual Studio 2010\\Projects\\Installer\\Installer\\Model\\DAL\\SourceEval.g:77:2: ( ^( BIND i1= ID ) | ^( BIND i1= ID c= command ) )
            int alt9 = 2;
            int LA9_0 = input.LA(1);

            if ( (LA9_0 == BIND) )
            {
                int LA9_1 = input.LA(2);

                if ( (LA9_1 == DOWN) )
                {
                    int LA9_2 = input.LA(3);

                    if ( (LA9_2 == ID) )
                    {
                        int LA9_3 = input.LA(4);

                        if ( (LA9_3 == UP) )
                        {
                            alt9 = 1;
                        }
                        else if ( (LA9_3 == COMMAND) )
                        {
                            alt9 = 2;
                        }
                        else 
                        {
                            NoViableAltException nvae_d9s3 =
                                new NoViableAltException("", 9, 3, input);

                            throw nvae_d9s3;
                        }
                    }
                    else 
                    {
                        NoViableAltException nvae_d9s2 =
                            new NoViableAltException("", 9, 2, input);

                        throw nvae_d9s2;
                    }
                }
                else 
                {
                    NoViableAltException nvae_d9s1 =
                        new NoViableAltException("", 9, 1, input);

                    throw nvae_d9s1;
                }
            }
            else 
            {
                NoViableAltException nvae_d9s0 =
                    new NoViableAltException("", 9, 0, input);

                throw nvae_d9s0;
            }
            switch (alt9) 
            {
                case 1 :
                    // D:\\Documents\\Visual Studio 2010\\Projects\\Installer\\Installer\\Model\\DAL\\SourceEval.g:77:4: ^( BIND i1= ID )
                    {
                    	Match(input,BIND,FOLLOW_BIND_in_simpleBind385); 

                    	Match(input, Token.DOWN, null); 
                    	i1=(CommonTree)Match(input,ID,FOLLOW_ID_in_simpleBind389); 

                    	Match(input, Token.UP, null); 
                    	 id1 = ((i1 != null) ? i1.Text : null); 

                    }
                    break;
                case 2 :
                    // D:\\Documents\\Visual Studio 2010\\Projects\\Installer\\Installer\\Model\\DAL\\SourceEval.g:78:4: ^( BIND i1= ID c= command )
                    {
                    	Match(input,BIND,FOLLOW_BIND_in_simpleBind398); 

                    	Match(input, Token.DOWN, null); 
                    	i1=(CommonTree)Match(input,ID,FOLLOW_ID_in_simpleBind402); 
                    	PushFollow(FOLLOW_command_in_simpleBind406);
                    	c = command();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 id1 = ((i1 != null) ? i1.Text : null); statList.Add(c); 

                    }
                    break;

            }
             simpleBind = new Bind(id1, statList, StatementType.Bind, currentMetaData); 
        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return simpleBind;
    }
示例#2
0
    // $ANTLR end "alias"


    // $ANTLR start "bind"
    // D:\\Documents\\Visual Studio 2010\\Projects\\Installer\\Installer\\Model\\DAL\\SourceEval.g:46:1: bind returns [Bind bind] : ( ^( BIND ID (id= innerStat )+ ) | sB= simpleBind );
    public Bind bind() // throws RecognitionException [1]
    {   
        Bind bind = default(Bind);

        CommonTree ID2 = null;
        IStatement id = default(IStatement);

        Bind sB = default(Bind);


         List<IStatement> innerList = new List<IStatement>(); 
        try 
    	{
            // D:\\Documents\\Visual Studio 2010\\Projects\\Installer\\Installer\\Model\\DAL\\SourceEval.g:49:2: ( ^( BIND ID (id= innerStat )+ ) | sB= simpleBind )
            int alt6 = 2;
            alt6 = dfa6.Predict(input);
            switch (alt6) 
            {
                case 1 :
                    // D:\\Documents\\Visual Studio 2010\\Projects\\Installer\\Installer\\Model\\DAL\\SourceEval.g:49:4: ^( BIND ID (id= innerStat )+ )
                    {
                    	Match(input,BIND,FOLLOW_BIND_in_bind211); 

                    	Match(input, Token.DOWN, null); 
                    	ID2=(CommonTree)Match(input,ID,FOLLOW_ID_in_bind213); 
                    	// D:\\Documents\\Visual Studio 2010\\Projects\\Installer\\Installer\\Model\\DAL\\SourceEval.g:49:14: (id= innerStat )+
                    	int cnt5 = 0;
                    	do 
                    	{
                    	    int alt5 = 2;
                    	    int LA5_0 = input.LA(1);

                    	    if ( ((LA5_0 >= ALIAS && LA5_0 <= EXEC) || (LA5_0 >= INCREMENT && LA5_0 <= SAY) || LA5_0 == COMMAND) )
                    	    {
                    	        alt5 = 1;
                    	    }


                    	    switch (alt5) 
                    		{
                    			case 1 :
                    			    // D:\\Documents\\Visual Studio 2010\\Projects\\Installer\\Installer\\Model\\DAL\\SourceEval.g:49:16: id= innerStat
                    			    {
                    			    	PushFollow(FOLLOW_innerStat_in_bind219);
                    			    	id = innerStat();
                    			    	state.followingStackPointer--;

                    			    	if(id != null) {innerList.Add(id);}

                    			    }
                    			    break;

                    			default:
                    			    if ( cnt5 >= 1 ) goto loop5;
                    		            EarlyExitException eee5 =
                    		                new EarlyExitException(5, input);
                    		            throw eee5;
                    	    }
                    	    cnt5++;
                    	} while (true);

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


                    	Match(input, Token.UP, null); 
                    	 bind = new Bind(((ID2 != null) ? ID2.Text : null), innerList, StatementType.Alias, currentMetaData); 

                    }
                    break;
                case 2 :
                    // D:\\Documents\\Visual Studio 2010\\Projects\\Installer\\Installer\\Model\\DAL\\SourceEval.g:51:4: sB= simpleBind
                    {
                    	PushFollow(FOLLOW_simpleBind_in_bind237);
                    	sB = simpleBind();
                    	state.followingStackPointer--;

                    	bind = sB; 

                    }
                    break;

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