Skip to content

Commit

Permalink
#2178 Split operands and operators into 2 categories: regular compari…
Browse files Browse the repository at this point in the history
…son and quantified
  • Loading branch information
homedirectory committed Feb 15, 2024
1 parent f87e1fb commit c19b4ba
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,28 @@ public final class CanonicalEqlGrammar {

derive(Predicate).
to(Operand, UnaryComparisonOperator).
or(Operand, BinaryComparisonOperator, Operand).
or(Operand, ComparisonOperator, ComparisonOperand).
or(Operand, QuantifiedComparisonOperator, QuantifiedOperand).
or(Operand, MembershipOperator, MembershipOperand).

derive(UnaryComparisonOperator).
to(isNull).or(isNotNull).

derive(BinaryComparisonOperator).
to(eq).or(gt).or(lt).or(ge).or(le).
or(like).or(iLike).or(likeWithCast).or(iLikeWithCast).
derive(ComparisonOperator).
to(like).or(iLike).or(likeWithCast).or(iLikeWithCast).
or(notLike).or(notLikeWithCast).or(notILikeWithCast).or(notILike).

specialize(Operand).
specialize(ComparisonOperand).
into(SingleOperand, Expr, MultiOperand).

derive(QuantifiedComparisonOperator).
to(eq).or(gt).or(lt).or(ge).or(le).or(ne).

derive(QuantifiedOperand).
to(all.with(SingleResultQueryModel.class)).
or(any.with(SingleResultQueryModel.class)).
or(ComparisonOperand).

derive(Expr).
to(beginExpr, ExprBody, endExpr).
derive(ExprBody).
Expand Down Expand Up @@ -184,7 +192,7 @@ public enum EqlVariable implements Variable {
ArithmeticalOperator, SingleOperandOrExpr, ExprBody, Expr,
UnaryFunction, UnaryFunctionName, IfNull, DateDiffInterval, DateDiffIntervalUnit, DateAddInterval, DateAddIntervalUnit, Round, Concat, CaseWhen, CaseWhenEnd,
MembershipOperator,
MembershipOperand, Model
MembershipOperand, ComparisonOperator, ComparisonOperand, QuantifiedComparisonOperator, QuantifiedOperand, Model
}

public enum EqlTerminal implements Terminal {
Expand Down

0 comments on commit c19b4ba

Please sign in to comment.