use of org.drools.drl.ast.descr.ConstraintConnectiveDescr 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;
}
use of org.drools.drl.ast.descr.ConstraintConnectiveDescr in project drools by kiegroup.
the class DRL6Expressions method andRestriction.
// $ANTLR end "orRestriction"
// $ANTLR start "andRestriction"
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:419:1: andRestriction returns [BaseDescr result] : left= singleRestriction ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )* ;
public final BaseDescr andRestriction() 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:420:3: (left= singleRestriction ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )* )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:420:5: left= singleRestriction ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )*
{
pushFollow(FOLLOW_singleRestriction_in_andRestriction1963);
left = singleRestriction();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
if (buildDescr) {
result = left;
}
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:421:3: ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )*
loop42: while (true) {
int alt42 = 2;
int LA42_0 = input.LA(1);
if ((LA42_0 == DOUBLE_AMPER)) {
int LA42_9 = input.LA(2);
if ((synpred11_DRL6Expressions())) {
alt42 = 1;
}
}
switch(alt42) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:421:5: ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction
{
lop = (Token) match(input, DOUBLE_AMPER, FOLLOW_DOUBLE_AMPER_in_andRestriction1983);
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:423:13: (args= fullAnnotation[null] )?
int alt41 = 2;
int LA41_0 = input.LA(1);
if ((LA41_0 == AT)) {
alt41 = 1;
}
switch(alt41) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:423:13: args= fullAnnotation[null]
{
pushFollow(FOLLOW_fullAnnotation_in_andRestriction2004);
args = fullAnnotation(null);
state._fsp--;
if (state.failed)
return result;
}
break;
}
pushFollow(FOLLOW_singleRestriction_in_andRestriction2009);
right = singleRestriction();
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 loop42;
}
}
}
} catch (RecognitionException re) {
throw re;
} finally {
// do for sure before leaving
}
return result;
}
use of org.drools.drl.ast.descr.ConstraintConnectiveDescr in project drools by kiegroup.
the class DRL5Expressions method andRestriction.
// $ANTLR end "orRestriction"
// $ANTLR start "andRestriction"
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:405:1: andRestriction returns [BaseDescr result] : left= singleRestriction ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )* ;
public final BaseDescr andRestriction() 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/DRL5Expressions.g:406:3: (left= singleRestriction ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )* )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:406:5: left= singleRestriction ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )*
{
pushFollow(FOLLOW_singleRestriction_in_andRestriction1881);
left = singleRestriction();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
if (buildDescr) {
result = left;
}
}
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:407:3: ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )*
loop42: while (true) {
int alt42 = 2;
int LA42_0 = input.LA(1);
if ((LA42_0 == DOUBLE_AMPER)) {
int LA42_9 = input.LA(2);
if ((synpred10_DRL5Expressions())) {
alt42 = 1;
}
}
switch(alt42) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:407:5: ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction
{
lop = (Token) match(input, DOUBLE_AMPER, FOLLOW_DOUBLE_AMPER_in_andRestriction1901);
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/DRL5Expressions.g:409:13: (args= fullAnnotation[null] )?
int alt41 = 2;
int LA41_0 = input.LA(1);
if ((LA41_0 == AT)) {
alt41 = 1;
}
switch(alt41) {
case 1:
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:409:13: args= fullAnnotation[null]
{
pushFollow(FOLLOW_fullAnnotation_in_andRestriction1922);
args = fullAnnotation(null);
state._fsp--;
if (state.failed)
return result;
}
break;
}
pushFollow(FOLLOW_singleRestriction_in_andRestriction1927);
right = singleRestriction();
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 loop42;
}
}
}
} catch (RecognitionException re) {
throw re;
} finally {
// do for sure before leaving
}
return result;
}
use of org.drools.drl.ast.descr.ConstraintConnectiveDescr in project drools by kiegroup.
the class DrlExprParser method parse.
/**
* Parse an expression from text
*/
public ConstraintConnectiveDescr parse(final String text) {
ConstraintConnectiveDescr constraint = null;
try {
DRLLexer lexer = DRLFactory.getDRLLexer(new ANTLRStringStream(text), languageLevel);
CommonTokenStream input = new CommonTokenStream(lexer);
RecognizerSharedState state = new RecognizerSharedState();
helper = new ParserHelper(input, state, languageLevel);
DRLExpressions parser = DRLFactory.getDRLExpressions(input, state, helper, languageLevel);
parser.setBuildDescr(true);
// setting initial value just in case
parser.setLeftMostExpr(null);
BaseDescr expr = parser.conditionalOrExpression();
if (expr != null && !parser.hasErrors()) {
constraint = ConstraintConnectiveDescr.newAnd();
constraint.addOrMerge(expr);
}
} catch (RecognitionException e) {
helper.reportError(e);
}
return constraint;
}
use of org.drools.drl.ast.descr.ConstraintConnectiveDescr in project drools by kiegroup.
the class DRL5Expressions method conditionalAndExpression.
// $ANTLR end "conditionalOrExpression"
// $ANTLR start "conditionalAndExpression"
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:230: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/DRL5Expressions.g:231:3: (left= inclusiveOrExpression ( DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression )* )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:231:5: left= inclusiveOrExpression ( DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression )*
{
pushFollow(FOLLOW_inclusiveOrExpression_in_conditionalAndExpression1182);
left = inclusiveOrExpression();
state._fsp--;
if (state.failed)
return result;
if (state.backtracking == 0) {
if (buildDescr) {
result = left;
}
}
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:232: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/DRL5Expressions.g:232:5: DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression
{
match(input, DOUBLE_AMPER, FOLLOW_DOUBLE_AMPER_in_conditionalAndExpression1190);
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/DRL5Expressions.g:234: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/DRL5Expressions.g:234:13: args= fullAnnotation[null]
{
pushFollow(FOLLOW_fullAnnotation_in_conditionalAndExpression1213);
args = fullAnnotation(null);
state._fsp--;
if (state.failed)
return result;
}
break;
}
pushFollow(FOLLOW_inclusiveOrExpression_in_conditionalAndExpression1219);
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