Search in sources :

Example 21 with Expression

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

the class SelectorParser method multExpr.

public final Expression multExpr() throws ParseException {
    Expression left;
    Expression right;
    left = unaryExpr();
    label_8: while (true) {
        switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
            case 38:
            case 39:
            case 40:
                ;
                break;
            default:
                break label_8;
        }
        switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
            case 38:
                jj_consume_token(38);
                right = unaryExpr();
                left = ArithmeticExpression.createMultiply(left, right);
                break;
            case 39:
                jj_consume_token(39);
                right = unaryExpr();
                left = ArithmeticExpression.createDivide(left, right);
                break;
            case 40:
                jj_consume_token(40);
                right = unaryExpr();
                left = ArithmeticExpression.createMod(left, right);
                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) ConstantExpression(org.apache.qpid.server.filter.ConstantExpression) PropertyExpression(org.apache.qpid.server.filter.PropertyExpression) ComparisonExpression(org.apache.qpid.server.filter.ComparisonExpression) Expression(org.apache.qpid.server.filter.Expression) LogicExpression(org.apache.qpid.server.filter.LogicExpression) BooleanExpression(org.apache.qpid.server.filter.BooleanExpression) UnaryExpression(org.apache.qpid.server.filter.UnaryExpression)

Example 22 with Expression

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

the class SelectorParser 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 29:
            case 30:
            case 31:
            case 32:
                ;
                break;
            default:
                break label_4;
        }
        switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
            case 29:
                jj_consume_token(29);
                right = addExpression();
                left = ComparisonExpression.createGreaterThan(left, right);
                break;
            case 30:
                jj_consume_token(30);
                right = addExpression();
                left = ComparisonExpression.createGreaterThanEqual(left, right);
                break;
            case 31:
                jj_consume_token(31);
                right = addExpression();
                left = ComparisonExpression.createLessThan(left, right);
                break;
            case 32:
                jj_consume_token(32);
                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(33);
                                        t = stringLiteral();
                                        list = new ArrayList();
                                        list.add(t);
                                        label_5: while (true) {
                                            switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                                                case 34:
                                                    ;
                                                    break;
                                                default:
                                                    break label_5;
                                            }
                                            jj_consume_token(34);
                                            t = stringLiteral();
                                            list.add(t);
                                        }
                                        jj_consume_token(35);
                                        left = ComparisonExpression.createInFilter(left, list, false);
                                        break;
                                    default:
                                        if (jj_2_4(2)) {
                                            jj_consume_token(NOT);
                                            jj_consume_token(IN);
                                            jj_consume_token(33);
                                            t = stringLiteral();
                                            list = new ArrayList();
                                            list.add(t);
                                            label_6: while (true) {
                                                switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                                                    case 34:
                                                        ;
                                                        break;
                                                    default:
                                                        break label_6;
                                                }
                                                jj_consume_token(34);
                                                t = stringLiteral();
                                                list.add(t);
                                            }
                                            jj_consume_token(35);
                                            left = ComparisonExpression.createNotInFilter(left, list, false);
                                        } 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) ConstantExpression(org.apache.qpid.server.filter.ConstantExpression) PropertyExpression(org.apache.qpid.server.filter.PropertyExpression) ComparisonExpression(org.apache.qpid.server.filter.ComparisonExpression) Expression(org.apache.qpid.server.filter.Expression) LogicExpression(org.apache.qpid.server.filter.LogicExpression) BooleanExpression(org.apache.qpid.server.filter.BooleanExpression) UnaryExpression(org.apache.qpid.server.filter.UnaryExpression) ArrayList(java.util.ArrayList)

Example 23 with Expression

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

the class SelectorParser method JmsSelector.

// ----------------------------------------------------------------------------
// Grammer
// ----------------------------------------------------------------------------
public final BooleanExpression JmsSelector() 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) ConstantExpression(org.apache.qpid.server.filter.ConstantExpression) PropertyExpression(org.apache.qpid.server.filter.PropertyExpression) ComparisonExpression(org.apache.qpid.server.filter.ComparisonExpression) Expression(org.apache.qpid.server.filter.Expression) LogicExpression(org.apache.qpid.server.filter.LogicExpression) BooleanExpression(org.apache.qpid.server.filter.BooleanExpression) UnaryExpression(org.apache.qpid.server.filter.UnaryExpression)

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