Skip to content

Commit

Permalink
#2178 Rewrite rules for logical conditions to support begin/end grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
homedirectory committed Feb 12, 2024
1 parent 22267d0 commit e636417
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public enum V implements Variable {
Prop,
And, Or, Eq, Gt, Lt,
UnaryComparisonOperator, BinaryComparisonOperator, Val, AnyProp, ExtProp, Param,
ArithmeticalOperator, SingleOperandOrExpr, ExprBody, ArithmeticalExpr, Model
ArithmeticalOperator, SingleOperandOrExpr, ExprBody, ArithmeticalExpr, Condition__, Condition_, Model
}

// Short names
Expand All @@ -113,11 +113,11 @@ public enum V implements Variable {
// Where = where Condition;
derive(Where).to(where, Condition).

// Condition = Predicate | Condition AND Condition | Condition OR Condition;
// Condition = Predicate | Condition AND Condition | Condition OR Condition | begin Condition end;
// AND takes precedence over OR
derive(Condition).to(OrCondition).
derive(OrCondition).to(AndCondition, noneOrMore(or, AndCondition)).
derive(AndCondition).to(Predicate, noneOrMore(and, AndCondition)).
derive(Condition).to(Predicate, Condition__).or(begin, Condition, end, Condition__).
derive(Condition_).to(or, Condition).or(and, Condition).
derive(Condition__).to(Condition_, Condition__).orNone().

derive(Predicate).to(Operand, PredicateTail).
derive(PredicateTail).to(UnaryComparisonOperator).or(BinaryComparisonOperator, Operand).
Expand Down

0 comments on commit e636417

Please sign in to comment.