refactor(core)!: unbounded literals follow grammar rule 66 (open bracket required)
public
refactor(core)!: unbounded literals follow grammar rule 66 (open bracket required)
Tighten unbounded omitted-endpoint *literals* to the same FEEL grammar rule 66
the `range()` string obeys: an omitted endpoint is valid only behind an OPEN
bracket on that side. So `[1..)` / `(..10]` / `]1..)` parse, but `[1..]` /
`[..10]` / `[..10)` (a closed bracket with no value) are now parse errors —
removing the earlier lenient-superset inconsistency where `[1..]` parsed yet
`range("[1..]")` was null.
Grammar (LR(1)-clean, build.rs gate): the closed opener `"["` keeps its low
endpoint mandatory again; the open `"("` / `]`(RBracketOpen) take it optional;
`HiEnd`'s unbounded form is the open `")"` only (dropped the `"]"` arm). The one
remaining lenience is the literal `(..)` (universal range), which `range("(..)")`
still rejects (rule 66 has no both-omitted alternative).
`unbounded_ranges` rewritten to open-bracket spellings; new
`unbounded_closed_bracket_is_a_parse_error` pins the rejection.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| Changeset | 9944d6573e4272962f1d07a826c441fbe4cdcfa3 |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@gmail.com>, |
| Parents | 919af3c77f9a |
| Children | |
| Pushlog | by timo via ssh |
modified crates/feel-core/src/ast.rs +1 −1
| @@ -175,7 +175,7 @@ | ||
| 175 | 175 | /// `(`/`)` are open (exclusive). |
| 176 | 176 | /// |
| 177 | 177 | /// An endpoint is `None` when it was **syntactically omitted** — an *unbounded* |
| 178 | -/// bound, `±∞` (`[1..]` is everything `≥ 1`, `[..10]` everything `≤ 10`; ADR-31). | |
| 178 | +/// bound, `±∞` (`[1..)` is everything `≥ 1`, `(..10]` everything `≤ 10`; ADR-31). | |
| 179 | 179 | /// This is semantically distinct from a *present* `null` endpoint (`Some(Expr::Null)`), |
| 180 | 180 | /// which keeps the three-valued "unknown" membership of `[null..10]`. The openness |
| 181 | 181 | /// flag of an omitted endpoint is meaningless (`±∞` is never a member); every |
modified crates/feel-core/src/builtins.rs +1 −1
| @@ -902,7 +902,7 @@ | ||
| 902 | 902 | // A range renders in interval notation, e.g. `[1..10)` / `["a".."c"]`; the |
| 903 | 903 | // endpoints are quoted as list members are (so strings keep their quotes). An |
| 904 | 904 | // unbounded endpoint (`None`; ADR-31) renders as nothing, echoing the bracket |
| 905 | - // the user wrote: `[1..]`, `[..10)`, `[..]`. | |
| 905 | + // the user wrote: `[1..)`, `(..10)`, `(..)`. | |
| 906 | 906 | Value::Range(r) => format!( |
| 907 | 907 | "{}{}..{}{}", |
| 908 | 908 | if r.start_open { '(' } else { '[' }, |
modified crates/feel-core/src/eval.rs +5 −5
| @@ -466,8 +466,8 @@ | ||
| 466 | 466 | } |
| 467 | 467 | // Ranges are equal iff each *side* matches: same boundedness, same openness |
| 468 | 468 | // (only where the side is bounded), and FEEL-equal endpoints (DMN §10.3.4.6). |
| 469 | - // An unbounded side ignores the openness flag — `[1..]` equals `[1..)` (both | |
| 470 | - // `[1, +∞)`), and `[1..]` differs from a bounded `[1..10]` (ADR-31). A | |
| 469 | + // An unbounded side ignores the openness flag (only an open bracket is even | |
| 470 | + // writable there), and differs from a bounded side — `[1..)` ≠ `[1..10]` (ADR-31). A | |
| 471 | 471 | // type-mismatched endpoint makes the whole comparison error-null (`None`), |
| 472 | 472 | // unless a definite difference has already made it `false`. |
| 473 | 473 | (Value::Range(x), Value::Range(y)) => { |
| @@ -585,7 +585,7 @@ | ||
| 585 | 585 | UnaryTest::Compare(op, e) => eval_compare(*op, o, &self.eval(e, ctx)?.forced()), |
| 586 | 586 | // A *written* interval literal `[a..b]`: evaluate its endpoints in the |
| 587 | 587 | // test context and check containment. An omitted endpoint is unbounded |
| 588 | - // (`5 in [1..]`, `5 in [..10]`), satisfying that side unconditionally | |
| 588 | + // (`5 in [1..)`, `5 in (..10]`), satisfying that side unconditionally | |
| 589 | 589 | // (ADR-31); a present `null` bound keeps three-valued membership. |
| 590 | 590 | UnaryTest::Interval(iv) => { |
| 591 | 591 | let start = self.eval_opt_endpoint(&iv.start, ctx)?; |
| @@ -636,7 +636,7 @@ | ||
| 636 | 636 | /// bounds unknown, and `and3` combines the two sides with sticky error provenance. |
| 637 | 637 | /// |
| 638 | 638 | /// A `None` endpoint is *unbounded* (`±∞`; ADR-31): that side is satisfied |
| 639 | -/// unconditionally (`true`), so `5 in [1..]` and `5 in [..10]` are `true`, while a | |
| 639 | +/// unconditionally (`true`), so `5 in [1..)` and `5 in (..10]` are `true`, while a | |
| 640 | 640 | /// *present* `null` bound (`5 in [null..10]`) still yields the three-valued `null`. |
| 641 | 641 | fn range_contains( |
| 642 | 642 | o: &Value, |
| @@ -921,7 +921,7 @@ | ||
| 921 | 921 | // their inclusivity. `start included`/`end included` arrive as single joined |
| 922 | 922 | // names (ADR-17). An *unbounded* endpoint (`None`; ADR-31) has no value — its |
| 923 | 923 | // `start`/`end` is `null` and it is never `included` (`±∞` is no member), so |
| 924 | - // `[1..].end` is `null` and `[1..].end included` is `false` regardless of the | |
| 924 | + // `[1..).end` is `null` and `[1..).end included` is `false` regardless of the | |
| 925 | 925 | // (meaningless) bracket. An unknown property is a value-null, mirroring |
| 926 | 926 | // `temporal::get_property` (a range *has* properties). |
| 927 | 927 | Value::Range(r) => match name { |
modified crates/feel-core/src/feel.lalrpop +26 −22
| @@ -256,36 +256,38 @@ | ||
| 256 | 256 | // clashed with `List` on the bare `[` (build.rs's no-conflict gate proves this). |
| 257 | 257 | // The `in`-RHS *test* form keeps its own `Interval` rule below (a unary test, not a |
| 258 | 258 | // value), reachable only after `in`, so the two never share an LR state. |
| 259 | -// A range literal with optional, *unbounded* endpoints (ADR-31). The low endpoint is | |
| 260 | -// `Sum?`: present, or omitted when `..` follows the opener directly (`..` ∉ FIRST(Sum), | |
| 261 | -// so the choice is one-token-clean — and `]` after `[` is still the empty `List`). The | |
| 262 | -// high side is `HiEnd`, which carries either `Endpoint IntervalEnd` (bounded) or a bare | |
| 263 | -// `]`/`)` (unbounded high); see `HiEnd` for why the unbounded high cannot also take the | |
| 264 | -// reverse-close `[`. An omitted endpoint becomes `None` (≠ a present `null` bound). | |
| 259 | +// A range literal with optional, *unbounded* endpoints, following FEEL grammar rule 66 | |
| 260 | +// to the letter (ADR-31): an omitted endpoint is admissible ONLY behind an *open* | |
| 261 | +// bracket on that side — `[1..)` / `(..10]` / `]1..)`, never `[1..]` / `[..10]` (a | |
| 262 | +// closed bracket with no value is a parse error). So: | |
| 263 | +// * the *closed* opener `"["` keeps its low endpoint MANDATORY (`Sum`); | |
| 264 | +// * the *open* openers `"("` and `]`(RBracketOpen) allow it omitted (`Sum?`); | |
| 265 | +// * the high side is `HiEnd`, whose unbounded form is the *open* `")"` only. | |
| 266 | +// An omitted endpoint becomes `None` (≠ a present `null` bound). `..` ∉ FIRST(Sum) keeps | |
| 267 | +// the optional-low choice one-token-clean, and `]` after `[` is still the empty `List`. | |
| 265 | 268 | RangeLit: Expr = { |
| 266 | - "[" <lo:Sum?> ".." <hi:HiEnd> => | |
| 267 | - Expr::RangeLit(Interval { start_open: false, start: lo.map(Box::new), end: hi.0, end_open: hi.1 }), | |
| 269 | + "[" <lo:Sum> ".." <hi:HiEnd> => | |
| 270 | + Expr::RangeLit(Interval { start_open: false, start: Some(Box::new(lo)), end: hi.0, end_open: hi.1 }), | |
| 268 | 271 | "(" <lo:Sum?> ".." <hi:HiEnd> => |
| 269 | 272 | Expr::RangeLit(Interval { start_open: true, start: lo.map(Box::new), end: hi.0, end_open: hi.1 }), |
| 270 | 273 | // Reverse-open `]a..b]` ≡ `(a..b]`: an exclusive lower bound spelt with a leading |
| 271 | 274 | // `]`. The lexer retags that opener to `RBracketOpen` (a distinct terminal), so |
| 272 | 275 | // this shares no LR state with the `]` closer — same start-openness as the `(` |
| 273 | - // form, the close bracket still chosen by `HiEnd`. | |
| 276 | + // form, and (being open) it likewise admits an omitted low endpoint. | |
| 274 | 277 | RBracketOpen <lo:Sum?> ".." <hi:HiEnd> => |
| 275 | 278 | Expr::RangeLit(Interval { start_open: true, start: lo.map(Box::new), end: hi.0, end_open: hi.1 }), |
| 276 | 279 | }; |
| 277 | 280 | |
| 278 | 281 | // The part of an interval *after* the `..`: the (optional) high endpoint together with |
| 279 | 282 | // the closing bracket's openness. Either a bounded endpoint followed by `IntervalEnd` |
| 280 | -// (`]`/`)`/`[`), or — for an *unbounded* high (`[1..]`, `[1..)`; ADR-31) — a bare `]` | |
| 281 | -// or `)`. The unbounded case deliberately omits the reverse-close `[`: `[` is in | |
| 282 | -// FIRST(Endpoint) (a nested list/range high endpoint, `[1..[2..3]]`), so after `..` a | |
| 283 | -// `[` always shifts into `Endpoint`. That keeps the fork LR(1)-clean (build.rs gate); | |
| 284 | -// the rare `[1..[` is simply spelt `[1..)`. The bare `]`/`)` never clash with `Endpoint` | |
| 285 | -// (neither token is in FIRST(Endpoint)). | |
| 283 | +// (`]`/`)`/`[`), or — for an *unbounded* high (`[1..)`, `(..)`; ADR-31, rule 66 (b)/(c)) | |
| 284 | +// — the bare *open* `")"`. There is deliberately NO unbounded-high `"]"` (a closed | |
| 285 | +// bracket with no value is invalid per rule 66) and no reverse-close `[`: `[` is in | |
| 286 | +// FIRST(Endpoint) (a nested high endpoint, `[1..[2..3]]`), so after `..` a `[` always | |
| 287 | +// shifts into `Endpoint`. That keeps the fork LR(1)-clean (build.rs gate). The bare `)` | |
| 288 | +// never clashes with `Endpoint` (`)` ∉ FIRST(Endpoint)). | |
| 286 | 289 | HiEnd: (Option<Box<Expr>>, bool) = { |
| 287 | 290 | <hi:Endpoint> <eo:IntervalEnd> => (Some(Box::new(hi)), eo), |
| 288 | - "]" => (None, false), | |
| 289 | 291 | ")" => (None, true), |
| 290 | 292 | }; |
| 291 | 293 | |
| @@ -351,12 +353,14 @@ | ||
| 351 | 353 | InRhs: Vec<UnaryTest> = { |
| 352 | 354 | <op:CmpOp> <e:Sum> => vec![UnaryTest::Compare(op, Box::new(e))], |
| 353 | 355 | <e:NbSum> => vec![unary_test_from_expr(e)], |
| 354 | - // Interval *tests* with optional unbounded endpoints (ADR-31): `x in [1..]`, | |
| 355 | - // `x in [..10]`, `x in [..]`. Same `Sum?` / `HiEnd` factoring as the value-position | |
| 356 | - // `RangeLit` above; an omitted endpoint becomes `None` (an unconditionally-satisfied | |
| 357 | - // side), distinct from a present `null` bound (three-valued). | |
| 358 | - "[" <lo:Sum?> ".." <hi:HiEnd> => | |
| 359 | - vec![UnaryTest::Interval(Interval { start_open: false, start: lo.map(Box::new), end: hi.0, end_open: hi.1 })], | |
| 356 | + // Interval *tests* with optional unbounded endpoints (ADR-31): `x in [1..)`, | |
| 357 | + // `x in (..10]`, `x in (..)`. Same rule-66 factoring as the value-position `RangeLit` | |
| 358 | + // above — an omitted endpoint needs an *open* bracket (`"["` keeps its low endpoint | |
| 359 | + // mandatory; `"("` / `]` allow it omitted; `HiEnd`'s unbounded form is `")"`). An | |
| 360 | + // omitted endpoint becomes `None` (an unconditionally-satisfied side), distinct from | |
| 361 | + // a present `null` bound (three-valued). | |
| 362 | + "[" <lo:Sum> ".." <hi:HiEnd> => | |
| 363 | + vec![UnaryTest::Interval(Interval { start_open: false, start: Some(Box::new(lo)), end: hi.0, end_open: hi.1 })], | |
| 360 | 364 | "(" <lo:Sum?> ".." <hi:HiEnd> => |
| 361 | 365 | vec![UnaryTest::Interval(Interval { start_open: true, start: lo.map(Box::new), end: hi.0, end_open: hi.1 })], |
| 362 | 366 | // Reverse-open interval *test* `x in ]a..b]` (exclusive lower, ≡ `(a..b]`); the |
modified crates/feel-core/src/lib.rs +60 −45
| @@ -454,65 +454,80 @@ | ||
| 454 | 454 | #[test] |
| 455 | 455 | fn unbounded_ranges() { |
| 456 | 456 | // An omitted endpoint is UNBOUNDED (±∞; ADR-31), satisfying its side of a |
| 457 | - // membership test unconditionally. | |
| 458 | - assert_eq!(ev("5 in [1..]"), b(true)); // everything ≥ 1 | |
| 459 | - assert_eq!(ev("0 in [1..]"), b(false)); | |
| 460 | - assert_eq!(ev("1 in [1..]"), b(true)); // closed lower includes | |
| 461 | - assert_eq!(ev("1 in (1..]"), b(false)); // open lower excludes | |
| 462 | - assert_eq!(ev("5 in [..10]"), b(true)); // everything ≤ 10 | |
| 463 | - assert_eq!(ev("11 in [..10]"), b(false)); | |
| 464 | - assert_eq!(ev("10 in [..10)"), b(false)); // open upper excludes | |
| 465 | - assert_eq!(ev("42 in [..]"), b(true)); // (-∞, +∞) contains everything | |
| 466 | - | |
| 467 | - // The crux: UNBOUNDED is NOT a `null` bound. `[..10]` includes everything ≤ 10; | |
| 457 | + // membership test unconditionally. Per FEEL grammar rule 66 an omitted endpoint | |
| 458 | + // requires an OPEN bracket on that side: `[1..)` / `(..10]`, never `[1..]` / | |
| 459 | + // `[..10]` (a closed bracket with no value is a parse error; see | |
| 460 | + // `unbounded_closed_bracket_is_a_parse_error`). | |
| 461 | + assert_eq!(ev("5 in [1..)"), b(true)); // everything ≥ 1 | |
| 462 | + assert_eq!(ev("0 in [1..)"), b(false)); | |
| 463 | + assert_eq!(ev("1 in [1..)"), b(true)); // closed lower includes | |
| 464 | + assert_eq!(ev("1 in (1..)"), b(false)); // open lower excludes | |
| 465 | + assert_eq!(ev("5 in (..10]"), b(true)); // everything ≤ 10 | |
| 466 | + assert_eq!(ev("11 in (..10]"), b(false)); | |
| 467 | + assert_eq!(ev("10 in (..10)"), b(false)); // open upper excludes | |
| 468 | + assert_eq!(ev("42 in (..)"), b(true)); // (-∞, +∞) contains everything | |
| 469 | + | |
| 470 | + // The crux: UNBOUNDED is NOT a `null` bound. `(..10]` includes everything ≤ 10; | |
| 468 | 471 | // `[null..10]` is a *present* null bound, so membership is three-valued unknown |
| 469 | 472 | // (per DMN-TCK 0072) — they must stay distinct. |
| 470 | - assert_eq!(ev("5 in [..10]"), b(true)); | |
| 473 | + assert_eq!(ev("5 in (..10]"), b(true)); | |
| 471 | 474 | assert_eq!(ev("5 in [null..10]"), Value::Null); |
| 472 | - assert_eq!(ev("5 in [1..]"), b(true)); | |
| 475 | + assert_eq!(ev("5 in [1..)"), b(true)); | |
| 473 | 476 | assert_eq!(ev("5 in [1..null]"), Value::Null); |
| 474 | 477 | |
| 475 | - // Value-position literals: a first-class unbounded range, equal to itself, and | |
| 476 | - // distinct from a bounded range. `[1..]` ignores the (meaningless) upper bracket | |
| 477 | - // openness, so it equals `[1..)`; but it differs from a bounded `[1..10]`. | |
| 478 | - assert_eq!(ev("[1..] = [1..]"), b(true)); | |
| 479 | - assert_eq!(ev("[1..] = [1..)"), b(true)); // unbounded upper: bracket irrelevant | |
| 480 | - assert_eq!(ev("[..10] = [..10]"), b(true)); | |
| 481 | - assert_eq!(ev("[1..] = [1..10]"), b(false)); // unbounded ≠ bounded | |
| 482 | - assert_eq!(ev("[1..] = [2..]"), b(false)); // different lower bound | |
| 483 | - assert_eq!(ev("[..10] = [..11]"), b(false)); | |
| 478 | + // Value-position literals: a first-class unbounded range, equal to itself and | |
| 479 | + // distinct from a bounded range. | |
| 480 | + assert_eq!(ev("[1..) = [1..)"), b(true)); | |
| 481 | + assert_eq!(ev("(..10] = (..10]"), b(true)); | |
| 482 | + assert_eq!(ev("(..10] = ]..10]"), b(true)); // unbounded lower: spelling irrelevant | |
| 483 | + assert_eq!(ev("[1..) = [1..10]"), b(false)); // unbounded ≠ bounded | |
| 484 | + assert_eq!(ev("[1..) = [2..)"), b(false)); // different lower bound | |
| 485 | + assert_eq!(ev("(..10] = (..11]"), b(false)); | |
| 484 | 486 | // UNBOUNDED ≠ a present `null` bound, even structurally. |
| 485 | - assert_eq!(ev("[..10] = [null..10]"), b(false)); | |
| 487 | + assert_eq!(ev("(..10] = [null..10]"), b(false)); | |
| 486 | 488 | |
| 487 | 489 | // Range properties: an unbounded endpoint has no value and is never included. |
| 488 | - assert_eq!(ev("[1..].start"), num(1.0)); | |
| 489 | - assert_eq!(ev("[1..].end"), Value::Null); | |
| 490 | - assert_eq!(ev("[1..].end included"), b(false)); | |
| 491 | - assert_eq!(ev("[..10].start"), Value::Null); | |
| 492 | - assert_eq!(ev("[..10].start included"), b(false)); | |
| 493 | - assert_eq!(ev("[..10].end"), num(10.0)); | |
| 490 | + assert_eq!(ev("[1..).start"), num(1.0)); | |
| 491 | + assert_eq!(ev("[1..).end"), Value::Null); | |
| 492 | + assert_eq!(ev("[1..).end included"), b(false)); | |
| 493 | + assert_eq!(ev("(..10].start"), Value::Null); | |
| 494 | + assert_eq!(ev("(..10].start included"), b(false)); | |
| 495 | + assert_eq!(ev("(..10].end"), num(10.0)); | |
| 494 | 496 | |
| 495 | 497 | // `instance of`: the bounded side types the range; the unbounded side is vacuous. |
| 496 | - assert_eq!(ev("[1..] instance of range<number>"), b(true)); | |
| 497 | - assert_eq!(ev("[1..] instance of range<string>"), b(false)); | |
| 498 | - assert_eq!(ev(r#"["a"..] instance of range<string>"#), b(true)); | |
| 498 | + assert_eq!(ev("[1..) instance of range<number>"), b(true)); | |
| 499 | + assert_eq!(ev("[1..) instance of range<string>"), b(false)); | |
| 500 | + assert_eq!(ev(r#"["a"..) instance of range<string>"#), b(true)); | |
| 499 | 501 | |
| 500 | 502 | // string() echoes the written bracket, rendering an unbounded side as nothing. |
| 501 | - assert_eq!(ev("string([1..])"), Value::String("[1..]".into())); | |
| 502 | - assert_eq!(ev("string([..10))"), Value::String("[..10)".into())); | |
| 503 | - assert_eq!(ev("string([..])"), Value::String("[..]".into())); | |
| 503 | + assert_eq!(ev("string([1..))"), Value::String("[1..)".into())); | |
| 504 | + assert_eq!(ev("string((..10))"), Value::String("(..10)".into())); | |
| 505 | + assert_eq!(ev("string((..))"), Value::String("(..)".into())); | |
| 504 | 506 | |
| 505 | 507 | // Allen relations (§10.3.4.6) over unbounded operands. |
| 506 | - assert_eq!(ev("before( [..5], [10..] )"), b(true)); // (-∞,5] before [10,+∞) | |
| 507 | - assert_eq!(ev("before( [..5], [3..] )"), b(false)); // they overlap | |
| 508 | - assert_eq!(ev("includes( [..], [3..7] )"), b(true)); // (-∞,+∞) includes all | |
| 509 | - assert_eq!(ev("includes( [1..], [3..7] )"), b(true)); | |
| 510 | - assert_eq!(ev("includes( [1..], [0..7] )"), b(false)); // 0 < 1, escapes below | |
| 511 | - assert_eq!(ev("during( 5, [1..] )"), b(true)); | |
| 512 | - assert_eq!(ev("during( 5, [..10] )"), b(true)); | |
| 513 | - assert_eq!(ev("coincides( [..5], [..5] )"), b(true)); | |
| 514 | - assert_eq!(ev("coincides( [..5], (..5] )"), b(true)); // unbounded openness ignored | |
| 515 | - assert_eq!(ev("overlaps( [..5], [3..] )"), b(true)); | |
| 508 | + assert_eq!(ev("before( (..5], [10..) )"), b(true)); // (-∞,5] before [10,+∞) | |
| 509 | + assert_eq!(ev("before( (..5], [3..) )"), b(false)); // they overlap | |
| 510 | + assert_eq!(ev("includes( (..), [3..7] )"), b(true)); // (-∞,+∞) includes all | |
| 511 | + assert_eq!(ev("includes( [1..), [3..7] )"), b(true)); | |
| 512 | + assert_eq!(ev("includes( [1..), [0..7] )"), b(false)); // 0 < 1, escapes below | |
| 513 | + assert_eq!(ev("during( 5, [1..) )"), b(true)); | |
| 514 | + assert_eq!(ev("during( 5, (..10] )"), b(true)); | |
| 515 | + assert_eq!(ev("coincides( (..5], (..5] )"), b(true)); | |
| 516 | + assert_eq!(ev("coincides( (..5], ]..5] )"), b(true)); // unbounded lower: spelling ignored | |
| 517 | + assert_eq!(ev("overlaps( (..5], [3..) )"), b(true)); | |
| 518 | + } | |
| 519 | + | |
| 520 | + #[test] | |
| 521 | + fn unbounded_closed_bracket_is_a_parse_error() { | |
| 522 | + // Rule 66: an omitted endpoint behind a CLOSED bracket is invalid — these do not | |
| 523 | + // parse (a hard error, not a silent misparse), consistent with `range("[1..]")` | |
| 524 | + // being null. The valid spellings are `[1..)` / `(..10]` (ADR-31). | |
| 525 | + for src in ["[1..]", "[..10]", "[..10)", "[..]", "5 in [1..]", "5 in [..10]"] { | |
| 526 | + assert!( | |
| 527 | + compile(src).is_err(), | |
| 528 | + "expected a parse error for closed-bracket unbounded `{src}`" | |
| 529 | + ); | |
| 530 | + } | |
| 516 | 531 | } |
| 517 | 532 | |
| 518 | 533 | #[test] |
modified crates/feel-core/src/value.rs +2 −2
| @@ -61,12 +61,12 @@ | ||
| 61 | 61 | /// The payload of a [`Value::Range`]: two endpoints plus each bracket's openness. |
| 62 | 62 | /// |
| 63 | 63 | /// An endpoint is `None` when it is **unbounded** — `±∞`, a syntactically omitted |
| 64 | -/// bound (`[1..]` is everything `≥ 1`, `[..10]` everything `≤ 10`; ADR-31). This is | |
| 64 | +/// bound (`[1..)` is everything `≥ 1`, `(..10]` everything `≤ 10`; ADR-31). This is | |
| 65 | 65 | /// distinct from a *present* `null` endpoint (`Some(Value::Null)`), which keeps the |
| 66 | 66 | /// three-valued "unknown" membership of `[null..10]`. The openness flag of an |
| 67 | 67 | /// unbounded side is meaningless (`±∞` is never a member) and is ignored by every |
| 68 | 68 | /// semantic operation (equality, `.start included`, the Allen relations); it is kept |
| 69 | -/// only so `string([1..])` can echo the bracket the user wrote. | |
| 69 | +/// only so `string([1..))` can echo the bracket the user wrote. | |
| 70 | 70 | /// |
| 71 | 71 | /// A *well-formed* range has `start <= end` and any present endpoint non-null of the |
| 72 | 72 | /// same orderable type; the constructors ([`crate::builtins`] `range`, the `[a..b]` |
modified crates/feel-lua/src/lib.rs +1 −1
| @@ -380,7 +380,7 @@ | ||
| 380 | 380 | // A range has no native Lua type; hand it back as a table carrying DMN's |
| 381 | 381 | // four range properties (§10.3.4.6), so `r["start included"]` reads naturally. |
| 382 | 382 | Value::Range(r) => { |
| 383 | - // An unbounded endpoint (`[1..]`/`[..10]`; ADR-31) maps to host `null` and | |
| 383 | + // An unbounded endpoint (`[1..)`/`(..10]`; ADR-31) maps to host `null` and | |
| 384 | 384 | // is never `included` (`±∞` is no member), regardless of the bracket. |
| 385 | 385 | let t = lua.create_table()?; |
| 386 | 386 | t.set("start", value_to_lua(lua, r.start.as_ref().unwrap_or(&Value::Null))?)?; |
modified crates/feel-py/src/lib.rs +1 −1
| @@ -470,7 +470,7 @@ | ||
| 470 | 470 | // A range has no native Python type; hand it back as a dict carrying DMN's |
| 471 | 471 | // four range properties (§10.3.4.6), so `r["start included"]` reads naturally. |
| 472 | 472 | Value::Range(r) => { |
| 473 | - // An unbounded endpoint (`[1..]`/`[..10]`; ADR-31) maps to host `None` and | |
| 473 | + // An unbounded endpoint (`[1..)`/`(..10]`; ADR-31) maps to host `None` and | |
| 474 | 474 | // is never `included` (`±∞` is no member), regardless of the bracket. |
| 475 | 475 | let dict = PyDict::new(py); |
| 476 | 476 | dict.set_item("start", value_to_py(py, r.start.as_ref().unwrap_or(&Value::Null))?)?; |