Public repository: timo / feel

Reader

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

feat(ingest): recognize special-character input names in the slice scan

draft feat/special-char-names

feat(ingest): recognize special-character input names in the slice scan

fits_slice_grammar's input-name blanker now also covers names containing
the arithmetic name symbols + - * / (grammar rules 25-30, ADR-47), so a
bound a-b counts as ONE name instead of the free idents a and b. Dotted
names stay outside: a dot in an expression reads as member access to
this scanner (and to the engine's probe) long before an input name could
claim it, and no TCK suite binds a dotted input name. A symbol run not
covered by a bound input (genuine subtraction a-b of two bound inputs)
stays in-slice, and a partially-covered run (a-b-c with only a-b bound)
is still skipped conservatively - c is a free ident.

Verified: re-ingesting 0001-filter with and without this change is
byte-identical (the TCK has no hyphen-named inputData today - this
aligns the scan for the decision-result-binding increment, where
Date-Time style names become bound). Behavior checks:
a-b/{a-b} kept, a-b+1/{a-b} kept, a-b-c/{a-b} skipped (free c),
a-b-c/{a-b,c} kept, x+y/{x} still rejected, full-name blanking intact.
Changesetd3afab3ac0d45526c01526904340509a8f782f43
Author (claimed)Timo Stolz <timo.stolz@gmail.com>,
Parentsa47a86da61d7
Children
Pushlog
by timo via ssh

modified tools/ingest_tck.py +12 −3

@@ -448,9 +448,18 @@
448448
     heads = sorted(_BUILTINS, key=len, reverse=True)
449449
     head_pat = "|".join(re.escape(b).replace(r"\ ", r"\s+") for b in heads)
450450
     scan = re.sub(r"\b(?:" + head_pat + r")\s*\(", "(", scan)
451
-    # Multi-word input names (`full name`, ADR-17) are single names; blank them
452
-    # before the per-word scan so their parts aren't seen as free identifiers.
453
-    for n in sorted((n for n in input_names if " " in n), key=len, reverse=True):
451
+    # Multi-word input names (`full name`, ADR-17) and special-character input
452
+    # names (`a-b`, grammar rules 25–30; ADR-47 — the engine fuses such runs
453
+    # against the scope at parse time) are single names; blank them before the
454
+    # per-word scan so their parts aren't seen as free identifiers. Only the four
455
+    # arithmetic symbols are covered: a `.` in an expression reads as member
456
+    # access to this scanner (and to the engine's probe) long before an input
457
+    # name could claim it, and no TCK suite binds a dotted input name. A symbol
458
+    # run *not* covered by a bound input (genuine subtraction `a-b` of two bound
459
+    # inputs) stays in-slice: both idents are blanked, the `-` remains.
460
+    _run_syms = "+-*/"
461
+    _blankable = (n for n in input_names if " " in n or any(c in n for c in _run_syms))
462
+    for n in sorted(_blankable, key=len, reverse=True):
454463
         scan = re.sub(r"\b" + re.escape(n).replace(r"\ ", r"\s+") + r"\b", " ", scan)
455464
     bound = set(re.findall(r"\b(?:for|some|every)\s+([A-Za-z_]\w*)\s+in\b", scan))
456465
     # Subsequent iteration contexts `…, j in b` bind further loop variables (ADR-25).