use of org.drools.drl.ast.descr.BaseDescr in project drools by kiegroup.
the class DRL6Expressions method orRestriction.
// $ANTLR end "relationalExpression"
// $ANTLR start "orRestriction"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:405:1: orRestriction returns [BaseDescr result] : left= andRestriction ( ( DOUBLE_PIPE ( fullAnnotation[null] )? andRestriction )=>lop= DOUBLE_PIPE (args= fullAnnotation[null] )? right= andRestriction )* ( EOF )? ;
public final BaseDescr orRestriction() 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:406:3: (left= andRestriction ( ( DOUBLE_PIPE ( fullAnnotation[null] )? andRestriction )=>lop= DOUBLE_PIPE (args= fullAnnotation[null] )? right= andRestriction )* ( EOF )? )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:406:5: left= andRestriction ( ( DOUBLE_PIPE ( fullAnnotation[null] )? andRestriction )=>lop= DOUBLE_PIPE (args= fullAnnotation[null] )? right= andRestriction )* ( EOF )?
{
pushFollow(FOLLOW_andRestriction_in_orRestriction1892);
left = andRestriction();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
if (buildDescr) {
result = left;
}
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:407:5: ( ( DOUBLE_PIPE ( fullAnnotation[null] )? andRestriction )=>lop= DOUBLE_PIPE (args= fullAnnotation[null] )? right= andRestriction )*
loop39: while (true) {
int alt39 = 2;
int LA39_0 = input.LA(1);
if ((LA39_0 == DOUBLE_PIPE)) {
int LA39_9 = input.LA(2);
if ((synpred10_DRL6Expressions())) {
alt39 = 1;
}
}
switch(alt39) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:407:7: ( DOUBLE_PIPE ( fullAnnotation[null] )? andRestriction )=>lop= DOUBLE_PIPE (args= fullAnnotation[null] )? right= andRestriction
{
lop = (Token) match(input, DOUBLE_PIPE, FOLLOW_DOUBLE_PIPE_in_orRestriction1914);
if (state.failed)
return result;
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:407:79: (args= fullAnnotation[null] )?
int alt38 = 2;
int LA38_0 = input.LA(1);
if ((LA38_0 == AT)) {
alt38 = 1;
}
switch(alt38) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:407:79: args= fullAnnotation[null]
{
pushFollow(FOLLOW_fullAnnotation_in_orRestriction1918);
args = fullAnnotation(null);
state._fsp--;
if (state.failed)
return result;
}
break;
}
pushFollow(FOLLOW_andRestriction_in_orRestriction1924);
right = andRestriction();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
if (buildDescr) {
ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newOr();
descr.addOrMerge(result);
descr.addOrMerge(right);
if (args != null) {
descr.addAnnotation(args);
}
result = descr;
}
}
}
break;
default:
break loop39;
}
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:416:7: ( EOF )?
int alt40 = 2;
int LA40_0 = input.LA(1);
if ((LA40_0 == EOF)) {
int LA40_1 = input.LA(2);
if ((LA40_1 == EOF)) {
int LA40_3 = input.LA(3);
if ((LA40_3 == EOF)) {
alt40 = 1;
}
} else if (((LA40_1 >= AMPER && LA40_1 <= AND_ASSIGN) || LA40_1 == AT || (LA40_1 >= COLON && LA40_1 <= COMMA) || LA40_1 == DIV_ASSIGN || (LA40_1 >= DOUBLE_AMPER && LA40_1 <= DOUBLE_PIPE) || (LA40_1 >= EQUALS && LA40_1 <= EQUALS_ASSIGN) || (LA40_1 >= GREATER && LA40_1 <= GREATER_EQUALS) || LA40_1 == ID || LA40_1 == LEFT_PAREN || (LA40_1 >= LESS && LA40_1 <= LESS_EQUALS) || LA40_1 == MINUS_ASSIGN || LA40_1 == MOD_ASSIGN || LA40_1 == MULT_ASSIGN || LA40_1 == NOT_EQUALS || LA40_1 == OR_ASSIGN || LA40_1 == PIPE || (LA40_1 >= PLUS_ASSIGN && LA40_1 <= QUESTION) || (LA40_1 >= RIGHT_CURLY && LA40_1 <= SEMICOLON) || LA40_1 == TILDE || (LA40_1 >= XOR && LA40_1 <= XOR_ASSIGN))) {
alt40 = 1;
}
}
switch(alt40) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:416:7: EOF
{
match(input, EOF, FOLLOW_EOF_in_orRestriction1943);
if (state.failed)
return result;
}
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 castExpression.
// $ANTLR end "unaryExpressionNotPlusMinus"
// $ANTLR start "castExpression"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:544:1: castExpression : ( ( LEFT_PAREN primitiveType )=> LEFT_PAREN primitiveType RIGHT_PAREN expr= unaryExpression | ( LEFT_PAREN type )=> LEFT_PAREN type RIGHT_PAREN unaryExpressionNotPlusMinus );
public final void castExpression() throws RecognitionException {
BaseDescr expr = null;
try {
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:545:5: ( ( LEFT_PAREN primitiveType )=> LEFT_PAREN primitiveType RIGHT_PAREN expr= unaryExpression | ( LEFT_PAREN type )=> LEFT_PAREN type RIGHT_PAREN unaryExpressionNotPlusMinus )
int alt55 = 2;
int LA55_0 = input.LA(1);
if ((LA55_0 == LEFT_PAREN)) {
int LA55_1 = input.LA(2);
if ((synpred20_DRL6Expressions())) {
alt55 = 1;
} else if ((synpred21_DRL6Expressions())) {
alt55 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return;
}
int nvaeMark = input.mark();
try {
input.consume();
NoViableAltException nvae = new NoViableAltException("", 55, 1, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
} else {
if (state.backtracking > 0) {
state.failed = true;
return;
}
NoViableAltException nvae = new NoViableAltException("", 55, 0, input);
throw nvae;
}
switch(alt55) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:545:8: ( LEFT_PAREN primitiveType )=> LEFT_PAREN primitiveType RIGHT_PAREN expr= unaryExpression
{
match(input, LEFT_PAREN, FOLLOW_LEFT_PAREN_in_castExpression2739);
if (state.failed)
return;
pushFollow(FOLLOW_primitiveType_in_castExpression2741);
primitiveType();
state._fsp--;
if (state.failed)
return;
match(input, RIGHT_PAREN, FOLLOW_RIGHT_PAREN_in_castExpression2743);
if (state.failed)
return;
pushFollow(FOLLOW_unaryExpression_in_castExpression2747);
expr = unaryExpression();
state._fsp--;
if (state.failed)
return;
}
break;
case 2:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:546:8: ( LEFT_PAREN type )=> LEFT_PAREN type RIGHT_PAREN unaryExpressionNotPlusMinus
{
match(input, LEFT_PAREN, FOLLOW_LEFT_PAREN_in_castExpression2764);
if (state.failed)
return;
pushFollow(FOLLOW_type_in_castExpression2766);
type();
state._fsp--;
if (state.failed)
return;
match(input, RIGHT_PAREN, FOLLOW_RIGHT_PAREN_in_castExpression2768);
if (state.failed)
return;
pushFollow(FOLLOW_unaryExpressionNotPlusMinus_in_castExpression2770);
unaryExpressionNotPlusMinus();
state._fsp--;
if (state.failed)
return;
}
break;
}
} catch (RecognitionException re) {
throw re;
} finally {
// do for sure before leaving
}
}
use of org.drools.drl.ast.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;
}
use of org.drools.drl.ast.descr.BaseDescr in project drools by kiegroup.
the class DRL5Expressions method inclusiveOrExpression.
// $ANTLR end "conditionalAndExpression"
// $ANTLR start "inclusiveOrExpression"
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:246:1: inclusiveOrExpression returns [BaseDescr result] : left= exclusiveOrExpression ( PIPE right= exclusiveOrExpression )* ;
public final BaseDescr inclusiveOrExpression() throws RecognitionException {
BaseDescr result = null;
BaseDescr left = null;
BaseDescr right = null;
try {
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:247:3: (left= exclusiveOrExpression ( PIPE right= exclusiveOrExpression )* )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:247:5: left= exclusiveOrExpression ( PIPE right= exclusiveOrExpression )*
{
pushFollow(FOLLOW_exclusiveOrExpression_in_inclusiveOrExpression1254);
left = exclusiveOrExpression();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
if (buildDescr) {
result = left;
}
}
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:248:3: ( PIPE right= exclusiveOrExpression )*
loop28: while (true) {
int alt28 = 2;
int LA28_0 = input.LA(1);
if ((LA28_0 == PIPE)) {
alt28 = 1;
}
switch(alt28) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:248:5: PIPE right= exclusiveOrExpression
{
match(input, PIPE, FOLLOW_PIPE_in_inclusiveOrExpression1262);
if (state.failed)
return result;
pushFollow(FOLLOW_exclusiveOrExpression_in_inclusiveOrExpression1266);
right = exclusiveOrExpression();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
if (buildDescr) {
ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newIncOr();
descr.addOrMerge(result);
descr.addOrMerge(right);
result = descr;
}
}
}
break;
default:
break loop28;
}
}
}
} 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 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;
}
Aggregations