Search in sources :

Example 11 with RelationalExprDescr

use of org.drools.drl.ast.descr.RelationalExprDescr in project drools by kiegroup.

the class DRL5Expressions method singleRestriction.

// $ANTLR end "andRestriction"
// $ANTLR start "singleRestriction"
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:421:1: singleRestriction returns [BaseDescr result] : (op= operator ( ( squareArguments shiftExpression )=>sa= squareArguments value= shiftExpression |value= shiftExpression ) | LEFT_PAREN or= orRestriction RIGHT_PAREN );
public final BaseDescr singleRestriction() throws RecognitionException {
    BaseDescr result = null;
    ParserRuleReturnScope op = null;
    java.util.List<String> sa = null;
    ParserRuleReturnScope value = null;
    BaseDescr or = null;
    try {
        // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:422:3: (op= operator ( ( squareArguments shiftExpression )=>sa= squareArguments value= shiftExpression |value= shiftExpression ) | LEFT_PAREN or= orRestriction RIGHT_PAREN )
        int alt44 = 2;
        int LA44_0 = input.LA(1);
        if ((LA44_0 == EQUALS || (LA44_0 >= GREATER && LA44_0 <= GREATER_EQUALS) || (LA44_0 >= LESS && LA44_0 <= LESS_EQUALS) || LA44_0 == NOT_EQUALS || LA44_0 == TILDE)) {
            alt44 = 1;
        } else if ((LA44_0 == ID) && ((((helper.validateIdentifierKey(DroolsSoftKeywords.NOT))) || ((helper.isPluggableEvaluator(false)))))) {
            alt44 = 1;
        } else if ((LA44_0 == LEFT_PAREN)) {
            alt44 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return result;
            }
            NoViableAltException nvae = new NoViableAltException("", 44, 0, input);
            throw nvae;
        }
        switch(alt44) {
            case 1:
                // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:422:6: op= operator ( ( squareArguments shiftExpression )=>sa= squareArguments value= shiftExpression |value= shiftExpression )
                {
                    pushFollow(FOLLOW_operator_in_singleRestriction1963);
                    op = operator();
                    state._fsp--;
                    if (state.failed)
                        return result;
                    if (state.backtracking == 0) {
                        helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
                    }
                    // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:424:6: ( ( squareArguments shiftExpression )=>sa= squareArguments value= shiftExpression |value= shiftExpression )
                    int alt43 = 2;
                    int LA43_0 = input.LA(1);
                    if ((LA43_0 == LEFT_SQUARE)) {
                        int LA43_1 = input.LA(2);
                        if ((synpred11_DRL5Expressions())) {
                            alt43 = 1;
                        } else if ((true)) {
                            alt43 = 2;
                        }
                    } else if ((LA43_0 == BOOL || (LA43_0 >= DECIMAL && LA43_0 <= DECR) || LA43_0 == FLOAT || LA43_0 == HEX || (LA43_0 >= ID && LA43_0 <= INCR) || LA43_0 == LEFT_PAREN || LA43_0 == LESS || LA43_0 == MINUS || LA43_0 == NEGATION || LA43_0 == NULL || LA43_0 == PLUS || (LA43_0 >= STAR && LA43_0 <= TIME_INTERVAL))) {
                        alt43 = 2;
                    } else {
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return result;
                        }
                        NoViableAltException nvae = new NoViableAltException("", 43, 0, input);
                        throw nvae;
                    }
                    switch(alt43) {
                        case 1:
                            // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:424:8: ( squareArguments shiftExpression )=>sa= squareArguments value= shiftExpression
                            {
                                pushFollow(FOLLOW_squareArguments_in_singleRestriction1992);
                                sa = squareArguments();
                                state._fsp--;
                                if (state.failed)
                                    return result;
                                pushFollow(FOLLOW_shiftExpression_in_singleRestriction1996);
                                value = shiftExpression();
                                state._fsp--;
                                if (state.failed)
                                    return result;
                            }
                            break;
                        case 2:
                            // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:425:10: value= shiftExpression
                            {
                                pushFollow(FOLLOW_shiftExpression_in_singleRestriction2009);
                                value = shiftExpression();
                                state._fsp--;
                                if (state.failed)
                                    return result;
                            }
                            break;
                    }
                    if (state.backtracking == 0) {
                        if (buildDescr) {
                            BaseDescr descr = ((value != null ? ((DRL5Expressions.shiftExpression_return) value).result : null) != null && ((!((value != null ? ((DRL5Expressions.shiftExpression_return) value).result : null) instanceof AtomicExprDescr)) || ((value != null ? input.toString(value.start, value.stop) : null).equals(((AtomicExprDescr) (value != null ? ((DRL5Expressions.shiftExpression_return) value).result : null)).getExpression())))) ? (value != null ? ((DRL5Expressions.shiftExpression_return) value).result : null) : new AtomicExprDescr((value != null ? input.toString(value.start, value.stop) : null));
                            result = new RelationalExprDescr((op != null ? ((DRL5Expressions.operator_return) op).opr : null), (op != null ? ((DRL5Expressions.operator_return) op).negated : false), sa, relationalExpression_stack.peek().lsd, descr);
                            if (relationalExpression_stack.peek().lsd instanceof BindingDescr) {
                                relationalExpression_stack.peek().lsd = new AtomicExprDescr(((BindingDescr) relationalExpression_stack.peek().lsd).getExpression());
                            }
                        }
                        helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_END);
                    }
                }
                break;
            case 2:
                // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:440:6: LEFT_PAREN or= orRestriction RIGHT_PAREN
                {
                    match(input, LEFT_PAREN, FOLLOW_LEFT_PAREN_in_singleRestriction2034);
                    if (state.failed)
                        return result;
                    pushFollow(FOLLOW_orRestriction_in_singleRestriction2038);
                    or = orRestriction();
                    state._fsp--;
                    if (state.failed)
                        return result;
                    match(input, RIGHT_PAREN, FOLLOW_RIGHT_PAREN_in_singleRestriction2040);
                    if (state.failed)
                        return result;
                    if (state.backtracking == 0) {
                        result = or;
                    }
                }
                break;
        }
    } catch (RecognitionException re) {
        throw re;
    } finally {
    // do for sure before leaving
    }
    return result;
}
Also used : BindingDescr(org.drools.drl.ast.descr.BindingDescr) AtomicExprDescr(org.drools.drl.ast.descr.AtomicExprDescr) RelationalExprDescr(org.drools.drl.ast.descr.RelationalExprDescr) BaseDescr(org.drools.drl.ast.descr.BaseDescr)

Example 12 with RelationalExprDescr

use of org.drools.drl.ast.descr.RelationalExprDescr in project drools by kiegroup.

the class DRL5Expressions method equalityExpression.

// $ANTLR end "andExpression"
// $ANTLR start "equalityExpression"
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:285:1: equalityExpression returns [BaseDescr result] : left= instanceOfExpression ( (op= EQUALS |op= NOT_EQUALS ) right= instanceOfExpression )* ;
public final BaseDescr equalityExpression() throws RecognitionException {
    BaseDescr result = null;
    Token op = null;
    BaseDescr left = null;
    BaseDescr right = null;
    try {
        // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:286:3: (left= instanceOfExpression ( (op= EQUALS |op= NOT_EQUALS ) right= instanceOfExpression )* )
        // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:286:5: left= instanceOfExpression ( (op= EQUALS |op= NOT_EQUALS ) right= instanceOfExpression )*
        {
            pushFollow(FOLLOW_instanceOfExpression_in_equalityExpression1395);
            left = instanceOfExpression();
            state._fsp--;
            if (state.failed)
                return result;
            if (state.backtracking == 0) {
                if (buildDescr) {
                    result = left;
                }
            }
            // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:287:3: ( (op= EQUALS |op= NOT_EQUALS ) right= instanceOfExpression )*
            loop32: while (true) {
                int alt32 = 2;
                int LA32_0 = input.LA(1);
                if ((LA32_0 == EQUALS || LA32_0 == NOT_EQUALS)) {
                    alt32 = 1;
                }
                switch(alt32) {
                    case 1:
                        // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:287:5: (op= EQUALS |op= NOT_EQUALS ) right= instanceOfExpression
                        {
                            // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:287:5: (op= EQUALS |op= NOT_EQUALS )
                            int alt31 = 2;
                            int LA31_0 = input.LA(1);
                            if ((LA31_0 == EQUALS)) {
                                alt31 = 1;
                            } else if ((LA31_0 == NOT_EQUALS)) {
                                alt31 = 2;
                            } else {
                                if (state.backtracking > 0) {
                                    state.failed = true;
                                    return result;
                                }
                                NoViableAltException nvae = new NoViableAltException("", 31, 0, input);
                                throw nvae;
                            }
                            switch(alt31) {
                                case 1:
                                    // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:287:7: op= EQUALS
                                    {
                                        op = (Token) match(input, EQUALS, FOLLOW_EQUALS_in_equalityExpression1407);
                                        if (state.failed)
                                            return result;
                                    }
                                    break;
                                case 2:
                                    // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:287:19: op= NOT_EQUALS
                                    {
                                        op = (Token) match(input, NOT_EQUALS, FOLLOW_NOT_EQUALS_in_equalityExpression1413);
                                        if (state.failed)
                                            return result;
                                    }
                                    break;
                            }
                            if (state.backtracking == 0) {
                                helper.setHasOperator(true);
                                if (input.LA(1) != DRL5Lexer.EOF)
                                    helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
                            }
                            pushFollow(FOLLOW_instanceOfExpression_in_equalityExpression1429);
                            right = instanceOfExpression();
                            state._fsp--;
                            if (state.failed)
                                return result;
                            if (state.backtracking == 0) {
                                if (buildDescr) {
                                    result = new RelationalExprDescr((op != null ? op.getText() : null), false, null, left, right);
                                }
                            }
                        }
                        break;
                    default:
                        break loop32;
                }
            }
        }
    } catch (RecognitionException re) {
        throw re;
    } finally {
    // do for sure before leaving
    }
    return result;
}
Also used : BaseDescr(org.drools.drl.ast.descr.BaseDescr) RelationalExprDescr(org.drools.drl.ast.descr.RelationalExprDescr)

Example 13 with RelationalExprDescr

use of org.drools.drl.ast.descr.RelationalExprDescr in project drools by kiegroup.

the class DRL5Expressions method instanceOfExpression.

// $ANTLR end "equalityExpression"
// $ANTLR start "instanceOfExpression"
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:298:1: instanceOfExpression returns [BaseDescr result] : left= inExpression (op= instanceof_key right= type )? ;
public final BaseDescr instanceOfExpression() throws RecognitionException {
    BaseDescr result = null;
    BaseDescr left = null;
    ParserRuleReturnScope op = null;
    ParserRuleReturnScope right = null;
    try {
        // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:299:3: (left= inExpression (op= instanceof_key right= type )? )
        // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:299:5: left= inExpression (op= instanceof_key right= type )?
        {
            pushFollow(FOLLOW_inExpression_in_instanceOfExpression1464);
            left = inExpression();
            state._fsp--;
            if (state.failed)
                return result;
            if (state.backtracking == 0) {
                if (buildDescr) {
                    result = left;
                }
            }
            // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:300:3: (op= instanceof_key right= type )?
            int alt33 = 2;
            int LA33_0 = input.LA(1);
            if ((LA33_0 == ID)) {
                int LA33_1 = input.LA(2);
                if ((LA33_1 == ID) && (((helper.validateIdentifierKey(DroolsSoftKeywords.INSTANCEOF))))) {
                    alt33 = 1;
                }
            }
            switch(alt33) {
                case 1:
                    // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:300:5: op= instanceof_key right= type
                    {
                        pushFollow(FOLLOW_instanceof_key_in_instanceOfExpression1474);
                        op = instanceof_key();
                        state._fsp--;
                        if (state.failed)
                            return result;
                        if (state.backtracking == 0) {
                            helper.setHasOperator(true);
                            if (input.LA(1) != DRL5Lexer.EOF)
                                helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
                        }
                        pushFollow(FOLLOW_type_in_instanceOfExpression1488);
                        right = type();
                        state._fsp--;
                        if (state.failed)
                            return result;
                        if (state.backtracking == 0) {
                            if (buildDescr) {
                                result = new RelationalExprDescr((op != null ? input.toString(op.start, op.stop) : null), false, null, left, new AtomicExprDescr((right != null ? input.toString(right.start, right.stop) : null)));
                            }
                        }
                    }
                    break;
            }
        }
    } catch (RecognitionException re) {
        throw re;
    } finally {
    // do for sure before leaving
    }
    return result;
}
Also used : BaseDescr(org.drools.drl.ast.descr.BaseDescr) AtomicExprDescr(org.drools.drl.ast.descr.AtomicExprDescr) RelationalExprDescr(org.drools.drl.ast.descr.RelationalExprDescr)

Example 14 with RelationalExprDescr

use of org.drools.drl.ast.descr.RelationalExprDescr in project drools by kiegroup.

the class DRL5Expressions method inExpression.

// $ANTLR end "instanceOfExpression"
// $ANTLR start "inExpression"
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:311:1: inExpression returns [BaseDescr result] : left= relationalExpression ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN |in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )? ;
public final BaseDescr inExpression() throws RecognitionException {
    BaseDescr result = null;
    BaseDescr left = null;
    ParserRuleReturnScope e1 = null;
    ParserRuleReturnScope e2 = null;
    ConstraintConnectiveDescr descr = null;
    BaseDescr leftDescr = null;
    BindingDescr binding = null;
    try {
        // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:314:3: (left= relationalExpression ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN |in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )? )
        // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:314:5: left= relationalExpression ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN |in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )?
        {
            pushFollow(FOLLOW_relationalExpression_in_inExpression1533);
            left = relationalExpression();
            state._fsp--;
            if (state.failed)
                return result;
            if (state.backtracking == 0) {
                if (buildDescr) {
                    result = left;
                }
                if (left instanceof BindingDescr) {
                    binding = (BindingDescr) left;
                    leftDescr = new AtomicExprDescr(binding.getExpression());
                } else {
                    leftDescr = left;
                }
            }
            // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:323:5: ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN |in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )?
            int alt36 = 3;
            int LA36_0 = input.LA(1);
            if ((LA36_0 == ID)) {
                int LA36_1 = input.LA(2);
                if ((LA36_1 == ID)) {
                    int LA36_3 = input.LA(3);
                    if ((LA36_3 == LEFT_PAREN) && ((((helper.validateIdentifierKey(DroolsSoftKeywords.NOT))) && synpred7_DRL5Expressions()))) {
                        alt36 = 1;
                    }
                } else if ((LA36_1 == LEFT_PAREN) && (((helper.validateIdentifierKey(DroolsSoftKeywords.IN))))) {
                    alt36 = 2;
                }
            }
            switch(alt36) {
                case 1:
                    // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:323:6: ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
                    {
                        pushFollow(FOLLOW_not_key_in_inExpression1553);
                        not_key();
                        state._fsp--;
                        if (state.failed)
                            return result;
                        pushFollow(FOLLOW_in_key_in_inExpression1557);
                        in_key();
                        state._fsp--;
                        if (state.failed)
                            return result;
                        match(input, LEFT_PAREN, FOLLOW_LEFT_PAREN_in_inExpression1559);
                        if (state.failed)
                            return result;
                        if (state.backtracking == 0) {
                            helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
                        }
                        pushFollow(FOLLOW_expression_in_inExpression1581);
                        e1 = expression();
                        state._fsp--;
                        if (state.failed)
                            return result;
                        if (state.backtracking == 0) {
                            descr = ConstraintConnectiveDescr.newAnd();
                            RelationalExprDescr rel = new RelationalExprDescr("!=", false, null, leftDescr, (e1 != null ? ((DRL5Expressions.expression_return) e1).result : null));
                            descr.addOrMerge(rel);
                            result = descr;
                        }
                        // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:331:7: ( COMMA e2= expression )*
                        loop34: while (true) {
                            int alt34 = 2;
                            int LA34_0 = input.LA(1);
                            if ((LA34_0 == COMMA)) {
                                alt34 = 1;
                            }
                            switch(alt34) {
                                case 1:
                                    // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:331:8: COMMA e2= expression
                                    {
                                        match(input, COMMA, FOLLOW_COMMA_in_inExpression1600);
                                        if (state.failed)
                                            return result;
                                        pushFollow(FOLLOW_expression_in_inExpression1604);
                                        e2 = expression();
                                        state._fsp--;
                                        if (state.failed)
                                            return result;
                                        if (state.backtracking == 0) {
                                            RelationalExprDescr rel = new RelationalExprDescr("!=", false, null, leftDescr, (e2 != null ? ((DRL5Expressions.expression_return) e2).result : null));
                                            descr.addOrMerge(rel);
                                        }
                                    }
                                    break;
                                default:
                                    break loop34;
                            }
                        }
                        match(input, RIGHT_PAREN, FOLLOW_RIGHT_PAREN_in_inExpression1625);
                        if (state.failed)
                            return result;
                        if (state.backtracking == 0) {
                            helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_END);
                        }
                    }
                    break;
                case 2:
                    // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:337:7: in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
                    {
                        pushFollow(FOLLOW_in_key_in_inExpression1641);
                        in_key();
                        state._fsp--;
                        if (state.failed)
                            return result;
                        match(input, LEFT_PAREN, FOLLOW_LEFT_PAREN_in_inExpression1643);
                        if (state.failed)
                            return result;
                        if (state.backtracking == 0) {
                            helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
                        }
                        pushFollow(FOLLOW_expression_in_inExpression1665);
                        e1 = expression();
                        state._fsp--;
                        if (state.failed)
                            return result;
                        if (state.backtracking == 0) {
                            descr = ConstraintConnectiveDescr.newOr();
                            RelationalExprDescr rel = new RelationalExprDescr("==", false, null, leftDescr, (e1 != null ? ((DRL5Expressions.expression_return) e1).result : null));
                            descr.addOrMerge(rel);
                            result = descr;
                        }
                        // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:345:7: ( COMMA e2= expression )*
                        loop35: while (true) {
                            int alt35 = 2;
                            int LA35_0 = input.LA(1);
                            if ((LA35_0 == COMMA)) {
                                alt35 = 1;
                            }
                            switch(alt35) {
                                case 1:
                                    // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:345:8: COMMA e2= expression
                                    {
                                        match(input, COMMA, FOLLOW_COMMA_in_inExpression1684);
                                        if (state.failed)
                                            return result;
                                        pushFollow(FOLLOW_expression_in_inExpression1688);
                                        e2 = expression();
                                        state._fsp--;
                                        if (state.failed)
                                            return result;
                                        if (state.backtracking == 0) {
                                            RelationalExprDescr rel = new RelationalExprDescr("==", false, null, leftDescr, (e2 != null ? ((DRL5Expressions.expression_return) e2).result : null));
                                            descr.addOrMerge(rel);
                                        }
                                    }
                                    break;
                                default:
                                    break loop35;
                            }
                        }
                        match(input, RIGHT_PAREN, FOLLOW_RIGHT_PAREN_in_inExpression1709);
                        if (state.failed)
                            return result;
                        if (state.backtracking == 0) {
                            helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_END);
                        }
                    }
                    break;
            }
        }
        if (state.backtracking == 0) {
            if (binding != null && descr != null)
                descr.addOrMerge(binding);
        }
    } catch (RecognitionException re) {
        throw re;
    } finally {
    // do for sure before leaving
    }
    return result;
}
Also used : BindingDescr(org.drools.drl.ast.descr.BindingDescr) BaseDescr(org.drools.drl.ast.descr.BaseDescr) AtomicExprDescr(org.drools.drl.ast.descr.AtomicExprDescr) ConstraintConnectiveDescr(org.drools.drl.ast.descr.ConstraintConnectiveDescr) RelationalExprDescr(org.drools.drl.ast.descr.RelationalExprDescr)

Example 15 with RelationalExprDescr

use of org.drools.drl.ast.descr.RelationalExprDescr in project drools by kiegroup.

the class DRL6Expressions method instanceOfExpression.

// $ANTLR end "equalityExpression"
// $ANTLR start "instanceOfExpression"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:312:1: instanceOfExpression returns [BaseDescr result] : left= inExpression (op= instanceof_key right= type )? ;
public final BaseDescr instanceOfExpression() throws RecognitionException {
    BaseDescr result = null;
    BaseDescr left = null;
    ParserRuleReturnScope op = null;
    ParserRuleReturnScope right = null;
    try {
        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:313:3: (left= inExpression (op= instanceof_key right= type )? )
        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:313:5: left= inExpression (op= instanceof_key right= type )?
        {
            pushFollow(FOLLOW_inExpression_in_instanceOfExpression1546);
            left = inExpression();
            state._fsp--;
            if (state.failed)
                return result;
            if (state.backtracking == 0) {
                if (buildDescr) {
                    result = left;
                }
            }
            // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:314:3: (op= instanceof_key right= type )?
            int alt33 = 2;
            int LA33_0 = input.LA(1);
            if ((LA33_0 == ID)) {
                int LA33_1 = input.LA(2);
                if ((LA33_1 == ID) && (((helper.validateIdentifierKey(DroolsSoftKeywords.INSTANCEOF))))) {
                    alt33 = 1;
                }
            }
            switch(alt33) {
                case 1:
                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:314:5: op= instanceof_key right= type
                    {
                        pushFollow(FOLLOW_instanceof_key_in_instanceOfExpression1556);
                        op = instanceof_key();
                        state._fsp--;
                        if (state.failed)
                            return result;
                        if (state.backtracking == 0) {
                            helper.setHasOperator(true);
                            if (input.LA(1) != DRL6Lexer.EOF)
                                helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
                        }
                        pushFollow(FOLLOW_type_in_instanceOfExpression1570);
                        right = type();
                        state._fsp--;
                        if (state.failed)
                            return result;
                        if (state.backtracking == 0) {
                            if (buildDescr) {
                                result = new RelationalExprDescr((op != null ? input.toString(op.start, op.stop) : null), false, null, left, new AtomicExprDescr((right != null ? input.toString(right.start, right.stop) : null)));
                            }
                        }
                    }
                    break;
            }
        }
    } catch (RecognitionException re) {
        throw re;
    } finally {
    // do for sure before leaving
    }
    return result;
}
Also used : BaseDescr(org.drools.drl.ast.descr.BaseDescr) AtomicExprDescr(org.drools.drl.ast.descr.AtomicExprDescr) RelationalExprDescr(org.drools.drl.ast.descr.RelationalExprDescr)

Aggregations

RelationalExprDescr (org.drools.drl.ast.descr.RelationalExprDescr)19 AtomicExprDescr (org.drools.drl.ast.descr.AtomicExprDescr)16 ConstraintConnectiveDescr (org.drools.drl.ast.descr.ConstraintConnectiveDescr)12 BaseDescr (org.drools.drl.ast.descr.BaseDescr)11 BindingDescr (org.drools.drl.ast.descr.BindingDescr)8 Test (org.junit.Test)7 NegConstraint (org.drools.core.rule.constraint.NegConstraint)2 PredicateConstraint (org.drools.core.rule.PredicateConstraint)1 XpathConstraint (org.drools.core.rule.constraint.XpathConstraint)1 Constraint (org.drools.core.spi.Constraint)1