Ejemplo n.º 1
0
    // $ANTLR start "count"
    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:186:1: count : ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) ) ;
    public HqlSqlWalker.count_return count() // throws RecognitionException [1]
    {   
        HqlSqlWalker.count_return retval = new HqlSqlWalker.count_return();
        retval.Start = input.LT(1);

        IASTNode root_0 = null;

        IASTNode _first_0 = null;
        IASTNode _last = null;

        IASTNode COUNT48 = null;
        IASTNode set49 = null;
        IASTNode ROW_STAR51 = null;
        HqlSqlWalker.aggregateExpr_return aggregateExpr50 = default(HqlSqlWalker.aggregateExpr_return);


        IASTNode COUNT48_tree=null;
        IASTNode set49_tree=null;
        IASTNode ROW_STAR51_tree=null;

        try 
    	{
            // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:187:2: ( ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) ) )
            // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:187:4: ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) )
            {
            	root_0 = (IASTNode)adaptor.GetNilNode();

            	_last = (IASTNode)input.LT(1);
            	{
            	IASTNode _save_last_1 = _last;
            	IASTNode _first_1 = null;
            	IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1);
            	COUNT48=(IASTNode)Match(input,COUNT,FOLLOW_COUNT_in_count882); 
            		COUNT48_tree = (IASTNode)adaptor.DupNode(COUNT48);

            		root_1 = (IASTNode)adaptor.BecomeRoot(COUNT48_tree, root_1);



            	Match(input, Token.DOWN, null); 
            	// /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:187:12: ( DISTINCT | ALL )?
            	int alt20 = 2;
            	int LA20_0 = input.LA(1);

            	if ( (LA20_0 == ALL || LA20_0 == DISTINCT) )
            	{
            	    alt20 = 1;
            	}
            	switch (alt20) 
            	{
            	    case 1 :
            	        // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:
            	        {
            	        	_last = (IASTNode)input.LT(1);
            	        	set49 = (IASTNode)input.LT(1);
            	        	if ( input.LA(1) == ALL || input.LA(1) == DISTINCT ) 
            	        	{
            	        	    input.Consume();

            	        	    set49_tree = (IASTNode)adaptor.DupNode(set49);

            	        	    adaptor.AddChild(root_1, set49_tree);

            	        	    state.errorRecovery = false;
            	        	}
            	        	else 
            	        	{
            	        	    MismatchedSetException mse = new MismatchedSetException(null,input);
            	        	    throw mse;
            	        	}


            	        }
            	        break;

            	}

            	// /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:187:32: ( aggregateExpr | ROW_STAR )
            	int alt21 = 2;
            	int LA21_0 = input.LA(1);

            	if ( (LA21_0 == COUNT || LA21_0 == DOT || LA21_0 == ELEMENTS || LA21_0 == FALSE || LA21_0 == INDICES || LA21_0 == NULL || LA21_0 == TRUE || LA21_0 == CASE || LA21_0 == AGGREGATE || LA21_0 == CASE2 || LA21_0 == INDEX_OP || LA21_0 == METHOD_CALL || LA21_0 == UNARY_MINUS || (LA21_0 >= VECTOR_EXPR && LA21_0 <= WEIRD_IDENT) || (LA21_0 >= NUM_INT && LA21_0 <= JAVA_CONSTANT) || (LA21_0 >= BNOT && LA21_0 <= DIV) || (LA21_0 >= COLON && LA21_0 <= IDENT)) )
            	{
            	    alt21 = 1;
            	}
            	else if ( (LA21_0 == ROW_STAR) )
            	{
            	    alt21 = 2;
            	}
            	else 
            	{
            	    NoViableAltException nvae_d21s0 =
            	        new NoViableAltException("", 21, 0, input);

            	    throw nvae_d21s0;
            	}
            	switch (alt21) 
            	{
            	    case 1 :
            	        // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:187:34: aggregateExpr
            	        {
            	        	_last = (IASTNode)input.LT(1);
            	        	PushFollow(FOLLOW_aggregateExpr_in_count897);
            	        	aggregateExpr50 = aggregateExpr();
            	        	state.followingStackPointer--;

            	        	adaptor.AddChild(root_1, aggregateExpr50.Tree);

            	        }
            	        break;
            	    case 2 :
            	        // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g:187:50: ROW_STAR
            	        {
            	        	_last = (IASTNode)input.LT(1);
            	        	ROW_STAR51=(IASTNode)Match(input,ROW_STAR,FOLLOW_ROW_STAR_in_count901); 
            	        		ROW_STAR51_tree = (IASTNode)adaptor.DupNode(ROW_STAR51);

            	        		adaptor.AddChild(root_1, ROW_STAR51_tree);


            	        }
            	        break;

            	}


            	Match(input, Token.UP, null); adaptor.AddChild(root_0, root_1);_last = _save_last_1;
            	}


            }

            	retval.Tree = (IASTNode)adaptor.RulePostProcessing(root_0);

        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return retval;
    }
    // $ANTLR start "count"
    // HqlSqlWalker.g:202:1: count : ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) ) ;
    public HqlSqlWalker.count_return count() // throws RecognitionException [1]
    {   
        HqlSqlWalker.count_return retval = new HqlSqlWalker.count_return();
        retval.Start = input.LT(1);

        IASTNode root_0 = null;

        IASTNode _first_0 = null;
        IASTNode _last = null;

        IASTNode COUNT57 = null;
        IASTNode set58 = null;
        IASTNode ROW_STAR60 = null;
        HqlSqlWalker.aggregateExpr_return aggregateExpr59 = default(HqlSqlWalker.aggregateExpr_return);


        IASTNode COUNT57_tree=null;
        IASTNode set58_tree=null;
        IASTNode ROW_STAR60_tree=null;

        try 
    	{
            // HqlSqlWalker.g:203:2: ( ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) ) )
            // HqlSqlWalker.g:203:4: ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) )
            {
            	root_0 = (IASTNode)adaptor.GetNilNode();

            	_last = (IASTNode)input.LT(1);
            	{
            	IASTNode _save_last_1 = _last;
            	IASTNode _first_1 = null;
            	IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1);
            	COUNT57=(IASTNode)Match(input,COUNT,FOLLOW_COUNT_in_count991); 
            		COUNT57_tree = (IASTNode)adaptor.DupNode(COUNT57);

            		root_1 = (IASTNode)adaptor.BecomeRoot(COUNT57_tree, root_1);



            	Match(input, Token.DOWN, null); 
            	// HqlSqlWalker.g:203:12: ( DISTINCT | ALL )?
            	int alt26 = 2;
            	int LA26_0 = input.LA(1);

            	if ( (LA26_0 == ALL || LA26_0 == DISTINCT) )
            	{
            	    alt26 = 1;
            	}
            	switch (alt26) 
            	{
            	    case 1 :
            	        // HqlSqlWalker.g:
            	        {
            	        	_last = (IASTNode)input.LT(1);
            	        	set58 = (IASTNode)input.LT(1);
            	        	if ( input.LA(1) == ALL || input.LA(1) == DISTINCT ) 
            	        	{
            	        	    input.Consume();

            	        	    set58_tree = (IASTNode)adaptor.DupNode(set58);

            	        	    adaptor.AddChild(root_1, set58_tree);

            	        	    state.errorRecovery = false;
            	        	}
            	        	else 
            	        	{
            	        	    MismatchedSetException mse = new MismatchedSetException(null,input);
            	        	    throw mse;
            	        	}


            	        }
            	        break;

            	}

            	// HqlSqlWalker.g:203:32: ( aggregateExpr | ROW_STAR )
            	int alt27 = 2;
            	int LA27_0 = input.LA(1);

            	if ( (LA27_0 == COUNT || LA27_0 == DOT || LA27_0 == ELEMENTS || LA27_0 == FALSE || LA27_0 == INDICES || LA27_0 == NULL || LA27_0 == TRUE || LA27_0 == CASE || LA27_0 == AGGREGATE || LA27_0 == CASE2 || LA27_0 == INDEX_OP || LA27_0 == METHOD_CALL || LA27_0 == UNARY_MINUS || (LA27_0 >= VECTOR_EXPR && LA27_0 <= WEIRD_IDENT) || (LA27_0 >= NUM_INT && LA27_0 <= JAVA_CONSTANT) || (LA27_0 >= COLON && LA27_0 <= PARAM) || (LA27_0 >= BNOT && LA27_0 <= DIV) || (LA27_0 >= QUOTED_String && LA27_0 <= IDENT)) )
            	{
            	    alt27 = 1;
            	}
            	else if ( (LA27_0 == ROW_STAR) )
            	{
            	    alt27 = 2;
            	}
            	else 
            	{
            	    NoViableAltException nvae_d27s0 =
            	        new NoViableAltException("", 27, 0, input);

            	    throw nvae_d27s0;
            	}
            	switch (alt27) 
            	{
            	    case 1 :
            	        // HqlSqlWalker.g:203:34: aggregateExpr
            	        {
            	        	_last = (IASTNode)input.LT(1);
            	        	PushFollow(FOLLOW_aggregateExpr_in_count1006);
            	        	aggregateExpr59 = aggregateExpr();
            	        	state.followingStackPointer--;

            	        	adaptor.AddChild(root_1, aggregateExpr59.Tree);

            	        }
            	        break;
            	    case 2 :
            	        // HqlSqlWalker.g:203:50: ROW_STAR
            	        {
            	        	_last = (IASTNode)input.LT(1);
            	        	ROW_STAR60=(IASTNode)Match(input,ROW_STAR,FOLLOW_ROW_STAR_in_count1010); 
            	        		ROW_STAR60_tree = (IASTNode)adaptor.DupNode(ROW_STAR60);

            	        		adaptor.AddChild(root_1, ROW_STAR60_tree);


            	        }
            	        break;

            	}


            	Match(input, Token.UP, null); adaptor.AddChild(root_0, root_1);_last = _save_last_1;
            	}


            }

            	retval.Tree = (IASTNode)adaptor.RulePostProcessing(root_0);

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