Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 86 additions & 83 deletions drools-compiler/src/main/java/org/drools/lang/DRLParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -1864,58 +1864,59 @@ private BaseDescr lhsExists( CEDescrBuilder< ? , ? > ce,
if ( state.backtracking == 0 ) {
exists = ce.exists();
helper.start( CEDescrBuilder.class,
null,
exists );
null,
exists );
}
try {
match( input,
DRLLexer.ID,
DroolsSoftKeywords.EXISTS,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;

match( input,
DRLLexer.ID,
DroolsSoftKeywords.EXISTS,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;
if ( state.backtracking == 0 && input.LA( 1 ) != DRLLexer.EOF ) {
helper.emit( Location.LOCATION_LHS_BEGIN_OF_CONDITION_EXISTS );
}
if ( input.LA( 1 ) == DRLLexer.LEFT_PAREN ) {
boolean prefixed = helper.validateLT( 2,
DroolsSoftKeywords.AND ) || helper.validateLT( 2,
DroolsSoftKeywords.OR );

if ( state.backtracking == 0 && input.LA( 1 ) != DRLLexer.EOF ) {
helper.emit( Location.LOCATION_LHS_BEGIN_OF_CONDITION_EXISTS );
}
if ( input.LA( 1 ) == DRLLexer.LEFT_PAREN ) {
boolean prefixed = helper.validateLT( 2,
DroolsSoftKeywords.AND ) || helper.validateLT( 2,
DroolsSoftKeywords.OR );
if ( !prefixed ) {
match( input,
DRLLexer.LEFT_PAREN,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return null;
}

if ( !prefixed ) {
match( input,
DRLLexer.LEFT_PAREN,
null,
null,
DroolsEditorType.SYMBOL );
lhsOr( exists,
allowOr );
if ( state.failed ) return null;
}

lhsOr( exists,
allowOr );
if ( state.failed ) return null;
if ( !prefixed ) {
match( input,
DRLLexer.RIGHT_PAREN,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return null;
}
} else {

if ( !prefixed ) {
match( input,
DRLLexer.RIGHT_PAREN,
null,
null,
DroolsEditorType.SYMBOL );
lhsPatternBind( exists,
true );
if ( state.failed ) return null;
}
} else {

lhsPatternBind( exists,
true );
if ( state.failed ) return null;
}

if ( state.backtracking == 0 ) {
helper.end( CEDescrBuilder.class,
} finally {
if ( state.backtracking == 0 ) {
helper.end( CEDescrBuilder.class,
exists );
}
}

return exists != null ? exists.getDescr() : null;
}

Expand All @@ -1937,60 +1938,62 @@ private BaseDescr lhsNot( CEDescrBuilder< ? , ? > ce,
if ( state.backtracking == 0 ) {
not = ce.not();
helper.start( CEDescrBuilder.class,
null,
not );
null,
not );
}

match( input,
DRLLexer.ID,
DroolsSoftKeywords.NOT,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;

if ( state.backtracking == 0 ) {
helper.emit( Location.LOCATION_LHS_BEGIN_OF_CONDITION_NOT );
}
if ( input.LA( 1 ) == DRLLexer.LEFT_PAREN ) {
boolean prefixed = helper.validateLT( 2,
DroolsSoftKeywords.AND ) || helper.validateLT( 2,
DroolsSoftKeywords.OR );
try {
match( input,
DRLLexer.ID,
DroolsSoftKeywords.NOT,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;

if ( !prefixed ) {
match( input,
DRLLexer.LEFT_PAREN,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return null;
}
if ( state.backtracking == 0 && input.LA( 1 ) != DRLLexer.EOF ) {
helper.emit( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
if ( state.backtracking == 0 ) {
helper.emit( Location.LOCATION_LHS_BEGIN_OF_CONDITION_NOT );
}
if ( input.LA( 1 ) == DRLLexer.LEFT_PAREN ) {
boolean prefixed = helper.validateLT( 2,
DroolsSoftKeywords.AND ) || helper.validateLT( 2,
DroolsSoftKeywords.OR );

lhsOr( not,
allowOr );
if ( state.failed ) return null;
if ( !prefixed ) {
match( input,
DRLLexer.LEFT_PAREN,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return null;
}
if ( state.backtracking == 0 && input.LA( 1 ) != DRLLexer.EOF ) {
helper.emit( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
}

if ( !prefixed ) {
match( input,
DRLLexer.RIGHT_PAREN,
null,
null,
DroolsEditorType.SYMBOL );
lhsOr( not,
allowOr );
if ( state.failed ) return null;

if ( !prefixed ) {
match( input,
DRLLexer.RIGHT_PAREN,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return null;
}
} else if ( input.LA( 1 ) != DRLLexer.EOF ) {
lhsPatternBind( not,
true );
if ( state.failed ) return null;
}
} else if ( input.LA( 1 ) != DRLLexer.EOF ) {
lhsPatternBind( not,
true );
if ( state.failed ) return null;
}

if ( state.backtracking == 0 ) {
helper.end( CEDescrBuilder.class,
} finally {
if ( state.backtracking == 0 ) {
helper.end( CEDescrBuilder.class,
not );
}
}

return not != null ? not.getDescr() : null;
}

Expand Down