Beispiel #1
0
/*
 * Implements GEqualFunc, used for comparing keys in the hash.
 */
static gboolean equal_func(gconstpointer a, gconstpointer b) {
    return boolean_value(
        ( (Object*(*)(Object*,Object*)) find_method(as_object(a)->type,
           l_classes_dictionary, _EQ__EQ__id, "==", 2))(as_object(a),
           as_object(b)));
}
void JSONBooleanGenerator::true_value(void)
  {
    boolean_value(true);
  }
void JSONBooleanGenerator::false_value(void)
  {
    boolean_value(false);
  }
/**
 * $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;
}