Skip to content

Commit

Permalink
[DROOLS-7285] Failed to parse and/or with parentheses in LHS (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkobayas authored and rgdoliveira committed Oct 24, 2024
1 parent 413d4cf commit 72ac496
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ruledef : DRL_RULE name=stringId (EXTENDS stringId)? drlAnnotation* attributes?
lhs : DRL_WHEN lhsExpression? ;
lhsExpression : lhsOr+ ;
lhsOr : LPAREN DRL_OR lhsAnd+ RPAREN | lhsAnd (DRL_OR lhsAnd)* ;
lhsAnd : LPAREN DRL_AND lhsUnary+ RPAREN | lhsUnary (DRL_AND lhsUnary)* ;
lhsAnd : LPAREN lhsAnd RPAREN | LPAREN DRL_AND lhsUnary+ RPAREN | lhsUnary (DRL_AND lhsUnary)* ;

/*
lhsUnary : ( lhsExists namedConsequence?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ public BaseDescr visitLhsOr(DRLParser.LhsOrContext ctx) {

@Override
public BaseDescr visitLhsAnd(DRLParser.LhsAndContext ctx) {
if (ctx.lhsAnd() != null) {
return visitLhsAnd(ctx.lhsAnd());
}
if (!ctx.DRL_AND().isEmpty()) {
AndDescr andDescr = new AndDescr();
List<BaseDescr> descrList = visitDescrChildren(ctx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,6 @@ public void parse_BoundVariables() throws Exception {
assertThat(fld.getExpression()).isEqualTo("likes == $type");
}

@Disabled("Priority : High | Failed to parse and/or with parentheses in LHS")
@Test
public void parse_OrNesting() throws Exception {
final PackageDescr pkg = parseAndGetPackageDescrFromFile(
Expand Down

0 comments on commit 72ac496

Please sign in to comment.