// $ANTLR start "singleRestriction"
// src/main/resources/org/drools/lang/DRLExpressions.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;
DRLExpressions.operator_return op = null;
java.util.List<String> sa = null;
DRLExpressions.shiftExpression_return value = null;
BaseDescr or = null;
try {
// src/main/resources/org/drools/lang/DRLExpressions.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<=LESS)||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/lang/DRLExpressions.g:422:6: op= operator ( ( squareArguments shiftExpression )=>sa= squareArguments value= shiftExpression | value= shiftExpression )
{
pushFollow(FOLLOW_operator_in_singleRestriction1954);
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/lang/DRLExpressions.g:424:6: ( ( squareArguments shiftExpression )=>sa= squareArguments value= shiftExpression | value= shiftExpression )
int alt43=2;
alt43 = dfa43.predict(input);
switch (alt43) {
case 1 :
// src/main/resources/org/drools/lang/DRLExpressions.g:424:8: ( squareArguments shiftExpression )=>sa= squareArguments value= shiftExpression
{
pushFollow(FOLLOW_squareArguments_in_singleRestriction1983);
sa=squareArguments();
state._fsp--;
if (state.failed) return result;
pushFollow(FOLLOW_shiftExpression_in_singleRestriction1987);
value=shiftExpression();
state._fsp--;
if (state.failed) return result;
}
break;
case 2 :
// src/main/resources/org/drools/lang/DRLExpressions.g:425:10: value= shiftExpression
{
pushFollow(FOLLOW_shiftExpression_in_singleRestriction2000);
value=shiftExpression();
state._fsp--;
if (state.failed) return result;
}
break;
}
if ( state.backtracking==0 ) {
if( buildDescr ) {
BaseDescr descr = ( (value!=null?value.result:null) != null &&
( (!((value!=null?value.result:null) instanceof AtomicExprDescr)) ||
((value!=null?input.toString(value.start,value.stop):null).equals(((AtomicExprDescr)(value!=null?value.result:null)).getExpression())) )) ?
(value!=null?value.result:null) :
new AtomicExprDescr( (value!=null?input.toString(value.start,value.stop):null) ) ;
result = new RelationalExprDescr( (op!=null?op.opr:null), (op!=null?op.negated:false), sa, ((relationalExpression_scope)relationalExpression_stack.peek()).lsd, descr );