use of org.drools.drl.ast.descr.AtomicExprDescr in project drools by kiegroup.
the class DRL6Expressions method relationalExpression.
// $ANTLR start "relationalExpression"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:368:1: relationalExpression returns [BaseDescr result] : left= shiftExpression ( ( operator | LEFT_PAREN )=>right= orRestriction )* ;
public final BaseDescr relationalExpression() throws RecognitionException {
relationalExpression_stack.push(new relationalExpression_scope());
BaseDescr result = null;
ParserRuleReturnScope left = null;
BaseDescr right = null;
relationalExpression_stack.peek().lsd = null;
try {
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:371:3: (left= shiftExpression ( ( operator | LEFT_PAREN )=>right= orRestriction )* )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:371:5: left= shiftExpression ( ( operator | LEFT_PAREN )=>right= orRestriction )*
{
pushFollow(FOLLOW_shiftExpression_in_relationalExpression1832);
left = shiftExpression();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
if (buildDescr) {
if ((left != null ? ((DRL6Expressions.shiftExpression_return) left).result : null) == null) {
result = new AtomicExprDescr((left != null ? input.toString(left.start, left.stop) : null));
} else if ((left != null ? ((DRL6Expressions.shiftExpression_return) left).result : null) instanceof AtomicExprDescr) {
if ((left != null ? input.toString(left.start, left.stop) : null).equals(((AtomicExprDescr) (left != null ? ((DRL6Expressions.shiftExpression_return) left).result : null)).getExpression())) {
result = (left != null ? ((DRL6Expressions.shiftExpression_return) left).result : null);
} else {
result = new AtomicExprDescr((left != null ? input.toString(left.start, left.stop) : null));
}
} else if ((left != null ? ((DRL6Expressions.shiftExpression_return) left).result : null) instanceof BindingDescr) {
if ((left != null ? input.toString(left.start, left.stop) : null).equals(((BindingDescr) (left != null ? ((DRL6Expressions.shiftExpression_return) left).result : null)).getExpression())) {
result = (left != null ? ((DRL6Expressions.shiftExpression_return) left).result : null);
} else {
BindingDescr bind = (BindingDescr) (left != null ? ((DRL6Expressions.shiftExpression_return) left).result : null);
int offset = bind.isUnification() ? 2 : 1;
String fullExpression = (left != null ? input.toString(left.start, left.stop) : null).substring((left != null ? input.toString(left.start, left.stop) : null).indexOf(":") + offset).trim();
result = new BindingDescr(bind.getVariable(), bind.getExpression(), fullExpression, bind.isUnification());
}
} else {
result = (left != null ? ((DRL6Expressions.shiftExpression_return) left).result : null);
}
relationalExpression_stack.peek().lsd = result;
}
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:396:3: ( ( operator | LEFT_PAREN )=>right= orRestriction )*
loop37: while (true) {
int alt37 = 2;
int LA37_0 = input.LA(1);
if ((LA37_0 == ID)) {
int LA37_2 = input.LA(2);
if ((((((helper.validateIdentifierKey(DroolsSoftKeywords.NOT))) || ((helper.isPluggableEvaluator(false)))) && synpred9_DRL6Expressions()))) {
alt37 = 1;
}
} else if ((LA37_0 == EQUALS)) {
int LA37_3 = input.LA(2);
if ((synpred9_DRL6Expressions())) {
alt37 = 1;
}
} else if ((LA37_0 == NOT_EQUALS)) {
int LA37_4 = input.LA(2);
if ((synpred9_DRL6Expressions())) {
alt37 = 1;
}
} else if ((LA37_0 == LESS)) {
int LA37_20 = input.LA(2);
if ((synpred9_DRL6Expressions())) {
alt37 = 1;
}
} else if ((LA37_0 == GREATER)) {
int LA37_21 = input.LA(2);
if ((synpred9_DRL6Expressions())) {
alt37 = 1;
}
} else if ((LA37_0 == TILDE) && (synpred9_DRL6Expressions())) {
alt37 = 1;
} else if ((LA37_0 == LESS_EQUALS) && (synpred9_DRL6Expressions())) {
alt37 = 1;
} else if ((LA37_0 == GREATER_EQUALS) && (synpred9_DRL6Expressions())) {
alt37 = 1;
} else if ((LA37_0 == LEFT_PAREN) && (synpred9_DRL6Expressions())) {
alt37 = 1;
}
switch(alt37) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:396:5: ( operator | LEFT_PAREN )=>right= orRestriction
{
pushFollow(FOLLOW_orRestriction_in_relationalExpression1857);
right = orRestriction();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
if (buildDescr) {
result = right;
relationalExpression_stack.peek().lsd = result;
}
}
}
break;
default:
break loop37;
}
}
}
} catch (RecognitionException re) {
throw re;
} finally {
// do for sure before leaving
relationalExpression_stack.pop();
}
return result;
}
use of org.drools.drl.ast.descr.AtomicExprDescr in project drools by kiegroup.
the class DRL6Expressions method inExpression.
// $ANTLR end "instanceOfExpression"
// $ANTLR start "inExpression"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:325: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/DRL6Expressions.g:328: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/DRL6Expressions.g:328: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_inExpression1615);
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/DRL6Expressions.g:337: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))) && synpred8_DRL6Expressions()))) {
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/DRL6Expressions.g:337:6: ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
{
pushFollow(FOLLOW_not_key_in_inExpression1635);
not_key();
state._fsp--;
if (state.failed)
return result;
pushFollow(FOLLOW_in_key_in_inExpression1639);
in_key();
state._fsp--;
if (state.failed)
return result;
match(input, LEFT_PAREN, FOLLOW_LEFT_PAREN_in_inExpression1641);
if (state.failed)
return result;
if (state.backtracking == 0) {
helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
}
pushFollow(FOLLOW_expression_in_inExpression1663);
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 ? ((DRL6Expressions.expression_return) e1).result : null));
descr.addOrMerge(rel);
result = descr;
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:345: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/DRL6Expressions.g:345:8: COMMA e2= expression
{
match(input, COMMA, FOLLOW_COMMA_in_inExpression1682);
if (state.failed)
return result;
pushFollow(FOLLOW_expression_in_inExpression1686);
e2 = expression();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
RelationalExprDescr rel = new RelationalExprDescr("!=", false, null, leftDescr, (e2 != null ? ((DRL6Expressions.expression_return) e2).result : null));
descr.addOrMerge(rel);
}
}
break;
default:
break loop34;
}
}
match(input, RIGHT_PAREN, FOLLOW_RIGHT_PAREN_in_inExpression1707);
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/DRL6Expressions.g:351:7: in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN
{
pushFollow(FOLLOW_in_key_in_inExpression1723);
in_key();
state._fsp--;
if (state.failed)
return result;
match(input, LEFT_PAREN, FOLLOW_LEFT_PAREN_in_inExpression1725);
if (state.failed)
return result;
if (state.backtracking == 0) {
helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
}
pushFollow(FOLLOW_expression_in_inExpression1747);
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 ? ((DRL6Expressions.expression_return) e1).result : null));
descr.addOrMerge(rel);
result = descr;
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:359: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/DRL6Expressions.g:359:8: COMMA e2= expression
{
match(input, COMMA, FOLLOW_COMMA_in_inExpression1766);
if (state.failed)
return result;
pushFollow(FOLLOW_expression_in_inExpression1770);
e2 = expression();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
RelationalExprDescr rel = new RelationalExprDescr("==", false, null, leftDescr, (e2 != null ? ((DRL6Expressions.expression_return) e2).result : null));
descr.addOrMerge(rel);
}
}
break;
default:
break loop35;
}
}
match(input, RIGHT_PAREN, FOLLOW_RIGHT_PAREN_in_inExpression1791);
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;
}
use of org.drools.drl.ast.descr.AtomicExprDescr in project drools by kiegroup.
the class DRL6Expressions method singleRestriction.
// $ANTLR end "andRestriction"
// $ANTLR start "singleRestriction"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:435: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/DRL6Expressions.g:436: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/DRL6Expressions.g:436:6: op= operator ( ( squareArguments shiftExpression )=>sa= squareArguments value= shiftExpression |value= shiftExpression )
{
pushFollow(FOLLOW_operator_in_singleRestriction2045);
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/DRL6Expressions.g:438: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 ((synpred12_DRL6Expressions())) {
alt43 = 1;
} else if ((true)) {
alt43 = 2;
}
} else if ((LA43_0 == BOOL || (LA43_0 >= DECIMAL && LA43_0 <= DIV) || LA43_0 == DOT || 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 == QUESTION_DIV || (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/DRL6Expressions.g:438:8: ( squareArguments shiftExpression )=>sa= squareArguments value= shiftExpression
{
pushFollow(FOLLOW_squareArguments_in_singleRestriction2074);
sa = squareArguments();
state._fsp--;
if (state.failed)
return result;
pushFollow(FOLLOW_shiftExpression_in_singleRestriction2078);
value = shiftExpression();
state._fsp--;
if (state.failed)
return result;
}
break;
case 2:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:439:10: value= shiftExpression
{
pushFollow(FOLLOW_shiftExpression_in_singleRestriction2091);
value = shiftExpression();
state._fsp--;
if (state.failed)
return result;
}
break;
}
if (state.backtracking == 0) {
if (buildDescr) {
BaseDescr descr = ((value != null ? ((DRL6Expressions.shiftExpression_return) value).result : null) != null && ((!((value != null ? ((DRL6Expressions.shiftExpression_return) value).result : null) instanceof AtomicExprDescr)) || ((value != null ? input.toString(value.start, value.stop) : null).equals(((AtomicExprDescr) (value != null ? ((DRL6Expressions.shiftExpression_return) value).result : null)).getExpression())))) ? (value != null ? ((DRL6Expressions.shiftExpression_return) value).result : null) : new AtomicExprDescr((value != null ? input.toString(value.start, value.stop) : null));
result = new RelationalExprDescr((op != null ? ((DRL6Expressions.operator_return) op).opr : null), (op != null ? ((DRL6Expressions.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/DRL6Expressions.g:454:6: LEFT_PAREN or= orRestriction RIGHT_PAREN
{
match(input, LEFT_PAREN, FOLLOW_LEFT_PAREN_in_singleRestriction2116);
if (state.failed)
return result;
pushFollow(FOLLOW_orRestriction_in_singleRestriction2120);
or = orRestriction();
state._fsp--;
if (state.failed)
return result;
match(input, RIGHT_PAREN, FOLLOW_RIGHT_PAREN_in_singleRestriction2122);
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;
}
use of org.drools.drl.ast.descr.AtomicExprDescr 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;
}
use of org.drools.drl.ast.descr.AtomicExprDescr in project drools by kiegroup.
the class DRL5Expressions method primary.
// $ANTLR end "primitiveType"
// $ANTLR start "primary"
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:536: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 )=> DOT i2= ID ) | ( ( SHARP ID )=> SHARP i2= ID ) | ( ( HASH ID )=> HASH i2= ID ) | ( ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID ) )* ( ( identifierSuffix )=> identifierSuffix )? );
public final BaseDescr primary() throws RecognitionException {
BaseDescr result = null;
Token i1 = null;
Token i2 = null;
Token DOT12 = null;
Token SHARP13 = null;
Token HASH14 = null;
Token NULL_SAFE_DOT15 = null;
BaseDescr expr = null;
ParserRuleReturnScope literal11 = null;
try {
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:537: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 )=> DOT i2= ID ) | ( ( SHARP ID )=> SHARP i2= ID ) | ( ( HASH ID )=> HASH i2= ID ) | ( ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID ) )* ( ( identifierSuffix )=> identifierSuffix )? )
int alt60 = 9;
int LA60_0 = input.LA(1);
if ((LA60_0 == LEFT_PAREN) && (synpred19_DRL5Expressions())) {
alt60 = 1;
} else if ((LA60_0 == LESS) && (synpred20_DRL5Expressions())) {
alt60 = 2;
} else if ((LA60_0 == STRING) && (synpred21_DRL5Expressions())) {
alt60 = 3;
} else if ((LA60_0 == DECIMAL) && (synpred21_DRL5Expressions())) {
alt60 = 3;
} else if ((LA60_0 == HEX) && (synpred21_DRL5Expressions())) {
alt60 = 3;
} else if ((LA60_0 == FLOAT) && (synpred21_DRL5Expressions())) {
alt60 = 3;
} else if ((LA60_0 == BOOL) && (synpred21_DRL5Expressions())) {
alt60 = 3;
} else if ((LA60_0 == NULL) && (synpred21_DRL5Expressions())) {
alt60 = 3;
} else if ((LA60_0 == TIME_INTERVAL) && (synpred21_DRL5Expressions())) {
alt60 = 3;
} else if ((LA60_0 == STAR) && (synpred21_DRL5Expressions())) {
alt60 = 3;
} else if ((LA60_0 == ID)) {
int LA60_11 = input.LA(2);
if (((((helper.validateIdentifierKey(DroolsSoftKeywords.SUPER))) && synpred22_DRL5Expressions()))) {
alt60 = 4;
} else if (((synpred23_DRL5Expressions() && ((helper.validateIdentifierKey(DroolsSoftKeywords.NEW)))))) {
alt60 = 5;
} else if ((((((helper.validateIdentifierKey(DroolsSoftKeywords.SHORT))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.LONG))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.BOOLEAN))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.BYTE))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.FLOAT))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.DOUBLE))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.INT))) || ((helper.validateIdentifierKey(DroolsSoftKeywords.CHAR)))) && synpred24_DRL5Expressions()))) {
alt60 = 6;
} else if ((synpred27_DRL5Expressions())) {
alt60 = 9;
} else {
if (state.backtracking > 0) {
state.failed = true;
return result;
}
int nvaeMark = input.mark();
try {
input.consume();
NoViableAltException nvae = new NoViableAltException("", 60, 11, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
} else if ((LA60_0 == LEFT_SQUARE)) {
int LA60_12 = input.LA(2);
if ((synpred25_DRL5Expressions())) {
alt60 = 7;
} else if ((synpred26_DRL5Expressions())) {
alt60 = 8;
} else {
if (state.backtracking > 0) {
state.failed = true;
return result;
}
int nvaeMark = input.mark();
try {
input.consume();
NoViableAltException nvae = new NoViableAltException("", 60, 12, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
} else {
if (state.backtracking > 0) {
state.failed = true;
return result;
}
NoViableAltException nvae = new NoViableAltException("", 60, 0, input);
throw nvae;
}
switch(alt60) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:537:7: ( LEFT_PAREN )=>expr= parExpression
{
pushFollow(FOLLOW_parExpression_in_primary2727);
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/DRL5Expressions.g:538:9: ( nonWildcardTypeArguments )=> nonWildcardTypeArguments ( explicitGenericInvocationSuffix | this_key arguments )
{
pushFollow(FOLLOW_nonWildcardTypeArguments_in_primary2744);
nonWildcardTypeArguments();
state._fsp--;
if (state.failed)
return result;
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:538:63: ( explicitGenericInvocationSuffix | this_key arguments )
int alt56 = 2;
int LA56_0 = input.LA(1);
if ((LA56_0 == ID)) {
int LA56_1 = input.LA(2);
if ((!((((helper.validateIdentifierKey(DroolsSoftKeywords.THIS))))))) {
alt56 = 1;
} else if ((((helper.validateIdentifierKey(DroolsSoftKeywords.THIS))))) {
alt56 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return result;
}
int nvaeMark = input.mark();
try {
input.consume();
NoViableAltException nvae = new NoViableAltException("", 56, 1, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
} else {
if (state.backtracking > 0) {
state.failed = true;
return result;
}
NoViableAltException nvae = new NoViableAltException("", 56, 0, input);
throw nvae;
}
switch(alt56) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:538:64: explicitGenericInvocationSuffix
{
pushFollow(FOLLOW_explicitGenericInvocationSuffix_in_primary2747);
explicitGenericInvocationSuffix();
state._fsp--;
if (state.failed)
return result;
}
break;
case 2:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:538:98: this_key arguments
{
pushFollow(FOLLOW_this_key_in_primary2751);
this_key();
state._fsp--;
if (state.failed)
return result;
pushFollow(FOLLOW_arguments_in_primary2753);
arguments();
state._fsp--;
if (state.failed)
return result;
}
break;
}
}
break;
case 3:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:539:9: ( literal )=> literal
{
pushFollow(FOLLOW_literal_in_primary2769);
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/DRL5Expressions.g:541:9: ( super_key )=> super_key superSuffix
{
pushFollow(FOLLOW_super_key_in_primary2791);
super_key();
state._fsp--;
if (state.failed)
return result;
pushFollow(FOLLOW_superSuffix_in_primary2793);
superSuffix();
state._fsp--;
if (state.failed)
return result;
}
break;
case 5:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:542:9: ( new_key )=> new_key creator
{
pushFollow(FOLLOW_new_key_in_primary2808);
new_key();
state._fsp--;
if (state.failed)
return result;
pushFollow(FOLLOW_creator_in_primary2810);
creator();
state._fsp--;
if (state.failed)
return result;
}
break;
case 6:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:543:9: ( primitiveType )=> primitiveType ( LEFT_SQUARE RIGHT_SQUARE )* DOT class_key
{
pushFollow(FOLLOW_primitiveType_in_primary2825);
primitiveType();
state._fsp--;
if (state.failed)
return result;
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:543:41: ( LEFT_SQUARE RIGHT_SQUARE )*
loop57: while (true) {
int alt57 = 2;
int LA57_0 = input.LA(1);
if ((LA57_0 == LEFT_SQUARE)) {
alt57 = 1;
}
switch(alt57) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:543:42: LEFT_SQUARE RIGHT_SQUARE
{
match(input, LEFT_SQUARE, FOLLOW_LEFT_SQUARE_in_primary2828);
if (state.failed)
return result;
match(input, RIGHT_SQUARE, FOLLOW_RIGHT_SQUARE_in_primary2830);
if (state.failed)
return result;
}
break;
default:
break loop57;
}
}
match(input, DOT, FOLLOW_DOT_in_primary2834);
if (state.failed)
return result;
pushFollow(FOLLOW_class_key_in_primary2836);
class_key();
state._fsp--;
if (state.failed)
return result;
}
break;
case 7:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:545:9: ( inlineMapExpression )=> inlineMapExpression
{
pushFollow(FOLLOW_inlineMapExpression_in_primary2856);
inlineMapExpression();
state._fsp--;
if (state.failed)
return result;
}
break;
case 8:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:546:9: ( inlineListExpression )=> inlineListExpression
{
pushFollow(FOLLOW_inlineListExpression_in_primary2871);
inlineListExpression();
state._fsp--;
if (state.failed)
return result;
}
break;
case 9:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:547:9: ( ID )=>i1= ID ( ( ( DOT ID )=> DOT i2= ID ) | ( ( SHARP ID )=> SHARP i2= ID ) | ( ( HASH ID )=> HASH i2= ID ) | ( ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID ) )* ( ( identifierSuffix )=> identifierSuffix )?
{
i1 = (Token) match(input, ID, FOLLOW_ID_in_primary2887);
if (state.failed)
return result;
if (state.backtracking == 0) {
helper.emit(i1, DroolsEditorType.IDENTIFIER);
}
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:548:9: ( ( ( DOT ID )=> DOT i2= ID ) | ( ( SHARP ID )=> SHARP i2= ID ) | ( ( HASH ID )=> HASH i2= ID ) | ( ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID ) )*
loop58: while (true) {
int alt58 = 5;
int LA58_0 = input.LA(1);
if ((LA58_0 == DOT)) {
int LA58_2 = input.LA(2);
if ((LA58_2 == ID)) {
int LA58_6 = input.LA(3);
if ((synpred28_DRL5Expressions())) {
alt58 = 1;
}
}
} else if ((LA58_0 == SHARP) && (synpred29_DRL5Expressions())) {
alt58 = 2;
} else if ((LA58_0 == HASH) && (synpred30_DRL5Expressions())) {
alt58 = 3;
} else if ((LA58_0 == NULL_SAFE_DOT) && (synpred31_DRL5Expressions())) {
alt58 = 4;
}
switch(alt58) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:549:13: ( ( DOT ID )=> DOT i2= ID )
{
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:549:13: ( ( DOT ID )=> DOT i2= ID )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:549:15: ( DOT ID )=> DOT i2= ID
{
DOT12 = (Token) match(input, DOT, FOLLOW_DOT_in_primary2921);
if (state.failed)
return result;
i2 = (Token) match(input, ID, FOLLOW_ID_in_primary2925);
if (state.failed)
return result;
if (state.backtracking == 0) {
helper.emit(DOT12, DroolsEditorType.SYMBOL);
helper.emit(i2, DroolsEditorType.IDENTIFIER);
}
}
}
break;
case 2:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:551:13: ( ( SHARP ID )=> SHARP i2= ID )
{
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:551:13: ( ( SHARP ID )=> SHARP i2= ID )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:551:15: ( SHARP ID )=> SHARP i2= ID
{
SHARP13 = (Token) match(input, SHARP, FOLLOW_SHARP_in_primary2965);
if (state.failed)
return result;
i2 = (Token) match(input, ID, FOLLOW_ID_in_primary2969);
if (state.failed)
return result;
if (state.backtracking == 0) {
helper.emit(SHARP13, DroolsEditorType.SYMBOL);
helper.emit(i2, DroolsEditorType.IDENTIFIER);
}
}
}
break;
case 3:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:553:13: ( ( HASH ID )=> HASH i2= ID )
{
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:553:13: ( ( HASH ID )=> HASH i2= ID )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:553:15: ( HASH ID )=> HASH i2= ID
{
HASH14 = (Token) match(input, HASH, FOLLOW_HASH_in_primary3009);
if (state.failed)
return result;
i2 = (Token) match(input, ID, FOLLOW_ID_in_primary3013);
if (state.failed)
return result;
if (state.backtracking == 0) {
helper.emit(HASH14, DroolsEditorType.SYMBOL);
helper.emit(i2, DroolsEditorType.IDENTIFIER);
}
}
}
break;
case 4:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:555:13: ( ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID )
{
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:555:13: ( ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:555:15: ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID
{
NULL_SAFE_DOT15 = (Token) match(input, NULL_SAFE_DOT, FOLLOW_NULL_SAFE_DOT_in_primary3053);
if (state.failed)
return result;
i2 = (Token) match(input, ID, FOLLOW_ID_in_primary3057);
if (state.failed)
return result;
if (state.backtracking == 0) {
helper.emit(NULL_SAFE_DOT15, DroolsEditorType.SYMBOL);
helper.emit(i2, DroolsEditorType.IDENTIFIER);
}
}
}
break;
default:
break loop58;
}
}
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:556:12: ( ( identifierSuffix )=> identifierSuffix )?
int alt59 = 2;
int LA59_0 = input.LA(1);
if ((LA59_0 == LEFT_SQUARE)) {
int LA59_1 = input.LA(2);
if ((synpred32_DRL5Expressions())) {
alt59 = 1;
}
} else if ((LA59_0 == LEFT_PAREN)) {
int LA59_2 = input.LA(2);
if ((synpred32_DRL5Expressions())) {
alt59 = 1;
}
}
switch(alt59) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:556:13: ( identifierSuffix )=> identifierSuffix
{
pushFollow(FOLLOW_identifierSuffix_in_primary3079);
identifierSuffix();
state._fsp--;
if (state.failed)
return result;
}
break;
}
}
break;
}
} catch (RecognitionException re) {
throw re;
} finally {
// do for sure before leaving
}
return result;
}
Aggregations