dax: document IN at the comparison tier (#2228)

This commit is contained in:
alosslessdev
2026-11-05 07:25:57 -05:00
parent 14916f64af
commit 2af770def2
3 changed files with 10 additions and 9 deletions
+4 -3
View File
@@ -201,19 +201,20 @@ right, except `^`:
| Level | Operators | Associativity |
| --- | --- | --- |
| 1 | grouping `()`, function calls, `IN` | — (`IN` is an infix operator) |
| 1 | grouping `()`, function calls | — |
| 2 | `^` | right |
| 3 | unary `+`, `-` | prefix |
| 4 | `*`, `/` | left |
| 5 | binary `+`, `-` | left |
| 6 | `&` | left |
| 7 | `=`, `==`, `<>`, `<`, `>`, `<=`, `>=` | left |
| 7 | `=`, `==`, `<>`, `<`, `>`, `<=`, `>=`, `IN` | left |
| 8 | `NOT` | prefix |
| 9 | `&&` | left |
| 10 | `\|\|` | left |
`=` coerces types at evaluation time; `==` is strict equality. This crate only records which
operator was written. `IN` takes a list (`expr IN { v1, v2 }`) or a table expression
operator was written. `IN` is a comparison at the same level as `=`, so `1 + 2 IN { 3 }` parses as
`(1 + 2) IN { 3 }`, and it takes a list (`expr IN { v1, v2 }`) or a table expression
(`expr IN VALUES(T[Col])`).
Excel evaluates `2^3^2` as `512` (`2^(3^2)`), so `^` is right-associative even though the generic
+2 -2
View File
@@ -214,8 +214,8 @@ impl BinaryOp {
}
/// Binding power, higher binds tighter. The values encode the ten precedence levels
/// from DAX Guide: parentheses/calls/`IN`, `^`, unary sign, `* /`, `+ -`, `&`,
/// comparisons, `NOT`, `&&`, `||`.
/// from the operator table: parentheses/calls, `^`, unary sign, `* /`, `+ -`, `&`,
/// comparisons (including `IN`), `NOT`, `&&`, `||`.
pub const fn precedence(self) -> u8 {
match self {
BinaryOp::Pow => 90,
+4 -4
View File
@@ -1,9 +1,9 @@
//! Pratt parser: tokens → [`Expr`] / [`Query`].
//!
//! Binding powers encode the DAX operator table from <https://dax.guide/operators/> (tighter
//! binds first): parentheses, function calls and `IN`; `^`; unary `+`/`-`; `*`/`/`; binary
//! `+`/`-`; `&`; comparisons; `NOT`; `&&`; `||`. All operators are left-associative except
//! `^`, which Excel evaluates right-associatively (`2^3^2` is 512).
//! Binding powers encode the operator table (tighter binds first): parentheses and function
//! calls; `^`; unary `+`/`-`; `*`/`/`; binary `+`/`-`; `&`; comparisons, which include `IN`; `NOT`;
//! `&&`; `||`. All operators are left-associative except `^`, which Excel evaluates
//! right-associatively (`2^3^2` is 512).
use crate::ast::{
Axis, AxisGroup, AxisKind, AxisOrderItem, BinaryOp, Call, ColumnDef, Define, Definition, Evaluate, Expr, ExprKind, FunctionDef, FunctionParam,