Search in sources :

Example 11 with Expression

use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.

the class ConfiguredObjectFilterParser method selectClauseElement.

public final Map<String, Expression> selectClauseElement() throws ParseException {
    String name = null;
    Expression expr;
    expr = addExpression();
    switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
        case AS:
            jj_consume_token(AS);
            name = identifier();
            break;
        default:
            ;
    }
    if (name == null) {
        name = (expr instanceof NamedExpression) ? ((NamedExpression) expr).getName() : "";
    }
    {
        if (true)
            return Collections.singletonMap(name, expr);
    }
    throw new Error("Missing return statement in function");
}
Also used : ArithmeticExpression(org.apache.qpid.server.filter.ArithmeticExpression) NamedExpression(org.apache.qpid.server.filter.NamedExpression) ComparisonExpression(org.apache.qpid.server.filter.ComparisonExpression) LogicExpression(org.apache.qpid.server.filter.LogicExpression) OrderByExpression(org.apache.qpid.server.filter.OrderByExpression) UnaryExpression(org.apache.qpid.server.filter.UnaryExpression) ConstantExpression(org.apache.qpid.server.filter.ConstantExpression) Expression(org.apache.qpid.server.filter.Expression) BooleanExpression(org.apache.qpid.server.filter.BooleanExpression) NamedExpression(org.apache.qpid.server.filter.NamedExpression)

Example 12 with Expression

use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.

the class ConfiguredObjectFilterParser method filter.

// ----------------------------------------------------------------------------
// Grammar
// ----------------------------------------------------------------------------
public final BooleanExpression filter() throws ParseException {
    Expression left = null;
    left = orExpression();
    jj_consume_token(0);
    {
        if (true)
            return asBooleanExpression(left);
    }
    throw new Error("Missing return statement in function");
}
Also used : ArithmeticExpression(org.apache.qpid.server.filter.ArithmeticExpression) NamedExpression(org.apache.qpid.server.filter.NamedExpression) ComparisonExpression(org.apache.qpid.server.filter.ComparisonExpression) LogicExpression(org.apache.qpid.server.filter.LogicExpression) OrderByExpression(org.apache.qpid.server.filter.OrderByExpression) UnaryExpression(org.apache.qpid.server.filter.UnaryExpression) ConstantExpression(org.apache.qpid.server.filter.ConstantExpression) Expression(org.apache.qpid.server.filter.Expression) BooleanExpression(org.apache.qpid.server.filter.BooleanExpression)

Example 13 with Expression

use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.

the class ConfiguredObjectFilterParser method primaryExpr.

public final Expression primaryExpr() throws ParseException {
    Expression left = null;
    switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
        case FUNCTIONNAME:
            left = functionExpression();
            break;
        case TRUE:
        case FALSE:
        case NULL:
        case DECIMAL_LITERAL:
        case HEX_LITERAL:
        case OCTAL_LITERAL:
        case FLOATING_POINT_LITERAL:
        case STRING_LITERAL:
            left = literal();
            break;
        case ID:
        case QUOTED_ID:
            left = variable();
            break;
        case 37:
            jj_consume_token(37);
            left = orExpression();
            jj_consume_token(39);
            break;
        default:
            jj_consume_token(-1);
            throw new ParseException();
    }
    {
        if (true)
            return left;
    }
    throw new Error("Missing return statement in function");
}
Also used : ArithmeticExpression(org.apache.qpid.server.filter.ArithmeticExpression) NamedExpression(org.apache.qpid.server.filter.NamedExpression) ComparisonExpression(org.apache.qpid.server.filter.ComparisonExpression) LogicExpression(org.apache.qpid.server.filter.LogicExpression) OrderByExpression(org.apache.qpid.server.filter.OrderByExpression) UnaryExpression(org.apache.qpid.server.filter.UnaryExpression) ConstantExpression(org.apache.qpid.server.filter.ConstantExpression) Expression(org.apache.qpid.server.filter.Expression) BooleanExpression(org.apache.qpid.server.filter.BooleanExpression)

Example 14 with Expression

use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.

the class ConfiguredObjectFilterParser method orExpression.

public final Expression orExpression() throws ParseException {
    Expression left;
    Expression right;
    left = andExpression();
    label_1: while (true) {
        switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
            case OR:
                ;
                break;
            default:
                break label_1;
        }
        jj_consume_token(OR);
        right = andExpression();
        left = LogicExpression.createOR(asBooleanExpression(left), asBooleanExpression(right));
    }
    {
        if (true)
            return left;
    }
    throw new Error("Missing return statement in function");
}
Also used : ArithmeticExpression(org.apache.qpid.server.filter.ArithmeticExpression) NamedExpression(org.apache.qpid.server.filter.NamedExpression) ComparisonExpression(org.apache.qpid.server.filter.ComparisonExpression) LogicExpression(org.apache.qpid.server.filter.LogicExpression) OrderByExpression(org.apache.qpid.server.filter.OrderByExpression) UnaryExpression(org.apache.qpid.server.filter.UnaryExpression) ConstantExpression(org.apache.qpid.server.filter.ConstantExpression) Expression(org.apache.qpid.server.filter.Expression) BooleanExpression(org.apache.qpid.server.filter.BooleanExpression)

Example 15 with Expression

use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.

the class ConfiguredObjectFilterParser method comparisonExpression.

public final Expression comparisonExpression() throws ParseException {
    Expression left;
    Expression right;
    Expression low;
    Expression high;
    String t, u;
    boolean not;
    ArrayList list;
    left = addExpression();
    label_4: while (true) {
        switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
            case NOT:
            case BETWEEN:
            case LIKE:
            case IN:
            case 33:
            case 34:
            case 35:
            case 36:
                ;
                break;
            default:
                break label_4;
        }
        switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
            case 33:
                jj_consume_token(33);
                right = addExpression();
                left = ComparisonExpression.createGreaterThan(left, right);
                break;
            case 34:
                jj_consume_token(34);
                right = addExpression();
                left = ComparisonExpression.createGreaterThanEqual(left, right);
                break;
            case 35:
                jj_consume_token(35);
                right = addExpression();
                left = ComparisonExpression.createLessThan(left, right);
                break;
            case 36:
                jj_consume_token(36);
                right = addExpression();
                left = ComparisonExpression.createLessThanEqual(left, right);
                break;
            case LIKE:
                u = null;
                jj_consume_token(LIKE);
                t = stringLiteral();
                switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                    case ESCAPE:
                        jj_consume_token(ESCAPE);
                        u = stringLiteral();
                        break;
                    default:
                        ;
                }
                left = ComparisonExpression.createLike(left, t, u);
                break;
            default:
                if (jj_2_2(2)) {
                    u = null;
                    jj_consume_token(NOT);
                    jj_consume_token(LIKE);
                    t = stringLiteral();
                    switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                        case ESCAPE:
                            jj_consume_token(ESCAPE);
                            u = stringLiteral();
                            break;
                        default:
                            ;
                    }
                    left = ComparisonExpression.createNotLike(left, t, u);
                } else {
                    switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                        case BETWEEN:
                            jj_consume_token(BETWEEN);
                            low = addExpression();
                            jj_consume_token(AND);
                            high = addExpression();
                            left = ComparisonExpression.createBetween(left, low, high);
                            break;
                        default:
                            if (jj_2_3(2)) {
                                jj_consume_token(NOT);
                                jj_consume_token(BETWEEN);
                                low = addExpression();
                                jj_consume_token(AND);
                                high = addExpression();
                                left = ComparisonExpression.createNotBetween(left, low, high);
                            } else {
                                switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                                    case IN:
                                        jj_consume_token(IN);
                                        jj_consume_token(37);
                                        right = primaryExpr();
                                        list = new ArrayList();
                                        list.add(right);
                                        label_5: while (true) {
                                            switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                                                case 38:
                                                    ;
                                                    break;
                                                default:
                                                    break label_5;
                                            }
                                            jj_consume_token(38);
                                            right = primaryExpr();
                                            list.add(right);
                                        }
                                        jj_consume_token(39);
                                        left = ComparisonExpression.createInFilter(left, list, true);
                                        break;
                                    default:
                                        if (jj_2_4(2)) {
                                            jj_consume_token(NOT);
                                            jj_consume_token(IN);
                                            jj_consume_token(37);
                                            right = primaryExpr();
                                            list = new ArrayList();
                                            list.add(right);
                                            label_6: while (true) {
                                                switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                                                    case 38:
                                                        ;
                                                        break;
                                                    default:
                                                        break label_6;
                                                }
                                                jj_consume_token(38);
                                                right = primaryExpr();
                                                list.add(right);
                                            }
                                            jj_consume_token(39);
                                            left = ComparisonExpression.createNotInFilter(left, list, true);
                                        } else {
                                            jj_consume_token(-1);
                                            throw new ParseException();
                                        }
                                }
                            }
                    }
                }
        }
    }
    {
        if (true)
            return left;
    }
    throw new Error("Missing return statement in function");
}
Also used : ArithmeticExpression(org.apache.qpid.server.filter.ArithmeticExpression) NamedExpression(org.apache.qpid.server.filter.NamedExpression) ComparisonExpression(org.apache.qpid.server.filter.ComparisonExpression) LogicExpression(org.apache.qpid.server.filter.LogicExpression) OrderByExpression(org.apache.qpid.server.filter.OrderByExpression) UnaryExpression(org.apache.qpid.server.filter.UnaryExpression) ConstantExpression(org.apache.qpid.server.filter.ConstantExpression) Expression(org.apache.qpid.server.filter.Expression) BooleanExpression(org.apache.qpid.server.filter.BooleanExpression) ArrayList(java.util.ArrayList)

Aggregations

BooleanExpression (org.apache.qpid.server.filter.BooleanExpression)23 Expression (org.apache.qpid.server.filter.Expression)23 ArithmeticExpression (org.apache.qpid.server.filter.ArithmeticExpression)21 ComparisonExpression (org.apache.qpid.server.filter.ComparisonExpression)21 ConstantExpression (org.apache.qpid.server.filter.ConstantExpression)21 LogicExpression (org.apache.qpid.server.filter.LogicExpression)21 UnaryExpression (org.apache.qpid.server.filter.UnaryExpression)21 OrderByExpression (org.apache.qpid.server.filter.OrderByExpression)14 NamedExpression (org.apache.qpid.server.filter.NamedExpression)12 PropertyExpression (org.apache.qpid.server.filter.PropertyExpression)9 ArrayList (java.util.ArrayList)4 SelectorParsingException (org.apache.qpid.server.filter.SelectorParsingException)2 Map (java.util.Map)1