Esempio n. 1
0
/**
 * $ANTLR start boolean_expr
 * /home/cross/workspace/djondb/db/grammars/filter_expression.g:76:1: boolean_expr returns [BaseExpression* val] : b1= boolean_term ( OR b2= boolean_term )* ;
 */
static BaseExpression*
boolean_expr(pfilter_expressionParser ctx)
{
    BaseExpression* val;


    BaseExpression* b1;
    #undef	RETURN_TYPE_b1
    #define	RETURN_TYPE_b1 BaseExpression*

    BaseExpression* b2;
    #undef	RETURN_TYPE_b2
    #define	RETURN_TYPE_b2 BaseExpression*

    /* Initialize rule variables
     */

    {
        // /home/cross/workspace/djondb/db/grammars/filter_expression.g:77:2: (b1= boolean_term ( OR b2= boolean_term )* )
        // /home/cross/workspace/djondb/db/grammars/filter_expression.g:77:4: b1= boolean_term ( OR b2= boolean_term )*
        {
            FOLLOWPUSH(FOLLOW_boolean_term_in_boolean_expr107);
            b1=boolean_term(ctx);

            FOLLOWPOP();
            if  (HASEXCEPTION())
            {
                goto ruleboolean_exprEx;
            }


            {

                	   val= 
                b1
                ;

                	
            }


            // /home/cross/workspace/djondb/db/grammars/filter_expression.g:81:2: ( OR b2= boolean_term )*

            for (;;)
            {
                int alt1=2;
                switch ( LA(1) )
                {
                case OR:
                	{
                		alt1=1;
                	}
                    break;

                }

                switch (alt1)
                {
            	case 1:
            	    // /home/cross/workspace/djondb/db/grammars/filter_expression.g:81:3: OR b2= boolean_term
            	    {
            	         MATCHT(OR, &FOLLOW_OR_in_boolean_expr115);
            	        if  (HASEXCEPTION())
            	        {
            	            goto ruleboolean_exprEx;
            	        }


            	        FOLLOWPUSH(FOLLOW_boolean_term_in_boolean_expr119);
            	        b2=boolean_term(ctx);

            	        FOLLOWPOP();
            	        if  (HASEXCEPTION())
            	        {
            	            goto ruleboolean_exprEx;
            	        }


            	        {

            	            	   BinaryExpression* be = new BinaryExpression(FO_OR);
            	            	   be->push(val
            	            );
            	            	   be->push(b2
            	            );
            	            	   val= be;

            	            	
            	        }


            	    }
            	    break;

            	default:
            	    goto loop1;	/* break out of the loop */
            	    break;
                }
            }
            loop1: ; /* Jump out to here if this rule does not match */


        }

    }

    // This is where rules clean up and exit
    //
    goto ruleboolean_exprEx; /* Prevent compiler warnings */
    ruleboolean_exprEx: ;



    return val;
}
Esempio n. 2
0
/**
 * $ANTLR start boolean_term
 * /home/cross/workspace/djondb/db/grammars/filter_expression.g:88:1: boolean_term returns [BaseExpression* val] : b1= boolean_value ( AND b2= boolean_value )* ;
 */
static BaseExpression*
boolean_term(pfilter_expressionParser ctx)
{
    BaseExpression* val;


    BaseExpression* b1;
    #undef	RETURN_TYPE_b1
    #define	RETURN_TYPE_b1 BaseExpression*

    BaseExpression* b2;
    #undef	RETURN_TYPE_b2
    #define	RETURN_TYPE_b2 BaseExpression*

    /* Initialize rule variables
     */

    {
        // /home/cross/workspace/djondb/db/grammars/filter_expression.g:89:2: (b1= boolean_value ( AND b2= boolean_value )* )
        // /home/cross/workspace/djondb/db/grammars/filter_expression.g:89:4: b1= boolean_value ( AND b2= boolean_value )*
        {
            FOLLOWPUSH(FOLLOW_boolean_value_in_boolean_term138);
            b1=boolean_value(ctx);

            FOLLOWPOP();
            if  (HASEXCEPTION())
            {
                goto ruleboolean_termEx;
            }


            {

                	   val= 
                b1
                ;

                	
            }


            // /home/cross/workspace/djondb/db/grammars/filter_expression.g:93:3: ( AND b2= boolean_value )*

            for (;;)
            {
                int alt2=2;
                switch ( LA(1) )
                {
                case AND:
                	{
                		alt2=1;
                	}
                    break;

                }

                switch (alt2)
                {
            	case 1:
            	    // /home/cross/workspace/djondb/db/grammars/filter_expression.g:93:4: AND b2= boolean_value
            	    {
            	         MATCHT(AND, &FOLLOW_AND_in_boolean_term146);
            	        if  (HASEXCEPTION())
            	        {
            	            goto ruleboolean_termEx;
            	        }


            	        FOLLOWPUSH(FOLLOW_boolean_value_in_boolean_term150);
            	        b2=boolean_value(ctx);

            	        FOLLOWPOP();
            	        if  (HASEXCEPTION())
            	        {
            	            goto ruleboolean_termEx;
            	        }


            	        {

            	            	   BinaryExpression* be = new BinaryExpression(FO_AND);
            	            	   be->push(val
            	            );
            	            	   be->push(b2
            	            );
            	            	   val= be;

            	            	 
            	        }


            	    }
            	    break;

            	default:
            	    goto loop2;	/* break out of the loop */
            	    break;
                }
            }
            loop2: ; /* Jump out to here if this rule does not match */


        }

    }

    // This is where rules clean up and exit
    //
    goto ruleboolean_termEx; /* Prevent compiler warnings */
    ruleboolean_termEx: ;



    return val;
}
Esempio n. 3
0
/**
 * $ANTLR start nonparentherized_boolean
 * /home/cross/workspace/djondb/db/grammars/filter_expression.g:114:1: nonparentherized_boolean returns [BaseExpression* val] : u1= unary_expr ( OPER u2= unary_expr )* ;
 */
static BaseExpression*
nonparentherized_boolean(pfilter_expressionParser ctx)
{
    BaseExpression* val;


    pANTLR3_COMMON_TOKEN    OPER6;
    BaseExpression* u1;
    #undef	RETURN_TYPE_u1
    #define	RETURN_TYPE_u1 BaseExpression*

    BaseExpression* u2;
    #undef	RETURN_TYPE_u2
    #define	RETURN_TYPE_u2 BaseExpression*

    /* Initialize rule variables
     */

    OPER6       = NULL;

    {
        // /home/cross/workspace/djondb/db/grammars/filter_expression.g:115:2: (u1= unary_expr ( OPER u2= unary_expr )* )
        // /home/cross/workspace/djondb/db/grammars/filter_expression.g:115:4: u1= unary_expr ( OPER u2= unary_expr )*
        {
            FOLLOWPUSH(FOLLOW_unary_expr_in_nonparentherized_boolean215);
            u1=unary_expr(ctx);

            FOLLOWPOP();
            if  (HASEXCEPTION())
            {
                goto rulenonparentherized_booleanEx;
            }


            {

                	   val= 
                u1
                ;

                	
            }


            // /home/cross/workspace/djondb/db/grammars/filter_expression.g:117:4: ( OPER u2= unary_expr )*

            for (;;)
            {
                int alt4=2;
                switch ( LA(1) )
                {
                case OPER:
                	{
                		alt4=1;
                	}
                    break;

                }

                switch (alt4)
                {
            	case 1:
            	    // /home/cross/workspace/djondb/db/grammars/filter_expression.g:117:6: OPER u2= unary_expr
            	    {
            	        OPER6 = (pANTLR3_COMMON_TOKEN) MATCHT(OPER, &FOLLOW_OPER_in_nonparentherized_boolean221);
            	        if  (HASEXCEPTION())
            	        {
            	            goto rulenonparentherized_booleanEx;
            	        }


            	        FOLLOWPUSH(FOLLOW_unary_expr_in_nonparentherized_boolean225);
            	        u2=unary_expr(ctx);

            	        FOLLOWPOP();
            	        if  (HASEXCEPTION())
            	        {
            	            goto rulenonparentherized_booleanEx;
            	        }


            	        {

            	            	   FILTER_OPERATORS oper = parseFilterOperator((char*)(OPER6->getText(OPER6))->chars);
            	            	   BinaryExpression* be = new BinaryExpression(oper);
            	            	   be->push(
            	            val
            	            );
            	            	   be->push(u2
            	            );
            	            	   val= be;

            	            	
            	        }


            	    }
            	    break;

            	default:
            	    goto loop4;	/* break out of the loop */
            	    break;
                }
            }
            loop4: ; /* Jump out to here if this rule does not match */


        }

    }

    // This is where rules clean up and exit
    //
    goto rulenonparentherized_booleanEx; /* Prevent compiler warnings */
    rulenonparentherized_booleanEx: ;



    return val;
}