Public repository: timo / feel

Reader

An interpreter of FEEL, written in Rust, with integrations for PostgreSQL, WASM, Lua, and Python.

docs: ADR-34 + ROADMAP — FEEL Java-style comments

public

docs: ADR-34 + ROADMAP — FEEL Java-style comments

ADR-34 records the lexer-level skip approach, the logos `allow_greedy`
constraint, the `Comment` variant pattern, and the ingester predicate
strip. ROADMAP bumps the suite count to 2890/88 and adds a shipped
section for 0073.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Changesetcf5ae62e9d7cf260fa8208b2a7b01d2e985516a2
Author (claimed)Timo Stolz <timo.stolz@gmail.com>,
Parents9610629cbd8a
Children
Pushlog
by timo via ssh

modified DECISIONS.md +33 −0

@@ -1700,3 +1700,36 @@
17001700
   2872 → 2877), so they are no longer in `OUT_OF_SCOPE_EXPR_SKIPS`.
17011701
   0030/0031 (boxed context + user-defined functions) remain outside the slice via the
17021702
   free-name scan (ADR-23) and need no separate exclusion.
1703
+
1704
+## ADR-34: Java-style comments in the lexer (DMN §10.3.1.2)
1705
+
1706
+- **Context:** The FEEL spec (§10.3.1.2, "Additional syntax rules") states that
1707
+  *"Java-style comments can be used, i.e., `//` to end of line and `/* ... */`"*.
1708
+  TCK `0073-feel-comments` exercises all three shapes: inline block, EOL, and
1709
+  multi-line block with trailing EOL. Without comment support every `/` is lexed
1710
+  as division (`Slash`), so `1 + /* 1 + */ 1` fails to parse entirely.
1711
+- **Decision:** skip both comment forms at the logos pass-1 level — before the
1712
+  multi-pass lexer post-processing (`mark_instance_of`, `join_names`,
1713
+  `mark_reverse_open`). Comments are dropped before those passes see the stream, so
1714
+  they require no changes.
1715
+  - **EOL comment** (`// … \n`): matched by `#[regex(r"//[^\n]*", logos::skip,
1716
+    priority = 5, allow_greedy = true)]`. `allow_greedy` is required because
1717
+    `logos` 0.16 rejects `[^\n]*` (equivalent to `.*`) without an explicit opt-in.
1718
+  - **Block comment** (`/* … */`): matched by
1719
+    `#[regex(r"/\*([^*]|\*[^/])*\*/", logos::skip, priority = 5)]`. Non-nested;
1720
+    the alternation `([^*]|\*[^/])` matches any char that is not `*`, or a `*` not
1721
+    followed by `/`, so `**/` closes correctly and `/***/` does not over-consume.
1722
+  - Both patterns live on a single `Comment` enum variant that `logos::skip` causes
1723
+    to be silently dropped — it never enters the token stream and the lalrpop grammar
1724
+    never references it. The `Display` impl's exhaustive match gets an
1725
+    `unreachable!()` arm.
1726
+  - **Priority = 5** ensures `//` / `/*` win over the 1-char `/` (`Slash`) under
1727
+    maximal munch regardless of declaration order. Bare `/` (division) and `->` are
1728
+    unaffected.
1729
+- **Ingester:** `fits_slice_grammar` would have mistaken comment words for free
1730
+  identifiers and skipped the cases. A `strip_comments(expr)` helper (added to
1731
+  `tools/ingest_tck.py`) strips both comment forms — string-aware so `"http://x"`
1732
+  is preserved — and is called at the top of `fits_slice_grammar`. The raw
1733
+  expression is still written verbatim to the fixture; feel-core handles it.
1734
+- **Coverage:** +3 fixture cases (0073 decisions 001–003, all `→ 2`). Suite
1735
+  2887 → 2890.

modified ROADMAP.md +10 −1

@@ -7,7 +7,7 @@
77
 without re-deriving the analysis.
88
 
99
 Coverage figures are case counts from `tools/ingest_tck.py` over the DMN-TCK
10
-compliance-level-3 suites. Today the fixture suite is **2877 cases / 87 files**
10
+compliance-level-3 suites. Today the fixture suite is **2890 cases / 88 files**
1111
 (`cargo test -p feel-core --test fixtures_test -- --nocapture`).
1212
 
1313
 ---
@@ -186,6 +186,15 @@
186186
 **101 → 109** (the eight `range_006`/`range_007…012` cases). Exercised by the
187187
 `value_position_comparison_test` unit test (incl. an `in`-position regression block).
188188
 
189
+### Shipped: Java-style FEEL comments (ADR-34)
190
+
191
+Two logos skip patterns on a single `Comment` variant (`//[^\n]*` with
192
+`allow_greedy = true`, and `/\*([^*]|\*[^/])*\*/`) strip both comment forms at
193
+lexer pass 1 — before the `instance of` / name-join / reverse-bracket post-passes.
194
+`fits_slice_grammar` receives a `strip_comments()` pre-pass so comment words are
195
+never mistaken for free identifiers. **Unlocked:** `0073-feel-comments` +3 cases.
196
+Suite **2887 → 2890**.
197
+
189198
 ### Shipped: range properties + `instance of` for the comparison-test value (ADR-33)
190199
 
191200
 The other half of §10.3.2.7 that ADR-32 left open. The spec calls `(< 10)` *"a typed