Files
zen/core/expression/tests/spec/standard/01-strings.csv
T
stefan-gorules 4a378bafc4 feat(expression): lane VM and typed-mask engine for batch and columna evaluation (#553)
* feat(expression): lane VM and typed-mask engine for batch and columnar evaluation

Adds a register-based lane VM (core/expression/src/lane) and a typed-mask
engine (core/expression/src/typed) that evaluate ZEN expressions over
batches and columns, matching the stack VM's results. zen-types gains
shape-backed objects and dot-path helpers; existing public APIs only grow.

The lane VM has no expression size limit: deep and wide expressions are
compiled and run with the same stack growth the parser uses.

ZEN_EXPRESSION_CONFIG.lane (off by default) switches Isolate::run_standard
and run_unary to the lane VM at runtime. Lane internals and the typed
module are doc(hidden); the documented entry points are LaneProgram,
LaneRunner, Session, Columns and Output.

Includes an executable specification of the expression language
(core/expression/tests/spec, 28,852 cases) with differential tests that
run every lane path against the stack VM.

zen-expression and zen-types now declare rust-version 1.88.

* refactor(types): remove the shape transition cap

Shapes are freed when nothing uses them, so the 4,096-children cap per
shape no longer bounds memory. Shape::with, Shape::of and Shape::without
now always return a shape; objects only switch to a hash map past
SPILL_AT keys, as on master.

* fix(expression): debug-profile stack safety and Windows test build

CI runs tests in the debug profile, where frames are larger and tail
recursion is not optimised. Recursive lane, typed and parser helpers now
grow the stack like the rest (Const::number, the kernel builder, typed
lowering and lookup, lane compile helpers, Node::member_key).

The parser's closure depth counter is u32 instead of u8, so 256 nested
closures no longer wrap. median([]) and empty templates no longer
overflow in debug builds; release results are unchanged.

The deep/wide test runs on a 256 KiB stack so unprotected recursion
fails quickly in any profile. The conformance helper compares with
as_str(), which is unambiguous on Windows.

* fix(expression): stack checks in the lane executor, LF test data on Windows

In x86-64 debug builds Executor::cold has a ~93 KB frame, so nested
closures (execute -> cold -> body) could use more stack between two
checks than the stack-growth margin and overflow. execute and cold now
check the stack themselves; both run per instruction batch, not per row.

The expression test data is checked out with LF on every platform.
Windows runners converted it to CRLF, which broke multi-line spec cases.
2026-10-28 11:39:54 +01:00

4.3 KiB

1expression (string)input (json 5)output (json 5)note
2# Single and double quotes
3'hello''hello'
4"hello"'hello'
5'hello world''hello world'
6"hello world"'hello world'
7''''
8""''
9' '' '
10' '' '
11'a' == "a"true
12type('')'string'
13type('a')'string'
14len('')0
15len(' ')1
16# The other quote kind is plain text inside a string
17'"''"'
18"'"'\''
19"it's"'it\'s'
20"a'b'c"'a\'b\'c'
21# Numeric-looking and keyword-looking strings stay strings
22'1''1'
23'1' == 1false
24type('1')'string'
25'1e3''1e3'
26'-0''-0'
27'0x10''0x10'
28'true''true'
29'true' == truefalse
30'null''null'
31'null' == nullfalse
32'and''and'
33'not in''not in'
34# Operator and punctuation characters inside strings
35'a + b''a + b'
36'a, b''a, b'
37'[1..5]''[1..5]'
38'{a: 1}''{a: 1}'
39'a.b''a.b'
40'?? ?:''?? ?:'
41'#''#'
42'$''$'
43'${x}''${x}'
44'a;b''a;b'
45'`''`'
46'a`b`c''a`b`c'
47'//''//'
48'/* */''/* */'
49'%^&*=!<>''%^&*=!<>'
50'@~|''@~|'
51# No escape sequences: a backslash is an ordinary character
52'a\nb''a\\nb'question: string literals have no escape sequences so \n stays two characters
53len('a\nb')4question: string literals have no escape sequences so \n stays two characters
54'\t''\\t'question: string literals have no escape sequences
55'\u0041''\\u0041'question: string literals have no escape sequences
56'\\''\\\\'question: string literals have no escape sequences so \\ stays two backslashes
57'\''\\'question: a trailing backslash does not escape the closing quote
58'\''\\'
59'a\'b'!errorquestion: \' does not escape the quote so the literal is unterminated
60'a''b'!errorquestion: doubling the quote is not an escape either, so a quote cannot appear in a same-quoted string
61''''!error
62# Unicode
63'é''é'
64'ü''ü'
65'日本語''日本語'
66'Привет''Привет'
67'مرحبا''مرحبا'
68'😀''😀'
69'👨‍👩‍👧''👨‍👩‍👧'
70'a😀b''a😀b'
71'é' == 'é'true
72'😀' + '😀''😀😀'
73len('é')1bug: len counts UTF-8 bytes instead of characters
74len('日本語')3bug: len counts UTF-8 bytes instead of characters
75len('😀')1bug: len counts UTF-8 bytes instead of characters
76['é', '😀']['é', '😀']
77# Multi-line strings keep the newline
78'a b''a\nb'
79"a b"'a\nb'
80len('a b')3
81' ''\n'
82# Tabs inside strings are kept
83'a b''a\tb'
84# Unterminated strings
85'!error
86'abc!error
87"abc!error
88"abc'!error
89'a' + 'b!error
90['a]!error
91{a: 'b}!error
92# Adjacent strings do not concatenate
93'a' 'b'!error
94'a'''!error
95'a' + 'b''ab'
96# Strings from the input
97s{s: 'x'}'x'
98s{s: ''}''
99s{s: 'é😀'}'é😀'
100s{s: 'a\nb'}'a\nb'
101s{s: null}null
102s{}null
103s == 'x'{s: 'x'}true
104s == 'x'{s: 'X'}false
105s == 'x'{s: ''}false
106s == 'x'{s: null}false
107s == 'x'{s: 1}false
108s == 'x'{}false
109s == 'é😀'{s: 'é😀'}true
110s == 'é😀'{s: 'e😀'}false
111s == 'é😀'{s: null}false
112s == 'é😀'{}false
113s == 'a\nb'{s: 'a\\nb'}truequestion: string literals have no escape sequences
114s == 'a\nb'{s: 'a\nb'}falsequestion: string literals have no escape sequences
115s == 'a\nb'{s: null}false
116# Booleans
117truetrue
118falsefalse
119type(true)'bool'
120type(false)'bool'
121true == truetrue
122true == falsefalse
123not truefalse
124not falsetrue
125!truefalse
126!falsetrue
127[true, false][true, false]
128{t: true, f: false}{t: true, f: false}
129# Keywords are lower-case onlyother spellings are identifiers
130TRUE{}null
131True{}null
132FALSE{}null
133True{True: 1}1
134trueish{trueish: 2}2
135falsey{falsey: 3}3
136true1{true1: 4}4
137# Null
138nullnull
139type(null)'null'
140null == nulltrue
141null != nullfalse
142null == falsefalse
143null == 0false
144null == ''false
145[null][null]
146[null, null][null, null]
147{a: null}{a: null}
148Null{}null
149NULL{Null: 1, NULL: 2}2
150nulls{nulls: 5}5
151nullable{nullable: 6}6
152null_{null_: 7}7
153# Literal values compared to input values
154b{b: true}true
155b{b: false}false
156b{b: null}null
157b{}null
158b == true{b: true}true
159b == true{b: false}false
160b == true{b: 'true'}false
161b == true{b: 1}false
162b == true{b: null}false
163b == true{}false
164n == null{n: null}true
165n == null{}true
166n == null{n: 0}false
167n == null{n: ''}false
168n == null{n: false}false
169n == null{n: []}false
170n == null{n: 'null'}false