Exemplo n.º 1
0
    // $ANTLR start "relationalExpression"
    // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGL.g:334:1: relationalExpression : additiveExpression ( ( '<' | '>' | '<=' | '>=' ) additiveExpression )* ;
    public SGLParser.relationalExpression_return relationalExpression() // throws RecognitionException [1]
    {   
        SGLParser.relationalExpression_return retval = new SGLParser.relationalExpression_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken char_literal107 = null;
        IToken char_literal108 = null;
        IToken string_literal109 = null;
        IToken string_literal110 = null;
        SGLParser.additiveExpression_return additiveExpression106 = default(SGLParser.additiveExpression_return);

        SGLParser.additiveExpression_return additiveExpression111 = default(SGLParser.additiveExpression_return);


        object char_literal107_tree=null;
        object char_literal108_tree=null;
        object string_literal109_tree=null;
        object string_literal110_tree=null;

        try 
    	{
            // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGL.g:335:5: ( additiveExpression ( ( '<' | '>' | '<=' | '>=' ) additiveExpression )* )
            // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGL.g:335:9: additiveExpression ( ( '<' | '>' | '<=' | '>=' ) additiveExpression )*
            {
            	root_0 = (object)adaptor.GetNilNode();

            	PushFollow(FOLLOW_additiveExpression_in_relationalExpression1283);
            	additiveExpression106 = additiveExpression();
            	state.followingStackPointer--;

            	adaptor.AddChild(root_0, additiveExpression106.Tree);
            	// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGL.g:335:28: ( ( '<' | '>' | '<=' | '>=' ) additiveExpression )*
            	do 
            	{
            	    int alt26 = 2;
            	    int LA26_0 = input.LA(1);

            	    if ( ((LA26_0 >= 73 && LA26_0 <= 76)) )
            	    {
            	        alt26 = 1;
            	    }


            	    switch (alt26) 
            		{
            			case 1 :
            			    // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGL.g:335:29: ( '<' | '>' | '<=' | '>=' ) additiveExpression
            			    {
            			    	// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGL.g:335:29: ( '<' | '>' | '<=' | '>=' )
            			    	int alt25 = 4;
            			    	switch ( input.LA(1) ) 
            			    	{
            			    	case 73:
            			    		{
            			    	    alt25 = 1;
            			    	    }
            			    	    break;
            			    	case 74:
            			    		{
            			    	    alt25 = 2;
            			    	    }
            			    	    break;
            			    	case 75:
            			    		{
            			    	    alt25 = 3;
            			    	    }
            			    	    break;
            			    	case 76:
            			    		{
            			    	    alt25 = 4;
            			    	    }
            			    	    break;
            			    		default:
            			    		    NoViableAltException nvae_d25s0 =
            			    		        new NoViableAltException("", 25, 0, input);

            			    		    throw nvae_d25s0;
            			    	}

            			    	switch (alt25) 
            			    	{
            			    	    case 1 :
            			    	        // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGL.g:335:30: '<'
            			    	        {
            			    	        	char_literal107=(IToken)Match(input,73,FOLLOW_73_in_relationalExpression1287); 
            			    	        		char_literal107_tree = (object)adaptor.Create(char_literal107);
            			    	        		root_0 = (object)adaptor.BecomeRoot(char_literal107_tree, root_0);


            			    	        }
            			    	        break;
            			    	    case 2 :
            			    	        // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGL.g:335:35: '>'
            			    	        {
            			    	        	char_literal108=(IToken)Match(input,74,FOLLOW_74_in_relationalExpression1290); 
            			    	        		char_literal108_tree = (object)adaptor.Create(char_literal108);
            			    	        		root_0 = (object)adaptor.BecomeRoot(char_literal108_tree, root_0);


            			    	        }
            			    	        break;
            			    	    case 3 :
            			    	        // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGL.g:335:40: '<='
            			    	        {
            			    	        	string_literal109=(IToken)Match(input,75,FOLLOW_75_in_relationalExpression1293); 
            			    	        		string_literal109_tree = (object)adaptor.Create(string_literal109);
            			    	        		root_0 = (object)adaptor.BecomeRoot(string_literal109_tree, root_0);


            			    	        }
            			    	        break;
            			    	    case 4 :
            			    	        // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGL.g:335:46: '>='
            			    	        {
            			    	        	string_literal110=(IToken)Match(input,76,FOLLOW_76_in_relationalExpression1296); 
            			    	        		string_literal110_tree = (object)adaptor.Create(string_literal110);
            			    	        		root_0 = (object)adaptor.BecomeRoot(string_literal110_tree, root_0);


            			    	        }
            			    	        break;

            			    	}

            			    	PushFollow(FOLLOW_additiveExpression_in_relationalExpression1300);
            			    	additiveExpression111 = additiveExpression();
            			    	state.followingStackPointer--;

            			    	adaptor.AddChild(root_0, additiveExpression111.Tree);

            			    }
            			    break;

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

            	loop26:
            		;	// Stops C# compiler whining that label 'loop26' 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;
    }
Exemplo n.º 2
0
    // $ANTLR start "relationalExpression"
    // E:\\SGL\\sgl4c#\\NewSGLGramma\\SGL.g:307:1: relationalExpression : additiveExpression ( ( '<' | '>' | '<=' | '>=' ) additiveExpression )* ;
    public SGLParser.relationalExpression_return relationalExpression() // throws RecognitionException [1]
    {   
        SGLParser.relationalExpression_return retval = new SGLParser.relationalExpression_return();
        retval.Start = input.LT(1);
        int relationalExpression_StartIndex = input.Index();
        object root_0 = null;

        IToken char_literal84 = null;
        IToken char_literal85 = null;
        IToken string_literal86 = null;
        IToken string_literal87 = null;
        SGLParser.additiveExpression_return additiveExpression83 = default(SGLParser.additiveExpression_return);

        SGLParser.additiveExpression_return additiveExpression88 = default(SGLParser.additiveExpression_return);


        object char_literal84_tree=null;
        object char_literal85_tree=null;
        object string_literal86_tree=null;
        object string_literal87_tree=null;

        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 24) ) 
    	    {
    	    	return retval; 
    	    }
            // E:\\SGL\\sgl4c#\\NewSGLGramma\\SGL.g:308:5: ( additiveExpression ( ( '<' | '>' | '<=' | '>=' ) additiveExpression )* )
            // E:\\SGL\\sgl4c#\\NewSGLGramma\\SGL.g:308:9: additiveExpression ( ( '<' | '>' | '<=' | '>=' ) additiveExpression )*
            {
            	root_0 = (object)adaptor.GetNilNode();

            	PushFollow(FOLLOW_additiveExpression_in_relationalExpression1058);
            	additiveExpression83 = additiveExpression();
            	state.followingStackPointer--;
            	if (state.failed) return retval;
            	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, additiveExpression83.Tree);
            	// E:\\SGL\\sgl4c#\\NewSGLGramma\\SGL.g:308:28: ( ( '<' | '>' | '<=' | '>=' ) additiveExpression )*
            	do 
            	{
            	    int alt26 = 2;
            	    int LA26_0 = input.LA(1);

            	    if ( ((LA26_0 >= 68 && LA26_0 <= 71)) )
            	    {
            	        alt26 = 1;
            	    }


            	    switch (alt26) 
            		{
            			case 1 :
            			    // E:\\SGL\\sgl4c#\\NewSGLGramma\\SGL.g:308:29: ( '<' | '>' | '<=' | '>=' ) additiveExpression
            			    {
            			    	// E:\\SGL\\sgl4c#\\NewSGLGramma\\SGL.g:308:29: ( '<' | '>' | '<=' | '>=' )
            			    	int alt25 = 4;
            			    	switch ( input.LA(1) ) 
            			    	{
            			    	case 68:
            			    		{
            			    	    alt25 = 1;
            			    	    }
            			    	    break;
            			    	case 69:
            			    		{
            			    	    alt25 = 2;
            			    	    }
            			    	    break;
            			    	case 70:
            			    		{
            			    	    alt25 = 3;
            			    	    }
            			    	    break;
            			    	case 71:
            			    		{
            			    	    alt25 = 4;
            			    	    }
            			    	    break;
            			    		default:
            			    		    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
            			    		    NoViableAltException nvae_d25s0 =
            			    		        new NoViableAltException("", 25, 0, input);

            			    		    throw nvae_d25s0;
            			    	}

            			    	switch (alt25) 
            			    	{
            			    	    case 1 :
            			    	        // E:\\SGL\\sgl4c#\\NewSGLGramma\\SGL.g:308:30: '<'
            			    	        {
            			    	        	char_literal84=(IToken)Match(input,68,FOLLOW_68_in_relationalExpression1062); if (state.failed) return retval;
            			    	        	if ( state.backtracking == 0 )
            			    	        	{char_literal84_tree = (object)adaptor.Create(char_literal84);
            			    	        		root_0 = (object)adaptor.BecomeRoot(char_literal84_tree, root_0);
            			    	        	}

            			    	        }
            			    	        break;
            			    	    case 2 :
            			    	        // E:\\SGL\\sgl4c#\\NewSGLGramma\\SGL.g:308:35: '>'
            			    	        {
            			    	        	char_literal85=(IToken)Match(input,69,FOLLOW_69_in_relationalExpression1065); if (state.failed) return retval;
            			    	        	if ( state.backtracking == 0 )
            			    	        	{char_literal85_tree = (object)adaptor.Create(char_literal85);
            			    	        		root_0 = (object)adaptor.BecomeRoot(char_literal85_tree, root_0);
            			    	        	}

            			    	        }
            			    	        break;
            			    	    case 3 :
            			    	        // E:\\SGL\\sgl4c#\\NewSGLGramma\\SGL.g:308:40: '<='
            			    	        {
            			    	        	string_literal86=(IToken)Match(input,70,FOLLOW_70_in_relationalExpression1068); if (state.failed) return retval;
            			    	        	if ( state.backtracking == 0 )
            			    	        	{string_literal86_tree = (object)adaptor.Create(string_literal86);
            			    	        		root_0 = (object)adaptor.BecomeRoot(string_literal86_tree, root_0);
            			    	        	}

            			    	        }
            			    	        break;
            			    	    case 4 :
            			    	        // E:\\SGL\\sgl4c#\\NewSGLGramma\\SGL.g:308:46: '>='
            			    	        {
            			    	        	string_literal87=(IToken)Match(input,71,FOLLOW_71_in_relationalExpression1071); if (state.failed) return retval;
            			    	        	if ( state.backtracking == 0 )
            			    	        	{string_literal87_tree = (object)adaptor.Create(string_literal87);
            			    	        		root_0 = (object)adaptor.BecomeRoot(string_literal87_tree, root_0);
            			    	        	}

            			    	        }
            			    	        break;

            			    	}

            			    	PushFollow(FOLLOW_additiveExpression_in_relationalExpression1075);
            			    	additiveExpression88 = additiveExpression();
            			    	state.followingStackPointer--;
            			    	if (state.failed) return retval;
            			    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, additiveExpression88.Tree);

            			    }
            			    break;

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

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