Search in sources :

Example 71 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class DRL6Expressions method xpathPrimary.

// $ANTLR end "xpathSeparator"
// $ANTLR start "xpathPrimary"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:564:1: xpathPrimary returns [BaseDescr result] : ( xpathChunk )+ ;
public final BaseDescr xpathPrimary() throws RecognitionException {
    BaseDescr result = null;
    try {
        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:565:5: ( ( xpathChunk )+ )
        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:565:7: ( xpathChunk )+
        {
            // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:565:7: ( xpathChunk )+
            int cnt58 = 0;
            loop58: while (true) {
                int alt58 = 2;
                int LA58_0 = input.LA(1);
                if ((LA58_0 == DIV)) {
                    int LA58_2 = input.LA(2);
                    if ((LA58_2 == ID)) {
                        alt58 = 1;
                    }
                } else if ((LA58_0 == QUESTION_DIV)) {
                    alt58 = 1;
                }
                switch(alt58) {
                    case 1:
                        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:565:7: xpathChunk
                        {
                            pushFollow(FOLLOW_xpathChunk_in_xpathPrimary2918);
                            xpathChunk();
                            state._fsp--;
                            if (state.failed)
                                return result;
                        }
                        break;
                    default:
                        if (cnt58 >= 1)
                            break loop58;
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return result;
                        }
                        EarlyExitException eee = new EarlyExitException(58, input);
                        throw eee;
                }
                cnt58++;
            }
        }
    } catch (RecognitionException re) {
        throw re;
    } finally {
    // do for sure before leaving
    }
    return result;
}
Also used : BaseDescr(org.drools.compiler.lang.descr.BaseDescr) AnnotatedBaseDescr(org.drools.compiler.lang.descr.AnnotatedBaseDescr)

Example 72 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class DRL6Expressions method equalityExpression.

// $ANTLR end "andExpression"
// $ANTLR start "equalityExpression"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:299: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/DRL6Expressions.g:300:3: (left= instanceOfExpression ( (op= EQUALS |op= NOT_EQUALS ) right= instanceOfExpression )* )
        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:300:5: left= instanceOfExpression ( (op= EQUALS |op= NOT_EQUALS ) right= instanceOfExpression )*
        {
            pushFollow(FOLLOW_instanceOfExpression_in_equalityExpression1477);
            left = instanceOfExpression();
            state._fsp--;
            if (state.failed)
                return result;
            if (state.backtracking == 0) {
                if (buildDescr) {
                    result = left;
                }
            }
            // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:301: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/DRL6Expressions.g:301:5: (op= EQUALS |op= NOT_EQUALS ) right= instanceOfExpression
                        {
                            // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:301: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/DRL6Expressions.g:301:7: op= EQUALS
                                    {
                                        op = (Token) match(input, EQUALS, FOLLOW_EQUALS_in_equalityExpression1489);
                                        if (state.failed)
                                            return result;
                                    }
                                    break;
                                case 2:
                                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:301:19: op= NOT_EQUALS
                                    {
                                        op = (Token) match(input, NOT_EQUALS, FOLLOW_NOT_EQUALS_in_equalityExpression1495);
                                        if (state.failed)
                                            return result;
                                    }
                                    break;
                            }
                            if (state.backtracking == 0) {
                                helper.setHasOperator(true);
                                if (input.LA(1) != DRL6Lexer.EOF)
                                    helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
                            }
                            pushFollow(FOLLOW_instanceOfExpression_in_equalityExpression1511);
                            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.compiler.lang.descr.BaseDescr) AnnotatedBaseDescr(org.drools.compiler.lang.descr.AnnotatedBaseDescr) RelationalExprDescr(org.drools.compiler.lang.descr.RelationalExprDescr)

Example 73 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class DRL6Expressions method primary.

// $ANTLR end "xpathExpressionList"
// $ANTLR start "primary"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:578:1: primary returns [BaseDescr result] : ( ( LEFT_PAREN )=>expr= parExpression | ( nonWildcardTypeArguments )=> nonWildcardTypeArguments ( explicitGenericInvocationSuffix | this_key arguments ) | ( literal )=> literal | ( super_key )=> super_key superSuffix | ( new_key )=> new_key creator | ( primitiveType )=> primitiveType ( LEFT_SQUARE RIGHT_SQUARE )* DOT class_key | ( inlineMapExpression )=> inlineMapExpression | ( inlineListExpression )=> inlineListExpression | ( ID )=>i1= ID ( ( ( DOT ID )=>d= DOT i2= ID ) | ( ( ( DOT | NULL_SAFE_DOT ) LEFT_PAREN )=>d= ( DOT | NULL_SAFE_DOT ) LEFT_PAREN expression ( COMMA expression )* RIGHT_PAREN ) | ( ( HASH ID )=>h= HASH i2= ID ) | ( ( NULL_SAFE_DOT ID )=>n= NULL_SAFE_DOT i2= ID ) )* ( ( identifierSuffix )=> identifierSuffix )? );
public final BaseDescr primary() throws RecognitionException {
    BaseDescr result = null;
    Token i1 = null;
    Token d = null;
    Token i2 = null;
    Token h = null;
    Token n = null;
    Token LEFT_PAREN12 = null;
    Token COMMA13 = null;
    Token RIGHT_PAREN14 = null;
    BaseDescr expr = null;
    ParserRuleReturnScope literal11 = null;
    try {
        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:579:5: ( ( LEFT_PAREN )=>expr= parExpression | ( nonWildcardTypeArguments )=> nonWildcardTypeArguments ( explicitGenericInvocationSuffix | this_key arguments ) | ( literal )=> literal | ( super_key )=> super_key superSuffix | ( new_key )=> new_key creator | ( primitiveType )=> primitiveType ( LEFT_SQUARE RIGHT_SQUARE )* DOT class_key | ( inlineMapExpression )=> inlineMapExpression | ( inlineListExpression )=> inlineListExpression | ( ID )=>i1= ID ( ( ( DOT ID )=>d= DOT i2= ID ) | ( ( ( DOT | NULL_SAFE_DOT ) LEFT_PAREN )=>d= ( DOT | NULL_SAFE_DOT ) LEFT_PAREN expression ( COMMA expression )* RIGHT_PAREN ) | ( ( HASH ID )=>h= HASH i2= ID ) | ( ( NULL_SAFE_DOT ID )=>n= NULL_SAFE_DOT i2= ID ) )* ( ( identifierSuffix )=> identifierSuffix )? )
        int alt68 = 9;
        int LA68_0 = input.LA(1);
        if ((LA68_0 == LEFT_PAREN) && (synpred24_DRL6Expressions())) {
            alt68 = 1;
        } else if ((LA68_0 == LESS) && (synpred25_DRL6Expressions())) {
            alt68 = 2;
        } else if ((LA68_0 == STRING) && (synpred26_DRL6Expressions())) {
            alt68 = 3;
        } else if ((LA68_0 == DECIMAL) && (synpred26_DRL6Expressions())) {
            alt68 = 3;
        } else if ((LA68_0 == HEX) && (synpred26_DRL6Expressions())) {
            alt68 = 3;
        } else if ((LA68_0 == FLOAT) && (synpred26_DRL6Expressions())) {
            alt68 = 3;
        } else if ((LA68_0 == BOOL) && (synpred26_DRL6Expressions())) {
            alt68 = 3;
        } else if ((LA68_0 == NULL) && (synpred26_DRL6Expressions())) {
            alt68 = 3;
        } else if ((LA68_0 == TIME_INTERVAL) && (synpred26_DRL6Expressions())) {
            alt68 = 3;
        } else if ((LA68_0 == STAR) && (synpred26_DRL6Expressions())) {
            alt68 = 3;
        } else if ((LA68_0 == ID)) {
            int LA68_11 = input.LA(2);
            if (((synpred27_DRL6Expressions() && ((helper.validateIdentifierKey(DroolsSoftKeywords.SUPER)))))) {
                alt68 = 4;
            } else if (((((helper.validateIdentifierKey(DroolsSoftKeywords.NEW))) && synpred28_DRL6Expressions()))) {
                alt68 = 5;
            } else if (((synpred29_DRL6Expressions() && (((helper.validateIdentifierKey(DroolsSoftKeywords.SHORT))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.LONG))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.CHAR))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.INT))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.FLOAT))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.BOOLEAN))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.DOUBLE))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.BYTE))))))) {
                alt68 = 6;
            } else if ((synpred32_DRL6Expressions())) {
                alt68 = 9;
            } else {
                if (state.backtracking > 0) {
                    state.failed = true;
                    return result;
                }
                int nvaeMark = input.mark();
                try {
                    input.consume();
                    NoViableAltException nvae = new NoViableAltException("", 68, 11, input);
                    throw nvae;
                } finally {
                    input.rewind(nvaeMark);
                }
            }
        } else if ((LA68_0 == LEFT_SQUARE)) {
            int LA68_12 = input.LA(2);
            if ((synpred30_DRL6Expressions())) {
                alt68 = 7;
            } else if ((synpred31_DRL6Expressions())) {
                alt68 = 8;
            } else {
                if (state.backtracking > 0) {
                    state.failed = true;
                    return result;
                }
                int nvaeMark = input.mark();
                try {
                    input.consume();
                    NoViableAltException nvae = new NoViableAltException("", 68, 12, input);
                    throw nvae;
                } finally {
                    input.rewind(nvaeMark);
                }
            }
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return result;
            }
            NoViableAltException nvae = new NoViableAltException("", 68, 0, input);
            throw nvae;
        }
        switch(alt68) {
            case 1:
                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:579:7: ( LEFT_PAREN )=>expr= parExpression
                {
                    pushFollow(FOLLOW_parExpression_in_primary3045);
                    expr = parExpression();
                    state._fsp--;
                    if (state.failed)
                        return result;
                    if (state.backtracking == 0) {
                        if (buildDescr) {
                            result = expr;
                        }
                    }
                }
                break;
            case 2:
                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:580:9: ( nonWildcardTypeArguments )=> nonWildcardTypeArguments ( explicitGenericInvocationSuffix | this_key arguments )
                {
                    pushFollow(FOLLOW_nonWildcardTypeArguments_in_primary3062);
                    nonWildcardTypeArguments();
                    state._fsp--;
                    if (state.failed)
                        return result;
                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:580:63: ( explicitGenericInvocationSuffix | this_key arguments )
                    int alt63 = 2;
                    int LA63_0 = input.LA(1);
                    if ((LA63_0 == ID)) {
                        int LA63_1 = input.LA(2);
                        if ((!((((helper.validateIdentifierKey(DroolsSoftKeywords.THIS))))))) {
                            alt63 = 1;
                        } else if ((((helper.validateIdentifierKey(DroolsSoftKeywords.THIS))))) {
                            alt63 = 2;
                        } else {
                            if (state.backtracking > 0) {
                                state.failed = true;
                                return result;
                            }
                            int nvaeMark = input.mark();
                            try {
                                input.consume();
                                NoViableAltException nvae = new NoViableAltException("", 63, 1, input);
                                throw nvae;
                            } finally {
                                input.rewind(nvaeMark);
                            }
                        }
                    } else {
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return result;
                        }
                        NoViableAltException nvae = new NoViableAltException("", 63, 0, input);
                        throw nvae;
                    }
                    switch(alt63) {
                        case 1:
                            // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:580:64: explicitGenericInvocationSuffix
                            {
                                pushFollow(FOLLOW_explicitGenericInvocationSuffix_in_primary3065);
                                explicitGenericInvocationSuffix();
                                state._fsp--;
                                if (state.failed)
                                    return result;
                            }
                            break;
                        case 2:
                            // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:580:98: this_key arguments
                            {
                                pushFollow(FOLLOW_this_key_in_primary3069);
                                this_key();
                                state._fsp--;
                                if (state.failed)
                                    return result;
                                pushFollow(FOLLOW_arguments_in_primary3071);
                                arguments();
                                state._fsp--;
                                if (state.failed)
                                    return result;
                            }
                            break;
                    }
                }
                break;
            case 3:
                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:581:9: ( literal )=> literal
                {
                    pushFollow(FOLLOW_literal_in_primary3087);
                    literal11 = literal();
                    state._fsp--;
                    if (state.failed)
                        return result;
                    if (state.backtracking == 0) {
                        if (buildDescr) {
                            result = new AtomicExprDescr((literal11 != null ? input.toString(literal11.start, literal11.stop) : null), true);
                        }
                    }
                }
                break;
            case 4:
                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:583:9: ( super_key )=> super_key superSuffix
                {
                    pushFollow(FOLLOW_super_key_in_primary3109);
                    super_key();
                    state._fsp--;
                    if (state.failed)
                        return result;
                    pushFollow(FOLLOW_superSuffix_in_primary3111);
                    superSuffix();
                    state._fsp--;
                    if (state.failed)
                        return result;
                }
                break;
            case 5:
                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:584:9: ( new_key )=> new_key creator
                {
                    pushFollow(FOLLOW_new_key_in_primary3126);
                    new_key();
                    state._fsp--;
                    if (state.failed)
                        return result;
                    pushFollow(FOLLOW_creator_in_primary3128);
                    creator();
                    state._fsp--;
                    if (state.failed)
                        return result;
                }
                break;
            case 6:
                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:585:9: ( primitiveType )=> primitiveType ( LEFT_SQUARE RIGHT_SQUARE )* DOT class_key
                {
                    pushFollow(FOLLOW_primitiveType_in_primary3143);
                    primitiveType();
                    state._fsp--;
                    if (state.failed)
                        return result;
                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:585:41: ( LEFT_SQUARE RIGHT_SQUARE )*
                    loop64: while (true) {
                        int alt64 = 2;
                        int LA64_0 = input.LA(1);
                        if ((LA64_0 == LEFT_SQUARE)) {
                            alt64 = 1;
                        }
                        switch(alt64) {
                            case 1:
                                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:585:42: LEFT_SQUARE RIGHT_SQUARE
                                {
                                    match(input, LEFT_SQUARE, FOLLOW_LEFT_SQUARE_in_primary3146);
                                    if (state.failed)
                                        return result;
                                    match(input, RIGHT_SQUARE, FOLLOW_RIGHT_SQUARE_in_primary3148);
                                    if (state.failed)
                                        return result;
                                }
                                break;
                            default:
                                break loop64;
                        }
                    }
                    match(input, DOT, FOLLOW_DOT_in_primary3152);
                    if (state.failed)
                        return result;
                    pushFollow(FOLLOW_class_key_in_primary3154);
                    class_key();
                    state._fsp--;
                    if (state.failed)
                        return result;
                }
                break;
            case 7:
                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:587:9: ( inlineMapExpression )=> inlineMapExpression
                {
                    pushFollow(FOLLOW_inlineMapExpression_in_primary3174);
                    inlineMapExpression();
                    state._fsp--;
                    if (state.failed)
                        return result;
                }
                break;
            case 8:
                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:588:9: ( inlineListExpression )=> inlineListExpression
                {
                    pushFollow(FOLLOW_inlineListExpression_in_primary3189);
                    inlineListExpression();
                    state._fsp--;
                    if (state.failed)
                        return result;
                }
                break;
            case 9:
                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:589:9: ( ID )=>i1= ID ( ( ( DOT ID )=>d= DOT i2= ID ) | ( ( ( DOT | NULL_SAFE_DOT ) LEFT_PAREN )=>d= ( DOT | NULL_SAFE_DOT ) LEFT_PAREN expression ( COMMA expression )* RIGHT_PAREN ) | ( ( HASH ID )=>h= HASH i2= ID ) | ( ( NULL_SAFE_DOT ID )=>n= NULL_SAFE_DOT i2= ID ) )* ( ( identifierSuffix )=> identifierSuffix )?
                {
                    i1 = (Token) match(input, ID, FOLLOW_ID_in_primary3205);
                    if (state.failed)
                        return result;
                    if (state.backtracking == 0) {
                        helper.emit(i1, DroolsEditorType.IDENTIFIER);
                    }
                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:590:9: ( ( ( DOT ID )=>d= DOT i2= ID ) | ( ( ( DOT | NULL_SAFE_DOT ) LEFT_PAREN )=>d= ( DOT | NULL_SAFE_DOT ) LEFT_PAREN expression ( COMMA expression )* RIGHT_PAREN ) | ( ( HASH ID )=>h= HASH i2= ID ) | ( ( NULL_SAFE_DOT ID )=>n= NULL_SAFE_DOT i2= ID ) )*
                    loop66: while (true) {
                        int alt66 = 5;
                        int LA66_0 = input.LA(1);
                        if ((LA66_0 == DOT)) {
                            int LA66_2 = input.LA(2);
                            if ((LA66_2 == ID)) {
                                int LA66_5 = input.LA(3);
                                if ((synpred33_DRL6Expressions())) {
                                    alt66 = 1;
                                }
                            } else if ((LA66_2 == LEFT_PAREN) && (synpred34_DRL6Expressions())) {
                                alt66 = 2;
                            }
                        } else if ((LA66_0 == NULL_SAFE_DOT)) {
                            int LA66_3 = input.LA(2);
                            if ((LA66_3 == LEFT_PAREN) && (synpred34_DRL6Expressions())) {
                                alt66 = 2;
                            } else if ((LA66_3 == ID) && (synpred36_DRL6Expressions())) {
                                alt66 = 4;
                            }
                        } else if ((LA66_0 == HASH) && (synpred35_DRL6Expressions())) {
                            alt66 = 3;
                        }
                        switch(alt66) {
                            case 1:
                                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:591:13: ( ( DOT ID )=>d= DOT i2= ID )
                                {
                                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:591:13: ( ( DOT ID )=>d= DOT i2= ID )
                                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:591:15: ( DOT ID )=>d= DOT i2= ID
                                    {
                                        d = (Token) match(input, DOT, FOLLOW_DOT_in_primary3241);
                                        if (state.failed)
                                            return result;
                                        i2 = (Token) match(input, ID, FOLLOW_ID_in_primary3245);
                                        if (state.failed)
                                            return result;
                                        if (state.backtracking == 0) {
                                            helper.emit(d, DroolsEditorType.SYMBOL);
                                            helper.emit(i2, DroolsEditorType.IDENTIFIER);
                                        }
                                    }
                                }
                                break;
                            case 2:
                                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:593:13: ( ( ( DOT | NULL_SAFE_DOT ) LEFT_PAREN )=>d= ( DOT | NULL_SAFE_DOT ) LEFT_PAREN expression ( COMMA expression )* RIGHT_PAREN )
                                {
                                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:593:13: ( ( ( DOT | NULL_SAFE_DOT ) LEFT_PAREN )=>d= ( DOT | NULL_SAFE_DOT ) LEFT_PAREN expression ( COMMA expression )* RIGHT_PAREN )
                                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:593:15: ( ( DOT | NULL_SAFE_DOT ) LEFT_PAREN )=>d= ( DOT | NULL_SAFE_DOT ) LEFT_PAREN expression ( COMMA expression )* RIGHT_PAREN
                                    {
                                        d = input.LT(1);
                                        if (input.LA(1) == DOT || input.LA(1) == NULL_SAFE_DOT) {
                                            input.consume();
                                            state.errorRecovery = false;
                                            state.failed = false;
                                        } else {
                                            if (state.backtracking > 0) {
                                                state.failed = true;
                                                return result;
                                            }
                                            MismatchedSetException mse = new MismatchedSetException(null, input);
                                            throw mse;
                                        }
                                        LEFT_PAREN12 = (Token) match(input, LEFT_PAREN, FOLLOW_LEFT_PAREN_in_primary3297);
                                        if (state.failed)
                                            return result;
                                        if (state.backtracking == 0) {
                                            helper.emit(d, DroolsEditorType.SYMBOL);
                                            helper.emit(LEFT_PAREN12, DroolsEditorType.SYMBOL);
                                        }
                                        pushFollow(FOLLOW_expression_in_primary3337);
                                        expression();
                                        state._fsp--;
                                        if (state.failed)
                                            return result;
                                        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:594:48: ( COMMA expression )*
                                        loop65: while (true) {
                                            int alt65 = 2;
                                            int LA65_0 = input.LA(1);
                                            if ((LA65_0 == COMMA)) {
                                                alt65 = 1;
                                            }
                                            switch(alt65) {
                                                case 1:
                                                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:594:49: COMMA expression
                                                    {
                                                        COMMA13 = (Token) match(input, COMMA, FOLLOW_COMMA_in_primary3340);
                                                        if (state.failed)
                                                            return result;
                                                        if (state.backtracking == 0) {
                                                            helper.emit(COMMA13, DroolsEditorType.SYMBOL);
                                                        }
                                                        pushFollow(FOLLOW_expression_in_primary3344);
                                                        expression();
                                                        state._fsp--;
                                                        if (state.failed)
                                                            return result;
                                                    }
                                                    break;
                                                default:
                                                    break loop65;
                                            }
                                        }
                                        RIGHT_PAREN14 = (Token) match(input, RIGHT_PAREN, FOLLOW_RIGHT_PAREN_in_primary3384);
                                        if (state.failed)
                                            return result;
                                        if (state.backtracking == 0) {
                                            helper.emit(RIGHT_PAREN14, DroolsEditorType.SYMBOL);
                                        }
                                    }
                                }
                                break;
                            case 3:
                                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:598:13: ( ( HASH ID )=>h= HASH i2= ID )
                                {
                                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:598:13: ( ( HASH ID )=>h= HASH i2= ID )
                                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:598:15: ( HASH ID )=>h= HASH i2= ID
                                    {
                                        h = (Token) match(input, HASH, FOLLOW_HASH_in_primary3438);
                                        if (state.failed)
                                            return result;
                                        i2 = (Token) match(input, ID, FOLLOW_ID_in_primary3442);
                                        if (state.failed)
                                            return result;
                                        if (state.backtracking == 0) {
                                            helper.emit(h, DroolsEditorType.SYMBOL);
                                            helper.emit(i2, DroolsEditorType.IDENTIFIER);
                                        }
                                    }
                                }
                                break;
                            case 4:
                                // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:600:13: ( ( NULL_SAFE_DOT ID )=>n= NULL_SAFE_DOT i2= ID )
                                {
                                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:600:13: ( ( NULL_SAFE_DOT ID )=>n= NULL_SAFE_DOT i2= ID )
                                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:600:15: ( NULL_SAFE_DOT ID )=>n= NULL_SAFE_DOT i2= ID
                                    {
                                        n = (Token) match(input, NULL_SAFE_DOT, FOLLOW_NULL_SAFE_DOT_in_primary3484);
                                        if (state.failed)
                                            return result;
                                        i2 = (Token) match(input, ID, FOLLOW_ID_in_primary3488);
                                        if (state.failed)
                                            return result;
                                        if (state.backtracking == 0) {
                                            helper.emit(n, DroolsEditorType.SYMBOL);
                                            helper.emit(i2, DroolsEditorType.IDENTIFIER);
                                        }
                                    }
                                }
                                break;
                            default:
                                break loop66;
                        }
                    }
                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:601:12: ( ( identifierSuffix )=> identifierSuffix )?
                    int alt67 = 2;
                    int LA67_0 = input.LA(1);
                    if ((LA67_0 == LEFT_SQUARE)) {
                        int LA67_1 = input.LA(2);
                        if ((synpred37_DRL6Expressions())) {
                            alt67 = 1;
                        }
                    } else if ((LA67_0 == LEFT_PAREN)) {
                        int LA67_2 = input.LA(2);
                        if ((synpred37_DRL6Expressions())) {
                            alt67 = 1;
                        }
                    }
                    switch(alt67) {
                        case 1:
                            // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:601:13: ( identifierSuffix )=> identifierSuffix
                            {
                                pushFollow(FOLLOW_identifierSuffix_in_primary3510);
                                identifierSuffix();
                                state._fsp--;
                                if (state.failed)
                                    return result;
                            }
                            break;
                    }
                }
                break;
        }
    } catch (RecognitionException re) {
        throw re;
    } finally {
    // do for sure before leaving
    }
    return result;
}
Also used : BaseDescr(org.drools.compiler.lang.descr.BaseDescr) AnnotatedBaseDescr(org.drools.compiler.lang.descr.AnnotatedBaseDescr) AtomicExprDescr(org.drools.compiler.lang.descr.AtomicExprDescr)

Example 74 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class DRL6Expressions method andRestriction.

// $ANTLR end "orRestriction"
// $ANTLR start "andRestriction"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:419:1: andRestriction returns [BaseDescr result] : left= singleRestriction ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )* ;
public final BaseDescr andRestriction() throws RecognitionException {
    BaseDescr result = null;
    Token lop = null;
    BaseDescr left = null;
    AnnotationDescr args = null;
    BaseDescr right = null;
    try {
        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:420:3: (left= singleRestriction ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )* )
        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:420:5: left= singleRestriction ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )*
        {
            pushFollow(FOLLOW_singleRestriction_in_andRestriction1963);
            left = singleRestriction();
            state._fsp--;
            if (state.failed)
                return result;
            if (state.backtracking == 0) {
                if (buildDescr) {
                    result = left;
                }
            }
            // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:421:3: ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )*
            loop42: while (true) {
                int alt42 = 2;
                int LA42_0 = input.LA(1);
                if ((LA42_0 == DOUBLE_AMPER)) {
                    int LA42_9 = input.LA(2);
                    if ((synpred11_DRL6Expressions())) {
                        alt42 = 1;
                    }
                }
                switch(alt42) {
                    case 1:
                        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:421:5: ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction
                        {
                            lop = (Token) match(input, DOUBLE_AMPER, FOLLOW_DOUBLE_AMPER_in_andRestriction1983);
                            if (state.failed)
                                return result;
                            if (state.backtracking == 0) {
                                if (isNotEOF())
                                    helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
                            }
                            // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:423:13: (args= fullAnnotation[null] )?
                            int alt41 = 2;
                            int LA41_0 = input.LA(1);
                            if ((LA41_0 == AT)) {
                                alt41 = 1;
                            }
                            switch(alt41) {
                                case 1:
                                    // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:423:13: args= fullAnnotation[null]
                                    {
                                        pushFollow(FOLLOW_fullAnnotation_in_andRestriction2004);
                                        args = fullAnnotation(null);
                                        state._fsp--;
                                        if (state.failed)
                                            return result;
                                    }
                                    break;
                            }
                            pushFollow(FOLLOW_singleRestriction_in_andRestriction2009);
                            right = singleRestriction();
                            state._fsp--;
                            if (state.failed)
                                return result;
                            if (state.backtracking == 0) {
                                if (buildDescr) {
                                    ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newAnd();
                                    descr.addOrMerge(result);
                                    descr.addOrMerge(right);
                                    if (args != null) {
                                        descr.addAnnotation(args);
                                    }
                                    result = descr;
                                }
                            }
                        }
                        break;
                    default:
                        break loop42;
                }
            }
        }
    } catch (RecognitionException re) {
        throw re;
    } finally {
    // do for sure before leaving
    }
    return result;
}
Also used : BaseDescr(org.drools.compiler.lang.descr.BaseDescr) AnnotatedBaseDescr(org.drools.compiler.lang.descr.AnnotatedBaseDescr) ConstraintConnectiveDescr(org.drools.compiler.lang.descr.ConstraintConnectiveDescr) AnnotationDescr(org.drools.compiler.lang.descr.AnnotationDescr)

Example 75 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class DRL6Expressions method additiveExpression.

// $ANTLR end "shiftOp"
// $ANTLR start "additiveExpression"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:470:1: additiveExpression returns [BaseDescr result] : left= multiplicativeExpression ( ( PLUS | MINUS )=> ( PLUS | MINUS ) multiplicativeExpression )* ;
public final BaseDescr additiveExpression() throws RecognitionException {
    BaseDescr result = null;
    BaseDescr left = null;
    try {
        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:471:5: (left= multiplicativeExpression ( ( PLUS | MINUS )=> ( PLUS | MINUS ) multiplicativeExpression )* )
        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:471:9: left= multiplicativeExpression ( ( PLUS | MINUS )=> ( PLUS | MINUS ) multiplicativeExpression )*
        {
            pushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression2242);
            left = multiplicativeExpression();
            state._fsp--;
            if (state.failed)
                return result;
            if (state.backtracking == 0) {
                if (buildDescr) {
                    result = left;
                }
            }
            // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:472:9: ( ( PLUS | MINUS )=> ( PLUS | MINUS ) multiplicativeExpression )*
            loop47: while (true) {
                int alt47 = 2;
                int LA47_0 = input.LA(1);
                if ((LA47_0 == MINUS || LA47_0 == PLUS) && (synpred14_DRL6Expressions())) {
                    alt47 = 1;
                }
                switch(alt47) {
                    case 1:
                        // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:472:11: ( PLUS | MINUS )=> ( PLUS | MINUS ) multiplicativeExpression
                        {
                            if (input.LA(1) == MINUS || input.LA(1) == PLUS) {
                                input.consume();
                                state.errorRecovery = false;
                                state.failed = false;
                            } else {
                                if (state.backtracking > 0) {
                                    state.failed = true;
                                    return result;
                                }
                                MismatchedSetException mse = new MismatchedSetException(null, input);
                                throw mse;
                            }
                            pushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression2271);
                            multiplicativeExpression();
                            state._fsp--;
                            if (state.failed)
                                return result;
                        }
                        break;
                    default:
                        break loop47;
                }
            }
        }
    } catch (RecognitionException re) {
        throw re;
    } finally {
    // do for sure before leaving
    }
    return result;
}
Also used : BaseDescr(org.drools.compiler.lang.descr.BaseDescr) AnnotatedBaseDescr(org.drools.compiler.lang.descr.AnnotatedBaseDescr)

Aggregations

BaseDescr (org.drools.compiler.lang.descr.BaseDescr)109 AnnotatedBaseDescr (org.drools.compiler.lang.descr.AnnotatedBaseDescr)60 ConstraintConnectiveDescr (org.drools.compiler.lang.descr.ConstraintConnectiveDescr)23 AtomicExprDescr (org.drools.compiler.lang.descr.AtomicExprDescr)17 ConditionalElementDescr (org.drools.compiler.lang.descr.ConditionalElementDescr)16 BindingDescr (org.drools.compiler.lang.descr.BindingDescr)12 AndDescr (org.drools.compiler.lang.descr.AndDescr)11 RelationalExprDescr (org.drools.compiler.lang.descr.RelationalExprDescr)11 DeclareDescrBuilder (org.drools.compiler.lang.api.DeclareDescrBuilder)9 PatternDescr (org.drools.compiler.lang.descr.PatternDescr)8 OrDescr (org.drools.compiler.lang.descr.OrDescr)7 ArrayList (java.util.ArrayList)6 AccumulateDescrBuilder (org.drools.compiler.lang.api.AccumulateDescrBuilder)6 AnnotatedDescrBuilder (org.drools.compiler.lang.api.AnnotatedDescrBuilder)6 AnnotationDescrBuilder (org.drools.compiler.lang.api.AnnotationDescrBuilder)6 AttributeDescrBuilder (org.drools.compiler.lang.api.AttributeDescrBuilder)6 BehaviorDescrBuilder (org.drools.compiler.lang.api.BehaviorDescrBuilder)6 CEDescrBuilder (org.drools.compiler.lang.api.CEDescrBuilder)6 CollectDescrBuilder (org.drools.compiler.lang.api.CollectDescrBuilder)6 ConditionalBranchDescrBuilder (org.drools.compiler.lang.api.ConditionalBranchDescrBuilder)6