Token COLON9=null;
Token UNIFY10=null;
BaseDescr left = null;
boolean isLeft = false; BindingDescr bind = null;
try {
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:471:5: ( TILDE unaryExpression | NEGATION unaryExpression | ( castExpression )=> castExpression | ( ({...}? (var= ID COLON ) ) | ({...}? (var= ID UNIFY ) ) )? left= primary ( ( selector )=> selector )* ( ( INCR | DECR )=> ( INCR | DECR ) )? )
int alt51=4;
alt51 = dfa51.predict(input);
switch (alt51) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:471:9: TILDE unaryExpression
{
match(input,TILDE,FOLLOW_TILDE_in_unaryExpressionNotPlusMinus2339); if (state.failed) return retval;
pushFollow(FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus2341);
unaryExpression();
state._fsp--;
if (state.failed) return retval;
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:472:8: NEGATION unaryExpression
{
match(input,NEGATION,FOLLOW_NEGATION_in_unaryExpressionNotPlusMinus2350); if (state.failed) return retval;
pushFollow(FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus2352);
unaryExpression();
state._fsp--;
if (state.failed) return retval;
}
break;
case 3 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:473:9: ( castExpression )=> castExpression
{
pushFollow(FOLLOW_castExpression_in_unaryExpressionNotPlusMinus2366);
castExpression();
state._fsp--;
if (state.failed) return retval;
}
break;
case 4 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:474:9: ( ({...}? (var= ID COLON ) ) | ({...}? (var= ID UNIFY ) ) )? left= primary ( ( selector )=> selector )* ( ( INCR | DECR )=> ( INCR | DECR ) )?
{
if ( state.backtracking==0 ) {
isLeft = helper.getLeftMostExpr() == null;
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:475:9: ( ({...}? (var= ID COLON ) ) | ({...}? (var= ID UNIFY ) ) )?
int alt48=3;
int LA48_0 = input.LA(1);
if ( (LA48_0==ID) ) {
int LA48_1 = input.LA(2);
if ( (LA48_1==COLON) ) {
int LA48_3 = input.LA(3);
if ( ((inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.COLON)) ) {
alt48=1;
}
}
else if ( (LA48_1==UNIFY) ) {
alt48=2;
}
}
switch (alt48) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:475:11: ({...}? (var= ID COLON ) )
{
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:475:11: ({...}? (var= ID COLON ) )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:475:12: {...}? (var= ID COLON )
{
if ( !((inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.COLON)) ) {
if (state.backtracking>0) {state.failed=true; return retval;}
throw new FailedPredicateException(input, "unaryExpressionNotPlusMinus", "inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.COLON");
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:475:75: (var= ID COLON )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:475:76: var= ID COLON
{
var=(Token)match(input,ID,FOLLOW_ID_in_unaryExpressionNotPlusMinus2394); if (state.failed) return retval;
COLON9=(Token)match(input,COLON,FOLLOW_COLON_in_unaryExpressionNotPlusMinus2396); if (state.failed) return retval;
if ( state.backtracking==0 ) {
hasBindings = true; helper.emit(var, DroolsEditorType.IDENTIFIER_VARIABLE); helper.emit(COLON9, DroolsEditorType.SYMBOL); if( buildDescr ) { bind = new BindingDescr((var!=null?var.getText():null), null, false); helper.setStart( bind, var ); }
}
}
}
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:477:11: ({...}? (var= ID UNIFY ) )
{
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:477:11: ({...}? (var= ID UNIFY ) )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:477:12: {...}? (var= ID UNIFY )
{
if ( !((inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.UNIFY)) ) {
if (state.backtracking>0) {state.failed=true; return retval;}
throw new FailedPredicateException(input, "unaryExpressionNotPlusMinus", "inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.UNIFY");
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:477:75: (var= ID UNIFY )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:477:76: var= ID UNIFY
{
var=(Token)match(input,ID,FOLLOW_ID_in_unaryExpressionNotPlusMinus2435); if (state.failed) return retval;
UNIFY10=(Token)match(input,UNIFY,FOLLOW_UNIFY_in_unaryExpressionNotPlusMinus2437); if (state.failed) return retval;
if ( state.backtracking==0 ) {
hasBindings = true; helper.emit(var, DroolsEditorType.IDENTIFIER_VARIABLE); helper.emit(UNIFY10, DroolsEditorType.SYMBOL); if( buildDescr ) { bind = new BindingDescr((var!=null?var.getText():null), null, true); helper.setStart( bind, var ); }
}
}
}
}
break;
}
pushFollow(FOLLOW_primary_in_unaryExpressionNotPlusMinus2482);
left=primary();
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) {
if( buildDescr ) { retval.result = left; }
}
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:481:9: ( ( selector )=> selector )*
loop49:
do {
int alt49=2;
int LA49_0 = input.LA(1);
if ( (LA49_0==DOT) && (synpred15_DRL6Expressions())) {
alt49=1;
}
else if ( (LA49_0==LEFT_SQUARE) && (synpred15_DRL6Expressions())) {
alt49=1;
}
switch (alt49) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:481:10: ( selector )=> selector
{
pushFollow(FOLLOW_selector_in_unaryExpressionNotPlusMinus2499);
selector();
state._fsp--;
if (state.failed) return retval;
}
break;
default :
break loop49;
}
} while (true);
if ( state.backtracking==0 ) {
if( buildDescr ) {
String expr = input.toString(retval.start,input.LT(-1));
if( isLeft ) {
helper.setLeftMostExpr( expr );
}
if( bind != null ) {
if( bind.isUnification() ) {
expr = expr.substring( expr.indexOf( ":=" ) + 2 ).trim();
} else {
expr = expr.substring( expr.indexOf( ":" ) + 1 ).trim();
}
bind.setExpression( expr );
helper.setEnd( bind );
retval.result = bind;
}
}