in drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Expressions.java [2530:2658]
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/drl/parser/DRL6Expressions.g:397:3: (left= shiftExpression ( ( operator | LEFT_PAREN )=>right= orRestriction )* )
// src/main/resources/org/drools/drl/parser/DRL6Expressions.g:397:5: left= shiftExpression ( ( operator | LEFT_PAREN )=>right= orRestriction )*
{
pushFollow(FOLLOW_shiftExpression_in_relationalExpression1835);
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/drl/parser/DRL6Expressions.g:422: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/drl/parser/DRL6Expressions.g:422:5: ( operator | LEFT_PAREN )=>right= orRestriction
{
pushFollow(FOLLOW_orRestriction_in_relationalExpression1860);
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;
}