use of org.drools.drl.ast.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;
}
use of org.drools.drl.ast.descr.BaseDescr in project drools by kiegroup.
the class DRL6Expressions method unaryExpressionNotPlusMinus.
// $ANTLR start "unaryExpressionNotPlusMinus"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:500:1: unaryExpressionNotPlusMinus returns [BaseDescr result] : ( TILDE unaryExpression | NEGATION ue= unaryExpression | ( castExpression )=> castExpression | ( backReferenceExpression )=> backReferenceExpression | ( ({...}? (var= ID COLON ) ) | ({...}? (var= ID UNIFY ) ) )? ( ( xpathSeparator ID )=>left2= xpathPrimary |left1= primary ) ( ( selector )=> selector )* ( ( INCR | DECR )=> ( INCR | DECR ) )? );
public final DRL6Expressions.unaryExpressionNotPlusMinus_return unaryExpressionNotPlusMinus() throws RecognitionException {
DRL6Expressions.unaryExpressionNotPlusMinus_return retval = new DRL6Expressions.unaryExpressionNotPlusMinus_return();
retval.start = input.LT(1);
Token var = null;
Token COLON9 = null;
Token UNIFY10 = null;
BaseDescr ue = null;
BaseDescr left2 = null;
BaseDescr left1 = null;
boolean isLeft = false;
BindingDescr bind = null;
try {
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:502:5: ( TILDE unaryExpression | NEGATION ue= unaryExpression | ( castExpression )=> castExpression | ( backReferenceExpression )=> backReferenceExpression | ( ({...}? (var= ID COLON ) ) | ({...}? (var= ID UNIFY ) ) )? ( ( xpathSeparator ID )=>left2= xpathPrimary |left1= primary ) ( ( selector )=> selector )* ( ( INCR | DECR )=> ( INCR | DECR ) )? )
int alt54 = 5;
int LA54_0 = input.LA(1);
if ((LA54_0 == TILDE)) {
alt54 = 1;
} else if ((LA54_0 == NEGATION)) {
alt54 = 2;
} else if ((LA54_0 == LEFT_PAREN)) {
int LA54_3 = input.LA(2);
if ((synpred15_DRL6Expressions())) {
alt54 = 3;
} else if ((true)) {
alt54 = 5;
}
} else if ((LA54_0 == DOT) && (synpred16_DRL6Expressions())) {
alt54 = 4;
} else if ((LA54_0 == BOOL || LA54_0 == DECIMAL || LA54_0 == DIV || LA54_0 == FLOAT || LA54_0 == HEX || LA54_0 == ID || (LA54_0 >= LEFT_SQUARE && LA54_0 <= LESS) || LA54_0 == NULL || LA54_0 == QUESTION_DIV || (LA54_0 >= STAR && LA54_0 <= STRING) || LA54_0 == TIME_INTERVAL)) {
alt54 = 5;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 54, 0, input);
throw nvae;
}
switch(alt54) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:502:9: TILDE unaryExpression
{
match(input, TILDE, FOLLOW_TILDE_in_unaryExpressionNotPlusMinus2453);
if (state.failed)
return retval;
pushFollow(FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus2455);
unaryExpression();
state._fsp--;
if (state.failed)
return retval;
}
break;
case 2:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:503:8: NEGATION ue= unaryExpression
{
match(input, NEGATION, FOLLOW_NEGATION_in_unaryExpressionNotPlusMinus2464);
if (state.failed)
return retval;
pushFollow(FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus2468);
ue = unaryExpression();
state._fsp--;
if (state.failed)
return retval;
if (state.backtracking == 0) {
if (buildDescr && ue != null) {
retval.result = ue.negate();
}
}
}
break;
case 3:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:509:9: ( castExpression )=> castExpression
{
pushFollow(FOLLOW_castExpression_in_unaryExpressionNotPlusMinus2492);
castExpression();
state._fsp--;
if (state.failed)
return retval;
}
break;
case 4:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:510:9: ( backReferenceExpression )=> backReferenceExpression
{
pushFollow(FOLLOW_backReferenceExpression_in_unaryExpressionNotPlusMinus2506);
backReferenceExpression();
state._fsp--;
if (state.failed)
return retval;
}
break;
case 5:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:511:9: ( ({...}? (var= ID COLON ) ) | ({...}? (var= ID UNIFY ) ) )? ( ( xpathSeparator ID )=>left2= xpathPrimary |left1= primary ) ( ( selector )=> selector )* ( ( INCR | DECR )=> ( INCR | DECR ) )?
{
if (state.backtracking == 0) {
isLeft = helper.getLeftMostExpr() == null;
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:512:9: ( ({...}? (var= ID COLON ) ) | ({...}? (var= ID UNIFY ) ) )?
int alt50 = 3;
int LA50_0 = input.LA(1);
if ((LA50_0 == ID)) {
int LA50_1 = input.LA(2);
if ((LA50_1 == COLON)) {
int LA50_3 = input.LA(3);
if (((inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.COLON))) {
alt50 = 1;
}
} else if ((LA50_1 == UNIFY)) {
alt50 = 2;
}
}
switch(alt50) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:512:11: ({...}? (var= ID COLON ) )
{
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:512:11: ({...}? (var= ID COLON ) )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:512:12: {...}? (var= ID COLON )
{
if (!((inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.COLON))) {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
throw new FailedPredicateException(input, "unaryExpressionNotPlusMinus", "inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.COLON");
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:512:75: (var= ID COLON )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:512:76: var= ID COLON
{
var = (Token) match(input, ID, FOLLOW_ID_in_unaryExpressionNotPlusMinus2534);
if (state.failed)
return retval;
COLON9 = (Token) match(input, COLON, FOLLOW_COLON_in_unaryExpressionNotPlusMinus2536);
if (state.failed)
return retval;
if (state.backtracking == 0) {
hasBindings = true;
helper.emit(var, DroolsEditorType.IDENTIFIER_VARIABLE);
helper.emit(COLON9, DroolsEditorType.SYMBOL);
if (buildDescr) {
bind = new BindingDescr((var != null ? var.getText() : null), null, false);
helper.setStart(bind, var);
}
}
}
}
}
break;
case 2:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:514:11: ({...}? (var= ID UNIFY ) )
{
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:514:11: ({...}? (var= ID UNIFY ) )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:514:12: {...}? (var= ID UNIFY )
{
if (!((inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.UNIFY))) {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
throw new FailedPredicateException(input, "unaryExpressionNotPlusMinus", "inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.UNIFY");
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:514:75: (var= ID UNIFY )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:514:76: var= ID UNIFY
{
var = (Token) match(input, ID, FOLLOW_ID_in_unaryExpressionNotPlusMinus2575);
if (state.failed)
return retval;
UNIFY10 = (Token) match(input, UNIFY, FOLLOW_UNIFY_in_unaryExpressionNotPlusMinus2577);
if (state.failed)
return retval;
if (state.backtracking == 0) {
hasBindings = true;
helper.emit(var, DroolsEditorType.IDENTIFIER_VARIABLE);
helper.emit(UNIFY10, DroolsEditorType.SYMBOL);
if (buildDescr) {
bind = new BindingDescr((var != null ? var.getText() : null), null, true);
helper.setStart(bind, var);
}
}
}
}
}
break;
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:518:9: ( ( xpathSeparator ID )=>left2= xpathPrimary |left1= primary )
int alt51 = 2;
int LA51_0 = input.LA(1);
if ((LA51_0 == DIV || LA51_0 == QUESTION_DIV) && (synpred17_DRL6Expressions())) {
alt51 = 1;
} else if ((LA51_0 == BOOL || LA51_0 == DECIMAL || LA51_0 == FLOAT || LA51_0 == HEX || LA51_0 == ID || (LA51_0 >= LEFT_PAREN && LA51_0 <= LESS) || LA51_0 == NULL || (LA51_0 >= STAR && LA51_0 <= STRING) || LA51_0 == TIME_INTERVAL)) {
alt51 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 51, 0, input);
throw nvae;
}
switch(alt51) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:518:11: ( xpathSeparator ID )=>left2= xpathPrimary
{
pushFollow(FOLLOW_xpathPrimary_in_unaryExpressionNotPlusMinus2631);
left2 = xpathPrimary();
state._fsp--;
if (state.failed)
return retval;
if (state.backtracking == 0) {
if (buildDescr) {
retval.result = left2;
}
}
}
break;
case 2:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:519:13: left1= primary
{
pushFollow(FOLLOW_primary_in_unaryExpressionNotPlusMinus2649);
left1 = primary();
state._fsp--;
if (state.failed)
return retval;
if (state.backtracking == 0) {
if (buildDescr) {
retval.result = left1;
}
}
}
break;
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:522:9: ( ( selector )=> selector )*
loop52: while (true) {
int alt52 = 2;
int LA52_0 = input.LA(1);
if ((LA52_0 == DOT) && (synpred18_DRL6Expressions())) {
alt52 = 1;
} else if ((LA52_0 == NULL_SAFE_DOT) && (synpred18_DRL6Expressions())) {
alt52 = 1;
} else if ((LA52_0 == LEFT_SQUARE) && (synpred18_DRL6Expressions())) {
alt52 = 1;
}
switch(alt52) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:522:10: ( selector )=> selector
{
pushFollow(FOLLOW_selector_in_unaryExpressionNotPlusMinus2677);
selector();
state._fsp--;
if (state.failed)
return retval;
}
break;
default:
break loop52;
}
}
if (state.backtracking == 0) {
if (buildDescr) {
String expr = input.toString(retval.start, input.LT(-1));
if (isLeft) {
helper.setLeftMostExpr(expr);
}
if (bind != null) {
if (bind.isUnification()) {
expr = expr.substring(expr.indexOf(":=") + 2).trim();
} else {
expr = expr.substring(expr.indexOf(":") + 1).trim();
}
bind.setExpressionAndBindingField(expr);
helper.setEnd(bind);
retval.result = bind;
}
}
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:541:9: ( ( INCR | DECR )=> ( INCR | DECR ) )?
int alt53 = 2;
int LA53_0 = input.LA(1);
if ((LA53_0 == DECR || LA53_0 == INCR) && (synpred19_DRL6Expressions())) {
alt53 = 1;
}
switch(alt53) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:541:10: ( INCR | DECR )=> ( INCR | DECR )
{
if (input.LA(1) == DECR || input.LA(1) == INCR) {
input.consume();
state.errorRecovery = false;
state.failed = false;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
MismatchedSetException mse = new MismatchedSetException(null, input);
throw mse;
}
}
break;
}
}
break;
}
retval.stop = input.LT(-1);
} catch (RecognitionException re) {
throw re;
} finally {
// do for sure before leaving
}
return retval;
}
use of org.drools.drl.ast.descr.BaseDescr 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;
}
use of org.drools.drl.ast.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:583: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:584: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:584:7: ( LEFT_PAREN )=>expr= parExpression
{
pushFollow(FOLLOW_parExpression_in_primary3057);
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:585:9: ( nonWildcardTypeArguments )=> nonWildcardTypeArguments ( explicitGenericInvocationSuffix | this_key arguments )
{
pushFollow(FOLLOW_nonWildcardTypeArguments_in_primary3074);
nonWildcardTypeArguments();
state._fsp--;
if (state.failed)
return result;
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:585: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:585:64: explicitGenericInvocationSuffix
{
pushFollow(FOLLOW_explicitGenericInvocationSuffix_in_primary3077);
explicitGenericInvocationSuffix();
state._fsp--;
if (state.failed)
return result;
}
break;
case 2:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:585:98: this_key arguments
{
pushFollow(FOLLOW_this_key_in_primary3081);
this_key();
state._fsp--;
if (state.failed)
return result;
pushFollow(FOLLOW_arguments_in_primary3083);
arguments();
state._fsp--;
if (state.failed)
return result;
}
break;
}
}
break;
case 3:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:586:9: ( literal )=> literal
{
pushFollow(FOLLOW_literal_in_primary3099);
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:588:9: ( super_key )=> super_key superSuffix
{
pushFollow(FOLLOW_super_key_in_primary3121);
super_key();
state._fsp--;
if (state.failed)
return result;
pushFollow(FOLLOW_superSuffix_in_primary3123);
superSuffix();
state._fsp--;
if (state.failed)
return result;
}
break;
case 5:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:589:9: ( new_key )=> new_key creator
{
pushFollow(FOLLOW_new_key_in_primary3138);
new_key();
state._fsp--;
if (state.failed)
return result;
pushFollow(FOLLOW_creator_in_primary3140);
creator();
state._fsp--;
if (state.failed)
return result;
}
break;
case 6:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:590:9: ( primitiveType )=> primitiveType ( LEFT_SQUARE RIGHT_SQUARE )* DOT class_key
{
pushFollow(FOLLOW_primitiveType_in_primary3155);
primitiveType();
state._fsp--;
if (state.failed)
return result;
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:590: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:590:42: LEFT_SQUARE RIGHT_SQUARE
{
match(input, LEFT_SQUARE, FOLLOW_LEFT_SQUARE_in_primary3158);
if (state.failed)
return result;
match(input, RIGHT_SQUARE, FOLLOW_RIGHT_SQUARE_in_primary3160);
if (state.failed)
return result;
}
break;
default:
break loop64;
}
}
match(input, DOT, FOLLOW_DOT_in_primary3164);
if (state.failed)
return result;
pushFollow(FOLLOW_class_key_in_primary3166);
class_key();
state._fsp--;
if (state.failed)
return result;
}
break;
case 7:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:592:9: ( inlineMapExpression )=> inlineMapExpression
{
pushFollow(FOLLOW_inlineMapExpression_in_primary3186);
inlineMapExpression();
state._fsp--;
if (state.failed)
return result;
}
break;
case 8:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:593:9: ( inlineListExpression )=> inlineListExpression
{
pushFollow(FOLLOW_inlineListExpression_in_primary3201);
inlineListExpression();
state._fsp--;
if (state.failed)
return result;
}
break;
case 9:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:594: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_primary3217);
if (state.failed)
return result;
if (state.backtracking == 0) {
helper.emit(i1, DroolsEditorType.IDENTIFIER);
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:595: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)) {
int LA66_7 = input.LA(3);
if ((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:596:13: ( ( DOT ID )=>d= DOT i2= ID )
{
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:596:13: ( ( DOT ID )=>d= DOT i2= ID )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:596:15: ( DOT ID )=>d= DOT i2= ID
{
d = (Token) match(input, DOT, FOLLOW_DOT_in_primary3253);
if (state.failed)
return result;
i2 = (Token) match(input, ID, FOLLOW_ID_in_primary3257);
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:598: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:598: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:598: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_primary3309);
if (state.failed)
return result;
if (state.backtracking == 0) {
helper.emit(d, DroolsEditorType.SYMBOL);
helper.emit(LEFT_PAREN12, DroolsEditorType.SYMBOL);
}
pushFollow(FOLLOW_expression_in_primary3349);
expression();
state._fsp--;
if (state.failed)
return result;
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:599: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:599:49: COMMA expression
{
COMMA13 = (Token) match(input, COMMA, FOLLOW_COMMA_in_primary3352);
if (state.failed)
return result;
if (state.backtracking == 0) {
helper.emit(COMMA13, DroolsEditorType.SYMBOL);
}
pushFollow(FOLLOW_expression_in_primary3356);
expression();
state._fsp--;
if (state.failed)
return result;
}
break;
default:
break loop65;
}
}
RIGHT_PAREN14 = (Token) match(input, RIGHT_PAREN, FOLLOW_RIGHT_PAREN_in_primary3396);
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:603:13: ( ( HASH ID )=>h= HASH i2= ID )
{
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:603:13: ( ( HASH ID )=>h= HASH i2= ID )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:603:15: ( HASH ID )=>h= HASH i2= ID
{
h = (Token) match(input, HASH, FOLLOW_HASH_in_primary3450);
if (state.failed)
return result;
i2 = (Token) match(input, ID, FOLLOW_ID_in_primary3454);
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:605:13: ( ( NULL_SAFE_DOT ID )=>n= NULL_SAFE_DOT i2= ID )
{
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:605:13: ( ( NULL_SAFE_DOT ID )=>n= NULL_SAFE_DOT i2= ID )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:605:15: ( NULL_SAFE_DOT ID )=>n= NULL_SAFE_DOT i2= ID
{
n = (Token) match(input, NULL_SAFE_DOT, FOLLOW_NULL_SAFE_DOT_in_primary3496);
if (state.failed)
return result;
i2 = (Token) match(input, ID, FOLLOW_ID_in_primary3500);
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:606: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:606:13: ( identifierSuffix )=> identifierSuffix
{
pushFollow(FOLLOW_identifierSuffix_in_primary3522);
identifierSuffix();
state._fsp--;
if (state.failed)
return result;
}
break;
}
}
break;
}
} catch (RecognitionException re) {
throw re;
} finally {
// do for sure before leaving
}
return result;
}
use of org.drools.drl.ast.descr.BaseDescr in project drools by kiegroup.
the class DRL6Expressions method conditionalAndExpression.
// $ANTLR end "conditionalOrExpression"
// $ANTLR start "conditionalAndExpression"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:244:1: conditionalAndExpression returns [BaseDescr result] : left= inclusiveOrExpression ( DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression )* ;
public final BaseDescr conditionalAndExpression() throws RecognitionException {
BaseDescr result = null;
BaseDescr left = null;
AnnotationDescr args = null;
BaseDescr right = null;
try {
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:245:3: (left= inclusiveOrExpression ( DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression )* )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:245:5: left= inclusiveOrExpression ( DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression )*
{
pushFollow(FOLLOW_inclusiveOrExpression_in_conditionalAndExpression1264);
left = inclusiveOrExpression();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
if (buildDescr) {
result = left;
}
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:246:3: ( DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression )*
loop27: while (true) {
int alt27 = 2;
int LA27_0 = input.LA(1);
if ((LA27_0 == DOUBLE_AMPER)) {
alt27 = 1;
}
switch(alt27) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:246:5: DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression
{
match(input, DOUBLE_AMPER, FOLLOW_DOUBLE_AMPER_in_conditionalAndExpression1272);
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:248:13: (args= fullAnnotation[null] )?
int alt26 = 2;
int LA26_0 = input.LA(1);
if ((LA26_0 == AT)) {
alt26 = 1;
}
switch(alt26) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:248:13: args= fullAnnotation[null]
{
pushFollow(FOLLOW_fullAnnotation_in_conditionalAndExpression1295);
args = fullAnnotation(null);
state._fsp--;
if (state.failed)
return result;
}
break;
}
pushFollow(FOLLOW_inclusiveOrExpression_in_conditionalAndExpression1301);
right = inclusiveOrExpression();
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 loop27;
}
}
}
} catch (RecognitionException re) {
throw re;
} finally {
// do for sure before leaving
}
return result;
}
Aggregations