@kanonak-protocol/expression 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +186 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +785 -40
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,36 +2,95 @@
|
|
|
2
2
|
* `@kanonak-protocol/expression` — the Kanonak expression RUNTIME.
|
|
3
3
|
*
|
|
4
4
|
* A small, deterministic tree-walker that folds a `kanonak.org/transformations`
|
|
5
|
-
* (`tx`) + `kanonak.org/math` expression tree to a
|
|
5
|
+
* (`tx`) + `kanonak.org/math` expression tree to a value. Generated SDKs
|
|
6
6
|
* reference it so a typed expression can be *run*, not just *represented*.
|
|
7
7
|
*
|
|
8
8
|
* Three layers, exactly as the six-language proof established:
|
|
9
9
|
*
|
|
10
|
-
* 1. DISPATCH — derived from the ontology. An operator's
|
|
11
|
-
* `tx` superclass: UnaryNumericOp -> unary `value`; BinaryArithmetic /
|
|
12
|
-
* BinaryComparison -> binary; BooleanLogic -> n-ary `operands`;
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* 1. DISPATCH — derived from the ontology. An operator's shape falls out of
|
|
11
|
+
* its `tx` superclass: UnaryNumericOp -> unary `value`; BinaryArithmetic /
|
|
12
|
+
* BinaryComparison -> binary; BooleanLogic -> n-ary `operands`;
|
|
13
|
+
* ListSourcedExpression / ListAggregate -> `source`; IteratingExpression
|
|
14
|
+
* -> `source` + `loopVar` + a body; plus the structural shapes the
|
|
15
|
+
* hierarchy can't imply (`Not`'s `operand`, `Clip`'s ternary, `Contains`'
|
|
16
|
+
* haystack/needle, `Matches`' matchSource/pattern). The tables below are
|
|
17
|
+
* that derivation, frozen.
|
|
15
18
|
*
|
|
16
|
-
* 2. PRIMITIVES — the
|
|
17
|
-
*
|
|
18
|
-
* matched in every language port (Round half-away-from-zero, floored
|
|
19
|
-
* Sign(0)=0, comparisons as 1/0
|
|
19
|
+
* 2. PRIMITIVES — the authored, determinism-bearing artifact. Tables map
|
|
20
|
+
* each operator URI to its fold. Determinism traps live here and are
|
|
21
|
+
* matched in every language port (Round half-away-from-zero, floored
|
|
22
|
+
* Modulo, Sign(0)=0, comparisons as 1/0, RFC 8785-style number
|
|
23
|
+
* stringification in Join, the pinned Matches regex subset).
|
|
20
24
|
*
|
|
21
25
|
* 3. THE FOLD — `evaluate`, a fixed shape: operators recurse + apply a
|
|
22
|
-
* primitive; literals return their
|
|
23
|
-
* VarRef, a domain `Step`/`Time`/`Smooth`,
|
|
24
|
-
* caller's `resolve(node, ctx, evaluate)`. The
|
|
25
|
-
*
|
|
26
|
-
*
|
|
26
|
+
* primitive; literals return their value; EVERYTHING ELSE (a typed
|
|
27
|
+
* VarRef, a domain `Step`/`Time`/`Smooth`, a host graph read, any future
|
|
28
|
+
* leaf) is handed to the caller's `resolve(node, ctx, evaluate)`. The
|
|
29
|
+
* runtime is a pure operator engine; binding, graph access, and
|
|
30
|
+
* domain-leaf semantics are the caller's business. A property read is
|
|
31
|
+
* just a caller leaf that returns a list — the kernel NEVER touches a
|
|
32
|
+
* graph.
|
|
27
33
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
34
|
+
* VALUE DOMAIN (expressionRuntimeVersion "2"): `number | string | ref | list`.
|
|
35
|
+
*
|
|
36
|
+
* - Booleans and comparison results remain `1`/`0` numbers (the v1 rule).
|
|
37
|
+
* - A `ref` is a canonical versionless URI identity (`{ ref: string }`),
|
|
38
|
+
* compared by URI-key equality — the same identity rule the ordered
|
|
39
|
+
* comparisons and `tx.Equals` share.
|
|
40
|
+
* - A `list` is an ordered sequence of values.
|
|
41
|
+
* - There is NO null/undefined: ABSENCE IS THE EMPTY LIST. A caller leaf
|
|
42
|
+
* for a property with no values returns `[]`; `IsSet` distinguishes.
|
|
43
|
+
*
|
|
44
|
+
* ERROR CONTRACT (v2 extension of the v1 fail-loud discipline):
|
|
45
|
+
*
|
|
46
|
+
* - COMPUTATIONS FAIL LOUD: an arithmetic/unary-numeric/boolean-logic
|
|
47
|
+
* operator whose operand is not a number, an aggregate over a non-numeric
|
|
48
|
+
* element, `Min`/`Max`/`Average` on an empty list, a nested list in
|
|
49
|
+
* `Join`, a non-string `Matches` source, an out-of-subset `Matches`
|
|
50
|
+
* pattern — all raise `ExpressionError`, never coerce.
|
|
51
|
+
* - PREDICATES FAIL CLOSED: `Equals` and the ordering comparisons on
|
|
52
|
+
* cross-kind or non-numeric operands return `0`, never error (the SHACL
|
|
53
|
+
* and reference-engine rule: a non-comparable value is a falsified
|
|
54
|
+
* constraint, not a crash).
|
|
55
|
+
*
|
|
56
|
+
* v1 COMPATIBILITY: the value domain is a strict superset and no numeric
|
|
57
|
+
* primitive changed — every v1 parity vector passes unchanged under v2. The
|
|
58
|
+
* conformance harness runs the v1 vector file through this kernel as the
|
|
59
|
+
* regression gate.
|
|
60
|
+
*
|
|
61
|
+
* LAMBDA BINDING (the one genuinely-new dispatch shape): the iterating
|
|
62
|
+
* operators (`Filter`, `ListMap`, `ForEach`) bind their `loopVar` per element.
|
|
63
|
+
* Within an iterating operator's body — and ONLY there — a `tx.VarRef` whose
|
|
64
|
+
* `varName` names a lexically-enclosing `loopVar` is resolved by the kernel to
|
|
65
|
+
* the bound element (innermost binder wins). Every other leaf, including a
|
|
66
|
+
* `VarRef` naming anything else, still goes to the caller's `resolve`. This is
|
|
67
|
+
* the scoped exception to "the kernel never privileges VarRef": VarRef is the
|
|
68
|
+
* bound-variable mechanism of the kernel's own binders, nothing more. The
|
|
69
|
+
* remaining iterating family (WindowedMap, PairwiseMap, Scan, DistinctBy,
|
|
70
|
+
* PartitionBy) is additive within v2 under this same reserved shape.
|
|
71
|
+
*
|
|
72
|
+
* `EXPRESSION_RUNTIME_VERSION` freezes the determinism contract; a change to
|
|
73
|
+
* any primitive, value rule, or dispatch entry requires a NEW version, never
|
|
74
|
+
* an edit in place. Adding an operator, or widening the Matches subset (an
|
|
75
|
+
* error becoming a defined result), is additive WITHIN a version.
|
|
32
76
|
*/
|
|
33
77
|
/** The frozen expression-runtime version (determinism contract). Not hashed. */
|
|
34
|
-
export declare const EXPRESSION_RUNTIME_VERSION = "
|
|
78
|
+
export declare const EXPRESSION_RUNTIME_VERSION = "2";
|
|
79
|
+
/**
|
|
80
|
+
* A reference value — a member's canonical versionless URI identity
|
|
81
|
+
* (`publisher/package/name`). Distinct from a string so `Equals` can hold the
|
|
82
|
+
* cross-kind-is-false rule: a URI is never equal to the string spelling of it.
|
|
83
|
+
*/
|
|
84
|
+
export interface RefValue {
|
|
85
|
+
ref: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The v2 value domain. Booleans are `1`/`0` numbers; absence is the empty
|
|
89
|
+
* list; there is no null.
|
|
90
|
+
*/
|
|
91
|
+
export type Value = number | string | RefValue | Value[];
|
|
92
|
+
/** Discriminate a `RefValue` from the other object shape (arrays). */
|
|
93
|
+
export declare function isRef(v: Value): v is RefValue;
|
|
35
94
|
/** A node in the expression tree. `type` is the operator/literal/leaf canonical
|
|
36
95
|
* URI (versionless: `publisher/package/name`); operand keys are the frozen `tx`
|
|
37
96
|
* operand property local names. Unknown fields are ignored by the kernel and are
|
|
@@ -41,17 +100,116 @@ export interface ExprNode {
|
|
|
41
100
|
[operandOrValue: string]: unknown;
|
|
42
101
|
}
|
|
43
102
|
/** Resolve any node the kernel does not recognise as an operator or literal — a
|
|
44
|
-
* binding (`tx.VarRef`, a domain's typed `refersTo` VarRef)
|
|
45
|
-
* (
|
|
46
|
-
*
|
|
103
|
+
* binding (`tx.VarRef`, a domain's typed `refersTo` VarRef), a host graph read
|
|
104
|
+
* (a property-read leaf returning a list), or a domain leaf (`Step`, `Time`,
|
|
105
|
+
* `Smooth`…) — to a value. `ctx` is opaque caller state (the binding env, a
|
|
106
|
+
* graph handle, a sim clock, integration state). `evaluate` is handed back so a
|
|
47
107
|
* domain leaf containing sub-expressions can recurse into the kernel. */
|
|
48
|
-
export type Resolve<C> = (node: ExprNode, ctx: C, evaluate: (n: ExprNode, ctx: C) =>
|
|
108
|
+
export type Resolve<C> = (node: ExprNode, ctx: C, evaluate: (n: ExprNode, ctx: C) => Value) => Value;
|
|
109
|
+
/**
|
|
110
|
+
* The transitive closures ordered comparisons consult, keyed by the ordering
|
|
111
|
+
* property's canonical URI, then by member: `closures[property][from]` is the
|
|
112
|
+
* set of members `from` reaches. Flat, already-closed data — typically the
|
|
113
|
+
* SDK reasoner's `prp-trp` saturation emitted at code-generation time. The
|
|
114
|
+
* kernel does set membership only; it NEVER computes a closure, resolves a
|
|
115
|
+
* package, or reasons. Supplying the closure is the caller's business, the
|
|
116
|
+
* same division that keeps variable binding out of the kernel.
|
|
117
|
+
*/
|
|
118
|
+
export type ClosureTable = Record<string, Record<string, readonly string[]>>;
|
|
119
|
+
/** Resolve an identity leaf inside an ordered comparison — any operand node
|
|
120
|
+
* that is not a `tx.UriLiteral` — to a member's canonical versionless URI
|
|
121
|
+
* (`publisher/package/name`). The identity-domain mirror of {@link Resolve}:
|
|
122
|
+
* the kernel owns the constant leaf, the caller owns bindings. */
|
|
123
|
+
export type ResolveRef<C> = (node: ExprNode, ctx: C) => string;
|
|
124
|
+
/** Optional evaluation context for the ordered comparisons (`IsAtLeast`,
|
|
125
|
+
* `Dominates`). Absent (or missing a needed entry), an ordered comparison
|
|
126
|
+
* fails loudly — never a silent false from a missing table. */
|
|
127
|
+
export interface EvalOptions<C> {
|
|
128
|
+
closures?: ClosureTable;
|
|
129
|
+
resolveRef?: ResolveRef<C>;
|
|
130
|
+
}
|
|
49
131
|
export declare class ExpressionError extends Error {
|
|
50
132
|
}
|
|
51
133
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
134
|
+
* Validate a `Matches` pattern against the pinned subset — the intersection of
|
|
135
|
+
* RE2 and the host regex engines, chosen so every port compiles the same
|
|
136
|
+
* pattern to the same language. RE2 is both the restrictive common denominator
|
|
137
|
+
* and ReDoS-safe (no catastrophic backtracking), which is a REQUIREMENT for a
|
|
138
|
+
* predicate that may gate on adversarial input. Out-of-subset constructs are a
|
|
139
|
+
* LOUD error, the same discipline as Round/Modulo; WIDENING the subset later
|
|
140
|
+
* (an error becoming a defined result) is additive within v2.
|
|
141
|
+
*
|
|
142
|
+
* COUNTING UNIT — pinned: `.` and quantifiers count Unicode CODE POINTS, in
|
|
143
|
+
* every port. An astral-plane character (a surrogate pair in UTF-16 hosts)
|
|
144
|
+
* is ONE `.`, and `.{3}` matches exactly three code points — matching RE2's
|
|
145
|
+
* rune model and Python's, and what SHACL/SPARQL string length means. The
|
|
146
|
+
* UTF-16 engines must opt in (this port compiles with the `u` flag; Java
|
|
147
|
+
* and C# ports normalize equivalently) — without the pin, `.{m,n}` counts
|
|
148
|
+
* different units across exactly these seven targets, and the length
|
|
149
|
+
* lowering (`(?s)^.{m,}$`) would judge astral input differently per
|
|
150
|
+
* language. The astral vectors gate this: a port that counts code units
|
|
151
|
+
* fails conformance, not the tenant.
|
|
152
|
+
*
|
|
153
|
+
* Allowed: literals; `.`; anchors `^` `$`; alternation `|`; groups `(...)`,
|
|
154
|
+
* `(?:...)`; a WHOLE-PATTERN flag prefix over `i`/`m`/`s` (`(?i)` at position
|
|
155
|
+
* 0 only — each port translates it to its host flag mechanism); quantifiers
|
|
156
|
+
* `*` `+` `?` `{m}` `{m,}` `{m,n}`; character classes with ranges and
|
|
157
|
+
* negation; escapes `\d \D \w \W \s \S \b \B \n \r \t \f \v \xHH`, escaped
|
|
158
|
+
* syntax punctuation (`\.` `\*` `\+` `\?` `\(` `\)` `\[` `\]` `\{` `\}`
|
|
159
|
+
* `\|` `\^` `\$` `\\` `\/`), and `\-` inside character classes.
|
|
160
|
+
*
|
|
161
|
+
* Rejected (divergent or unsafe across engines): lookahead/lookbehind, named
|
|
162
|
+
* groups, backreferences (`\1`…, `\k`), MID-pattern flag groups (`(?i:…)` —
|
|
163
|
+
* not portable to the JS and Python engines), `\p{…}`/`\P{…}` unicode
|
|
164
|
+
* property classes, POSIX classes (`[[:alpha:]]`), class intersection
|
|
165
|
+
* (`&&`), atomic groups, conditionals, comments, octal/`\u`/`\x{…}` escapes,
|
|
166
|
+
* escaped space (`\ `), `\-` outside a class, and a bare unescaped `{` that
|
|
167
|
+
* is not a quantifier (literal braces must be escaped — engines disagree on
|
|
168
|
+
* the lenient reading, so the subset requires the explicit form).
|
|
169
|
+
*/
|
|
170
|
+
export declare function validateMatchesPattern(pattern: string): void;
|
|
171
|
+
/**
|
|
172
|
+
* Evaluate an expression tree to a value. Operators fold via the frozen
|
|
173
|
+
* dispatch + primitive tables; literals yield their value; any other node is
|
|
174
|
+
* delegated to `resolve`. `options` carries the ordered-comparison context
|
|
175
|
+
* (closures + identity-leaf resolution) and is only consulted when an
|
|
176
|
+
* `IsAtLeast` / `Dominates` node is reached.
|
|
177
|
+
*/
|
|
178
|
+
export declare function evaluate<C = unknown>(node: ExprNode, ctx: C, resolve: Resolve<C>, options?: EvalOptions<C>): Value;
|
|
179
|
+
/**
|
|
180
|
+
* One node of an evaluation trace — the verdict tree {@link explain} returns.
|
|
181
|
+
*
|
|
182
|
+
* Mirrors the expression: `type` is the node's type URI, `value` its result
|
|
183
|
+
* (`1`/`0` for booleans), `children` the operand traces in evaluation order.
|
|
184
|
+
* A short-circuited operand is simply ABSENT from `children` — the trace is
|
|
185
|
+
* truthful about what ran. An iterating operator's children are its source
|
|
186
|
+
* trace followed by one body trace per visited element. Ordered comparisons
|
|
187
|
+
* carry their resolved operand identities as `leftRef`/`rightRef` instead of
|
|
188
|
+
* children, since their operands are identities rather than value folds.
|
|
189
|
+
*
|
|
190
|
+
* This is a runtime return shape, not an ontology class: nothing authors a
|
|
191
|
+
* trace, so nothing about it is modelled or serialized as vocabulary. (A host
|
|
192
|
+
* assembling an AUTHORED report — e.g. a SHACL ValidationReport — builds it
|
|
193
|
+
* FROM these traces; the vocabulary lives with the host's ontology.)
|
|
194
|
+
*/
|
|
195
|
+
export interface TraceNode {
|
|
196
|
+
type: string;
|
|
197
|
+
value: Value;
|
|
198
|
+
children: TraceNode[];
|
|
199
|
+
leftRef?: string;
|
|
200
|
+
rightRef?: string;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Evaluate an expression tree and return the verdict tree — the regex-debugger
|
|
204
|
+
* view: every evaluated node, its own result, and (for ordered comparisons)
|
|
205
|
+
* the identities it compared. The root's `value` is exactly what
|
|
206
|
+
* {@link evaluate} returns for the same inputs; the conformance suite runs
|
|
207
|
+
* every vector through both and requires agreement, so the two entry points
|
|
208
|
+
* cannot drift. Kept separate from `evaluate` so the hot path never pays for
|
|
209
|
+
* trace allocation.
|
|
210
|
+
*
|
|
211
|
+
* Errors propagate exactly as in `evaluate` — a failed evaluation yields an
|
|
212
|
+
* error, not a partial trace.
|
|
55
213
|
*/
|
|
56
|
-
export declare function
|
|
214
|
+
export declare function explain<C = unknown>(node: ExprNode, ctx: C, resolve: Resolve<C>, options?: EvalOptions<C>): TraceNode;
|
|
57
215
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AAEH,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAK9C;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,EAAE,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8KD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,CAAC,GAAG,OAAO,EACjC,IAAI,EAAE,QAAQ,EACd,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GACvB,SAAS,CAyKX"}
|
package/dist/index.js
CHANGED
|
@@ -2,38 +2,86 @@
|
|
|
2
2
|
* `@kanonak-protocol/expression` — the Kanonak expression RUNTIME.
|
|
3
3
|
*
|
|
4
4
|
* A small, deterministic tree-walker that folds a `kanonak.org/transformations`
|
|
5
|
-
* (`tx`) + `kanonak.org/math` expression tree to a
|
|
5
|
+
* (`tx`) + `kanonak.org/math` expression tree to a value. Generated SDKs
|
|
6
6
|
* reference it so a typed expression can be *run*, not just *represented*.
|
|
7
7
|
*
|
|
8
8
|
* Three layers, exactly as the six-language proof established:
|
|
9
9
|
*
|
|
10
|
-
* 1. DISPATCH — derived from the ontology. An operator's
|
|
11
|
-
* `tx` superclass: UnaryNumericOp -> unary `value`; BinaryArithmetic /
|
|
12
|
-
* BinaryComparison -> binary; BooleanLogic -> n-ary `operands`;
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* 1. DISPATCH — derived from the ontology. An operator's shape falls out of
|
|
11
|
+
* its `tx` superclass: UnaryNumericOp -> unary `value`; BinaryArithmetic /
|
|
12
|
+
* BinaryComparison -> binary; BooleanLogic -> n-ary `operands`;
|
|
13
|
+
* ListSourcedExpression / ListAggregate -> `source`; IteratingExpression
|
|
14
|
+
* -> `source` + `loopVar` + a body; plus the structural shapes the
|
|
15
|
+
* hierarchy can't imply (`Not`'s `operand`, `Clip`'s ternary, `Contains`'
|
|
16
|
+
* haystack/needle, `Matches`' matchSource/pattern). The tables below are
|
|
17
|
+
* that derivation, frozen.
|
|
15
18
|
*
|
|
16
|
-
* 2. PRIMITIVES — the
|
|
17
|
-
*
|
|
18
|
-
* matched in every language port (Round half-away-from-zero, floored
|
|
19
|
-
* Sign(0)=0, comparisons as 1/0
|
|
19
|
+
* 2. PRIMITIVES — the authored, determinism-bearing artifact. Tables map
|
|
20
|
+
* each operator URI to its fold. Determinism traps live here and are
|
|
21
|
+
* matched in every language port (Round half-away-from-zero, floored
|
|
22
|
+
* Modulo, Sign(0)=0, comparisons as 1/0, RFC 8785-style number
|
|
23
|
+
* stringification in Join, the pinned Matches regex subset).
|
|
20
24
|
*
|
|
21
25
|
* 3. THE FOLD — `evaluate`, a fixed shape: operators recurse + apply a
|
|
22
|
-
* primitive; literals return their
|
|
23
|
-
* VarRef, a domain `Step`/`Time`/`Smooth`,
|
|
24
|
-
* caller's `resolve(node, ctx, evaluate)`. The
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
26
|
+
* primitive; literals return their value; EVERYTHING ELSE (a typed
|
|
27
|
+
* VarRef, a domain `Step`/`Time`/`Smooth`, a host graph read, any future
|
|
28
|
+
* leaf) is handed to the caller's `resolve(node, ctx, evaluate)`. The
|
|
29
|
+
* runtime is a pure operator engine; binding, graph access, and
|
|
30
|
+
* domain-leaf semantics are the caller's business. A property read is
|
|
31
|
+
* just a caller leaf that returns a list — the kernel NEVER touches a
|
|
32
|
+
* graph.
|
|
33
|
+
*
|
|
34
|
+
* VALUE DOMAIN (expressionRuntimeVersion "2"): `number | string | ref | list`.
|
|
35
|
+
*
|
|
36
|
+
* - Booleans and comparison results remain `1`/`0` numbers (the v1 rule).
|
|
37
|
+
* - A `ref` is a canonical versionless URI identity (`{ ref: string }`),
|
|
38
|
+
* compared by URI-key equality — the same identity rule the ordered
|
|
39
|
+
* comparisons and `tx.Equals` share.
|
|
40
|
+
* - A `list` is an ordered sequence of values.
|
|
41
|
+
* - There is NO null/undefined: ABSENCE IS THE EMPTY LIST. A caller leaf
|
|
42
|
+
* for a property with no values returns `[]`; `IsSet` distinguishes.
|
|
43
|
+
*
|
|
44
|
+
* ERROR CONTRACT (v2 extension of the v1 fail-loud discipline):
|
|
45
|
+
*
|
|
46
|
+
* - COMPUTATIONS FAIL LOUD: an arithmetic/unary-numeric/boolean-logic
|
|
47
|
+
* operator whose operand is not a number, an aggregate over a non-numeric
|
|
48
|
+
* element, `Min`/`Max`/`Average` on an empty list, a nested list in
|
|
49
|
+
* `Join`, a non-string `Matches` source, an out-of-subset `Matches`
|
|
50
|
+
* pattern — all raise `ExpressionError`, never coerce.
|
|
51
|
+
* - PREDICATES FAIL CLOSED: `Equals` and the ordering comparisons on
|
|
52
|
+
* cross-kind or non-numeric operands return `0`, never error (the SHACL
|
|
53
|
+
* and reference-engine rule: a non-comparable value is a falsified
|
|
54
|
+
* constraint, not a crash).
|
|
55
|
+
*
|
|
56
|
+
* v1 COMPATIBILITY: the value domain is a strict superset and no numeric
|
|
57
|
+
* primitive changed — every v1 parity vector passes unchanged under v2. The
|
|
58
|
+
* conformance harness runs the v1 vector file through this kernel as the
|
|
59
|
+
* regression gate.
|
|
60
|
+
*
|
|
61
|
+
* LAMBDA BINDING (the one genuinely-new dispatch shape): the iterating
|
|
62
|
+
* operators (`Filter`, `ListMap`, `ForEach`) bind their `loopVar` per element.
|
|
63
|
+
* Within an iterating operator's body — and ONLY there — a `tx.VarRef` whose
|
|
64
|
+
* `varName` names a lexically-enclosing `loopVar` is resolved by the kernel to
|
|
65
|
+
* the bound element (innermost binder wins). Every other leaf, including a
|
|
66
|
+
* `VarRef` naming anything else, still goes to the caller's `resolve`. This is
|
|
67
|
+
* the scoped exception to "the kernel never privileges VarRef": VarRef is the
|
|
68
|
+
* bound-variable mechanism of the kernel's own binders, nothing more. The
|
|
69
|
+
* remaining iterating family (WindowedMap, PairwiseMap, Scan, DistinctBy,
|
|
70
|
+
* PartitionBy) is additive within v2 under this same reserved shape.
|
|
71
|
+
*
|
|
72
|
+
* `EXPRESSION_RUNTIME_VERSION` freezes the determinism contract; a change to
|
|
73
|
+
* any primitive, value rule, or dispatch entry requires a NEW version, never
|
|
74
|
+
* an edit in place. Adding an operator, or widening the Matches subset (an
|
|
75
|
+
* error becoming a defined result), is additive WITHIN a version.
|
|
32
76
|
*/
|
|
33
77
|
/** The frozen expression-runtime version (determinism contract). Not hashed. */
|
|
34
|
-
export const EXPRESSION_RUNTIME_VERSION = '
|
|
78
|
+
export const EXPRESSION_RUNTIME_VERSION = '2';
|
|
35
79
|
const TX = 'kanonak.org/transformations';
|
|
36
80
|
const MATH = 'kanonak.org/math';
|
|
81
|
+
/** Discriminate a `RefValue` from the other object shape (arrays). */
|
|
82
|
+
export function isRef(v) {
|
|
83
|
+
return typeof v === 'object' && !Array.isArray(v);
|
|
84
|
+
}
|
|
37
85
|
export class ExpressionError extends Error {
|
|
38
86
|
}
|
|
39
87
|
const UN = (operand) => ({ kind: 'unary', operand });
|
|
@@ -73,6 +121,23 @@ const OPERATOR_ARITY = {
|
|
|
73
121
|
// semantics — handled explicitly in `evaluate`, not via the numeric tables.
|
|
74
122
|
[`${MATH}/Clip`]: { kind: 'ternary', a: 'clipValue', b: 'clipLower', c: 'clipUpper' },
|
|
75
123
|
};
|
|
124
|
+
/** IteratingExpression operators: `source` + `loopVar` + the body operand. */
|
|
125
|
+
const ITERATOR_BODY = {
|
|
126
|
+
[`${TX}/ForEach`]: 'emit',
|
|
127
|
+
[`${TX}/ListMap`]: 'mapBody',
|
|
128
|
+
[`${TX}/Filter`]: 'predicate',
|
|
129
|
+
};
|
|
130
|
+
/** KindPredicate operators the kernel can answer over ITS value domain.
|
|
131
|
+
* `IsBoolean` and `IsEmbedded` name kinds that exist only in a host object
|
|
132
|
+
* model (booleans are 1/0 numbers here; embedded nodes never enter the
|
|
133
|
+
* kernel), so they are NOT dispatch entries — they fall through to the
|
|
134
|
+
* caller's `resolve`, where the host answers with full fidelity. */
|
|
135
|
+
const KIND_PREDICATES = {
|
|
136
|
+
[`${TX}/IsString`]: (v) => typeof v === 'string',
|
|
137
|
+
[`${TX}/IsNumber`]: (v) => typeof v === 'number',
|
|
138
|
+
[`${TX}/IsReference`]: (v) => typeof v === 'object' && !Array.isArray(v),
|
|
139
|
+
[`${TX}/IsList`]: (v) => Array.isArray(v),
|
|
140
|
+
};
|
|
76
141
|
/** Floored modulo (the host `%` truncates toward zero): Modulo(-7,3) = 2. */
|
|
77
142
|
function flooredMod(a, b) {
|
|
78
143
|
if (b === 0)
|
|
@@ -89,7 +154,21 @@ function requireDomain(ok, msg) {
|
|
|
89
154
|
if (!ok)
|
|
90
155
|
throw new ExpressionError(msg);
|
|
91
156
|
}
|
|
92
|
-
/**
|
|
157
|
+
/** A computation operand must be a number — fail loud, never coerce. */
|
|
158
|
+
function requireNumber(v, op) {
|
|
159
|
+
if (typeof v !== 'number') {
|
|
160
|
+
throw new ExpressionError(`${op} requires a numeric operand, got ${kindOf(v)}`);
|
|
161
|
+
}
|
|
162
|
+
return v;
|
|
163
|
+
}
|
|
164
|
+
function kindOf(v) {
|
|
165
|
+
if (typeof v === 'number')
|
|
166
|
+
return 'number';
|
|
167
|
+
if (typeof v === 'string')
|
|
168
|
+
return 'string';
|
|
169
|
+
return Array.isArray(v) ? 'list' : 'ref';
|
|
170
|
+
}
|
|
171
|
+
/** Unary/binary numeric primitives, keyed by operator URI. The authored,
|
|
93
172
|
* determinism-bearing table — matched per language. */
|
|
94
173
|
const UNARY = {
|
|
95
174
|
[`${TX}/Abs`]: (x) => Math.abs(x),
|
|
@@ -103,7 +182,7 @@ const UNARY = {
|
|
|
103
182
|
[`${MATH}/Round`]: roundHalfAway,
|
|
104
183
|
[`${MATH}/Sign`]: (x) => Math.sign(x),
|
|
105
184
|
};
|
|
106
|
-
const
|
|
185
|
+
const BINARY_ARITH = {
|
|
107
186
|
[`${TX}/Add`]: (a, b) => a + b,
|
|
108
187
|
[`${TX}/Subtract`]: (a, b) => a - b,
|
|
109
188
|
[`${TX}/Multiply`]: (a, b) => a * b,
|
|
@@ -112,39 +191,452 @@ const BINARY = {
|
|
|
112
191
|
[`${MATH}/Modulo`]: flooredMod,
|
|
113
192
|
[`${MATH}/Minimum`]: (a, b) => Math.min(a, b),
|
|
114
193
|
[`${MATH}/Maximum`]: (a, b) => Math.max(a, b),
|
|
115
|
-
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Ordering comparisons are PREDICATES: on non-numeric operands they fail
|
|
197
|
+
* CLOSED (`0`), matching the reference engine and the SHACL rule that a
|
|
198
|
+
* non-comparable value falsifies a constraint. (Contrast the arithmetic
|
|
199
|
+
* table above, which fails loud.)
|
|
200
|
+
*/
|
|
201
|
+
const BINARY_ORDER = {
|
|
116
202
|
[`${TX}/GreaterThan`]: (a, b) => bool(a > b),
|
|
117
203
|
[`${TX}/LessThan`]: (a, b) => bool(a < b),
|
|
118
204
|
[`${TX}/GreaterThanOrEqual`]: (a, b) => bool(a >= b),
|
|
119
205
|
[`${TX}/LessThanOrEqual`]: (a, b) => bool(a <= b),
|
|
120
206
|
};
|
|
121
|
-
/**
|
|
207
|
+
/**
|
|
208
|
+
* Polymorphic value equality — the full `tx.Equals` ontology contract
|
|
209
|
+
* (v1 implemented its numeric half):
|
|
210
|
+
*
|
|
211
|
+
* - number/number, string/string: value equality.
|
|
212
|
+
* - ref/ref: canonical versionless URI-key equality — identity-by-name,
|
|
213
|
+
* the same rule as the ordered comparisons.
|
|
214
|
+
* - lists: never equal (a list is a container, not a comparable value).
|
|
215
|
+
* - any cross-kind pair: false. Never errors.
|
|
216
|
+
*/
|
|
217
|
+
function valuesEqual(a, b) {
|
|
218
|
+
if (typeof a === 'number' && typeof b === 'number')
|
|
219
|
+
return a === b;
|
|
220
|
+
if (typeof a === 'string' && typeof b === 'string')
|
|
221
|
+
return a === b;
|
|
222
|
+
if (typeof a === 'object' && typeof b === 'object' && !Array.isArray(a) && !Array.isArray(b)) {
|
|
223
|
+
return a.ref === b.ref;
|
|
224
|
+
}
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
/** Value of a literal node, or `undefined` if it is not a literal. In v2 the
|
|
228
|
+
* string and URI literals are kernel-known: `StringLiteral` yields its string,
|
|
229
|
+
* `UriLiteral` yields a ref value (its `refTo` IS its identity, the way an
|
|
230
|
+
* IntegerLiteral's number is its value). */
|
|
122
231
|
function literalValue(node) {
|
|
123
232
|
switch (node.type) {
|
|
124
233
|
case `${TX}/IntegerLiteral`: return Number(node.integerLiteral);
|
|
125
234
|
case `${TX}/DecimalLiteral`: return Number(node.decimalLiteral);
|
|
126
235
|
case `${TX}/BooleanLiteral`: return bool(node.booleanLiteral === true || node.booleanLiteral === 'true');
|
|
236
|
+
case `${TX}/StringLiteral`: {
|
|
237
|
+
const s = node.stringLiteral;
|
|
238
|
+
if (typeof s !== 'string')
|
|
239
|
+
throw new ExpressionError('StringLiteral is missing stringLiteral');
|
|
240
|
+
return s;
|
|
241
|
+
}
|
|
242
|
+
case `${TX}/UriLiteral`: {
|
|
243
|
+
const ref = node.refTo;
|
|
244
|
+
if (typeof ref !== 'string' || ref.length === 0) {
|
|
245
|
+
throw new ExpressionError('UriLiteral is missing refTo');
|
|
246
|
+
}
|
|
247
|
+
return { ref };
|
|
248
|
+
}
|
|
127
249
|
default: return undefined;
|
|
128
250
|
}
|
|
129
251
|
}
|
|
130
252
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
253
|
+
* Stringify one Join element. Numbers follow the ECMAScript number-to-string
|
|
254
|
+
* rule — the same serialization RFC 8785 (JCS) pins and the canonical layer
|
|
255
|
+
* already implements in every port, so Join output is deterministic across
|
|
256
|
+
* languages. Refs stringify to their LOCAL name (the reference-engine rule for
|
|
257
|
+
* display joins). A nested list is a computation type error — loud.
|
|
134
258
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
259
|
+
function joinElement(v) {
|
|
260
|
+
if (typeof v === 'string')
|
|
261
|
+
return v;
|
|
262
|
+
if (typeof v === 'number')
|
|
263
|
+
return String(v);
|
|
264
|
+
if (Array.isArray(v))
|
|
265
|
+
throw new ExpressionError('Join cannot stringify a nested list');
|
|
266
|
+
return v.ref.slice(v.ref.lastIndexOf('/') + 1);
|
|
267
|
+
}
|
|
268
|
+
/** `IsSet`: absence is the empty list; the empty string is also unset (the
|
|
269
|
+
* reference-engine rule). Everything else — including `0` — is set. */
|
|
270
|
+
function isSet(v) {
|
|
271
|
+
if (typeof v === 'string')
|
|
272
|
+
return v.length > 0;
|
|
273
|
+
if (Array.isArray(v))
|
|
274
|
+
return v.length > 0;
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
/** The `source`-operand fold table for the non-iterating list family. */
|
|
278
|
+
const LIST_FOLDS = {
|
|
279
|
+
[`${TX}/Count`]: (list) => list.length,
|
|
280
|
+
[`${TX}/Sum`]: (list) => {
|
|
281
|
+
let total = 0;
|
|
282
|
+
for (const el of list)
|
|
283
|
+
total += requireNumber(el, 'Sum');
|
|
284
|
+
return total;
|
|
285
|
+
},
|
|
286
|
+
[`${TX}/Min`]: (list) => {
|
|
287
|
+
if (list.length === 0)
|
|
288
|
+
throw new ExpressionError('Min on an empty list is undefined; guard with IsSet');
|
|
289
|
+
let best = requireNumber(list[0], 'Min');
|
|
290
|
+
for (let i = 1; i < list.length; i++) {
|
|
291
|
+
const n = requireNumber(list[i], 'Min');
|
|
292
|
+
if (n < best)
|
|
293
|
+
best = n;
|
|
294
|
+
}
|
|
295
|
+
return best;
|
|
296
|
+
},
|
|
297
|
+
[`${TX}/Max`]: (list) => {
|
|
298
|
+
if (list.length === 0)
|
|
299
|
+
throw new ExpressionError('Max on an empty list is undefined; guard with IsSet');
|
|
300
|
+
let best = requireNumber(list[0], 'Max');
|
|
301
|
+
for (let i = 1; i < list.length; i++) {
|
|
302
|
+
const n = requireNumber(list[i], 'Max');
|
|
303
|
+
if (n > best)
|
|
304
|
+
best = n;
|
|
305
|
+
}
|
|
306
|
+
return best;
|
|
307
|
+
},
|
|
308
|
+
[`${TX}/Average`]: (list) => {
|
|
309
|
+
if (list.length === 0)
|
|
310
|
+
throw new ExpressionError('Average on an empty list is undefined; guard with IsSet');
|
|
311
|
+
let total = 0;
|
|
312
|
+
for (const el of list)
|
|
313
|
+
total += requireNumber(el, 'Average');
|
|
314
|
+
return total / list.length;
|
|
315
|
+
},
|
|
316
|
+
[`${TX}/Join`]: (list, node) => {
|
|
317
|
+
const sep = typeof node.separator === 'string' ? node.separator : '';
|
|
318
|
+
return list.map(joinElement).join(sep);
|
|
319
|
+
},
|
|
320
|
+
[`${TX}/Reverse`]: (list) => [...list].reverse(),
|
|
321
|
+
};
|
|
322
|
+
// ---------------------------------------------------------------------------
|
|
323
|
+
// Matches — the pinned RE2-compatible XSD-regex subset.
|
|
324
|
+
// ---------------------------------------------------------------------------
|
|
325
|
+
/**
|
|
326
|
+
* Validate a `Matches` pattern against the pinned subset — the intersection of
|
|
327
|
+
* RE2 and the host regex engines, chosen so every port compiles the same
|
|
328
|
+
* pattern to the same language. RE2 is both the restrictive common denominator
|
|
329
|
+
* and ReDoS-safe (no catastrophic backtracking), which is a REQUIREMENT for a
|
|
330
|
+
* predicate that may gate on adversarial input. Out-of-subset constructs are a
|
|
331
|
+
* LOUD error, the same discipline as Round/Modulo; WIDENING the subset later
|
|
332
|
+
* (an error becoming a defined result) is additive within v2.
|
|
333
|
+
*
|
|
334
|
+
* COUNTING UNIT — pinned: `.` and quantifiers count Unicode CODE POINTS, in
|
|
335
|
+
* every port. An astral-plane character (a surrogate pair in UTF-16 hosts)
|
|
336
|
+
* is ONE `.`, and `.{3}` matches exactly three code points — matching RE2's
|
|
337
|
+
* rune model and Python's, and what SHACL/SPARQL string length means. The
|
|
338
|
+
* UTF-16 engines must opt in (this port compiles with the `u` flag; Java
|
|
339
|
+
* and C# ports normalize equivalently) — without the pin, `.{m,n}` counts
|
|
340
|
+
* different units across exactly these seven targets, and the length
|
|
341
|
+
* lowering (`(?s)^.{m,}$`) would judge astral input differently per
|
|
342
|
+
* language. The astral vectors gate this: a port that counts code units
|
|
343
|
+
* fails conformance, not the tenant.
|
|
344
|
+
*
|
|
345
|
+
* Allowed: literals; `.`; anchors `^` `$`; alternation `|`; groups `(...)`,
|
|
346
|
+
* `(?:...)`; a WHOLE-PATTERN flag prefix over `i`/`m`/`s` (`(?i)` at position
|
|
347
|
+
* 0 only — each port translates it to its host flag mechanism); quantifiers
|
|
348
|
+
* `*` `+` `?` `{m}` `{m,}` `{m,n}`; character classes with ranges and
|
|
349
|
+
* negation; escapes `\d \D \w \W \s \S \b \B \n \r \t \f \v \xHH`, escaped
|
|
350
|
+
* syntax punctuation (`\.` `\*` `\+` `\?` `\(` `\)` `\[` `\]` `\{` `\}`
|
|
351
|
+
* `\|` `\^` `\$` `\\` `\/`), and `\-` inside character classes.
|
|
352
|
+
*
|
|
353
|
+
* Rejected (divergent or unsafe across engines): lookahead/lookbehind, named
|
|
354
|
+
* groups, backreferences (`\1`…, `\k`), MID-pattern flag groups (`(?i:…)` —
|
|
355
|
+
* not portable to the JS and Python engines), `\p{…}`/`\P{…}` unicode
|
|
356
|
+
* property classes, POSIX classes (`[[:alpha:]]`), class intersection
|
|
357
|
+
* (`&&`), atomic groups, conditionals, comments, octal/`\u`/`\x{…}` escapes,
|
|
358
|
+
* escaped space (`\ `), `\-` outside a class, and a bare unescaped `{` that
|
|
359
|
+
* is not a quantifier (literal braces must be escaped — engines disagree on
|
|
360
|
+
* the lenient reading, so the subset requires the explicit form).
|
|
361
|
+
*/
|
|
362
|
+
export function validateMatchesPattern(pattern) {
|
|
363
|
+
const fail = (what) => {
|
|
364
|
+
throw new ExpressionError(`Matches pattern is outside the pinned regex subset (${what}): ${pattern}`);
|
|
365
|
+
};
|
|
366
|
+
// The u-legal intersection: character-class escapes, control escapes,
|
|
367
|
+
// \xHH, and escaped SYNTAX punctuation. `\-` is legal only INSIDE a class;
|
|
368
|
+
// `\ ` (escaped space) is not legal at all — both are Annex-B leniencies
|
|
369
|
+
// the code-point mode (and other engines) reject.
|
|
370
|
+
const ALLOWED_ESCAPES = new Set([
|
|
371
|
+
'd', 'D', 'w', 'W', 's', 'S', 'b', 'B', 'n', 'r', 't', 'f', 'v',
|
|
372
|
+
'.', '*', '+', '?', '(', ')', '[', ']', '{', '}', '|', '^', '$', '\\', '/',
|
|
373
|
+
]);
|
|
374
|
+
let inClass = false;
|
|
375
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
376
|
+
const c = pattern[i];
|
|
377
|
+
if (c === '\\') {
|
|
378
|
+
const e = pattern[i + 1];
|
|
379
|
+
if (e === undefined)
|
|
380
|
+
fail('trailing backslash');
|
|
381
|
+
if (e === 'x') {
|
|
382
|
+
// \xHH only — \x{…} (RE2 long form) is not portable to the JS engine.
|
|
383
|
+
const hex = pattern.slice(i + 2, i + 4);
|
|
384
|
+
if (!/^[0-9a-fA-F]{2}$/.test(hex))
|
|
385
|
+
fail('\\x escape must be \\xHH');
|
|
386
|
+
if (pattern[i + 2] === '{')
|
|
387
|
+
fail('\\x{…} escape');
|
|
388
|
+
i += 3;
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
391
|
+
if (e >= '0' && e <= '9')
|
|
392
|
+
fail(`backreference or octal escape \\${e}`);
|
|
393
|
+
if (e === 'p' || e === 'P')
|
|
394
|
+
fail(`unicode property class \\${e}{…}`);
|
|
395
|
+
if (e === 'k')
|
|
396
|
+
fail('named backreference \\k');
|
|
397
|
+
if (e === 'u')
|
|
398
|
+
fail('\\u escape');
|
|
399
|
+
if (e === '-') {
|
|
400
|
+
if (!inClass)
|
|
401
|
+
fail('\\- outside a character class');
|
|
402
|
+
i++;
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
if ((e === 'b' || e === 'B') && inClass) {
|
|
406
|
+
// In-class \b is backspace in JS but an error in RE2-family engines —
|
|
407
|
+
// reject the divergent reading; word boundaries are outside-class only.
|
|
408
|
+
fail(`\\${e} inside a character class`);
|
|
409
|
+
}
|
|
410
|
+
if ((e === 'D' || e === 'W' || e === 'S') && inClass) {
|
|
411
|
+
// A negated shorthand inside a class is inexpressible as a textual
|
|
412
|
+
// fragment under the pinned ASCII expansion — reject rather than
|
|
413
|
+
// inherit each engine's own reading.
|
|
414
|
+
fail(`\\${e} inside a character class`);
|
|
415
|
+
}
|
|
416
|
+
if (!ALLOWED_ESCAPES.has(e))
|
|
417
|
+
fail(`escape \\${e}`);
|
|
418
|
+
i++;
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
if (inClass) {
|
|
422
|
+
if (c === ']') {
|
|
423
|
+
inClass = false;
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
if (c === '&' && pattern[i + 1] === '&')
|
|
427
|
+
fail('character-class intersection &&');
|
|
428
|
+
if (c === '[' && pattern[i + 1] === ':')
|
|
429
|
+
fail('POSIX class [[:…:]]');
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
if (c === '[') {
|
|
433
|
+
inClass = true;
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
if (c === '(' && pattern[i + 1] === '?') {
|
|
437
|
+
// Only (?: survives mid-pattern; the flag prefix (?ims) is legal at
|
|
438
|
+
// position 0 ONLY (validated by splitFlagPrefix before this scanner).
|
|
439
|
+
if (pattern[i + 2] !== ':')
|
|
440
|
+
fail(`group construct (?${pattern[i + 2] ?? ''}`);
|
|
441
|
+
i += 2; // resume after '?:'
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
if (c === '{') {
|
|
445
|
+
// A bare `{` must start a valid quantifier — engines disagree on the
|
|
446
|
+
// lenient literal reading, so the SCANNER enforces the rule uniformly
|
|
447
|
+
// (a literal brace is written \{), not each host's compile behavior.
|
|
448
|
+
if (!/^\{\d+(,\d*)?\}/.test(pattern.slice(i))) {
|
|
449
|
+
fail("bare '{' that is not a quantifier (write \\{)");
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
if (inClass)
|
|
454
|
+
fail('unterminated character class');
|
|
455
|
+
}
|
|
456
|
+
/** Split the whole-pattern flag prefix — `(?i)`, `(?ims)` at position 0 —
|
|
457
|
+
* from the body. Each port translates the flags to its host mechanism (`i`
|
|
458
|
+
* case-fold, `m` multiline anchors, `s` dot-matches-newline). */
|
|
459
|
+
function splitFlagPrefix(pattern) {
|
|
460
|
+
const m = /^\(\?([ims]+)\)/.exec(pattern);
|
|
461
|
+
if (!m)
|
|
462
|
+
return { flags: '', body: pattern };
|
|
463
|
+
return { flags: m[1], body: pattern.slice(m[0].length) };
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* The pinned ASCII expansions of the shorthand classes — the dialect defines
|
|
467
|
+
* `\d` `\w` `\s` BY these expansions, and every port applies them textually
|
|
468
|
+
* before compiling, because the native shorthands diverge across exactly our
|
|
469
|
+
* targets (Rust/Python `\d` matches Arabic-Indic digits; JS `\s` matches
|
|
470
|
+
* NBSP; `\b` is Unicode in Rust/Python, ASCII in JS/RE2). Outside a class
|
|
471
|
+
* the shorthand becomes a bracketed class; inside a class it splices as a
|
|
472
|
+
* fragment. `\b`/`\B` stay as-written — ASCII word boundaries, native in
|
|
473
|
+
* this engine (Rust: `(?-u:\b)`; Python: `re.ASCII`).
|
|
474
|
+
*/
|
|
475
|
+
const CLASS_EXPANSION_OUT = {
|
|
476
|
+
d: '[0-9]', D: '[^0-9]',
|
|
477
|
+
w: '[0-9A-Za-z_]', W: '[^0-9A-Za-z_]',
|
|
478
|
+
s: '[ \\t\\n\\r\\f\\x0B]', S: '[^ \\t\\n\\r\\f\\x0B]',
|
|
479
|
+
};
|
|
480
|
+
const CLASS_EXPANSION_IN = {
|
|
481
|
+
d: '0-9',
|
|
482
|
+
w: '0-9A-Za-z_',
|
|
483
|
+
s: ' \\t\\n\\r\\f\\x0B',
|
|
484
|
+
};
|
|
485
|
+
/** Apply the pinned ASCII expansions (subset-validated input, so every `\X`
|
|
486
|
+
* is a known escape and class boundaries are well-formed). Also pins the
|
|
487
|
+
* non-dotAll `.`: the dialect defines it as "any code point except \n" (the
|
|
488
|
+
* RE2/Python/Go norm) — THIS engine natively excludes \r/U+2028/U+2029 as
|
|
489
|
+
* well, so a non-dotAll `.` translates to `[^\n]`. Under `s`, every engine's
|
|
490
|
+
* dotAll means "everything" and `.` passes through. */
|
|
491
|
+
function expandShorthandClasses(body, dotAll) {
|
|
492
|
+
let out = '';
|
|
493
|
+
let inClass = false;
|
|
494
|
+
for (let i = 0; i < body.length; i++) {
|
|
495
|
+
const c = body[i];
|
|
496
|
+
if (c === '\\') {
|
|
497
|
+
const e = body[i + 1];
|
|
498
|
+
const table = inClass ? CLASS_EXPANSION_IN : CLASS_EXPANSION_OUT;
|
|
499
|
+
const expansion = table[e];
|
|
500
|
+
if (expansion !== undefined) {
|
|
501
|
+
out += expansion;
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
out += c + e;
|
|
505
|
+
}
|
|
506
|
+
i++;
|
|
507
|
+
continue;
|
|
508
|
+
}
|
|
509
|
+
if (!inClass && c === '.' && !dotAll) {
|
|
510
|
+
out += '[^\\n]';
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
if (!inClass && c === '[')
|
|
514
|
+
inClass = true;
|
|
515
|
+
else if (inClass && c === ']')
|
|
516
|
+
inClass = false;
|
|
517
|
+
out += c;
|
|
518
|
+
}
|
|
519
|
+
return out;
|
|
520
|
+
}
|
|
521
|
+
/** Compile + test under fn:matches semantics: UNANCHORED (substring) — authors
|
|
522
|
+
* write `^…$` for a whole-string match. The flag prefix splits off first
|
|
523
|
+
* (translated to host RegExp flags), then the body is subset-validated, so
|
|
524
|
+
* the host engine only ever sees portable constructs. Always compiled with
|
|
525
|
+
* `u` — the pinned CODE-POINT counting unit (an astral character is one `.`;
|
|
526
|
+
* `.{m,n}` counts code points, matching RE2/Python and SHACL string length).
|
|
527
|
+
* `u` also rejects a bare literal `{`, turning an engine-divergent lenient
|
|
528
|
+
* reading into the subset's loud error. */
|
|
529
|
+
function matchesPattern(input, pattern) {
|
|
530
|
+
const { flags, body } = splitFlagPrefix(pattern);
|
|
531
|
+
validateMatchesPattern(body);
|
|
532
|
+
let re;
|
|
533
|
+
try {
|
|
534
|
+
re = new RegExp(expandShorthandClasses(body, flags.includes('s')), flags + 'u');
|
|
535
|
+
}
|
|
536
|
+
catch {
|
|
537
|
+
throw new ExpressionError(`Matches pattern does not compile: ${pattern}`);
|
|
538
|
+
}
|
|
539
|
+
return re.test(input);
|
|
540
|
+
}
|
|
541
|
+
// ---------------------------------------------------------------------------
|
|
542
|
+
// Ordered comparisons (unchanged from v1).
|
|
543
|
+
// ---------------------------------------------------------------------------
|
|
544
|
+
/**
|
|
545
|
+
* The identity an ordered comparison compares — a member's canonical
|
|
546
|
+
* versionless URI. `tx.UriLiteral` is the kernel-known constant leaf (its
|
|
547
|
+
* `refTo` IS the identity, the way a literal's value is its number); every
|
|
548
|
+
* other node is the caller's, through `resolveRef` — the same division as the
|
|
549
|
+
* numeric domain's literals-vs-`resolve`.
|
|
550
|
+
*/
|
|
551
|
+
function identityOf(node, ctx, options) {
|
|
552
|
+
if (node.type === `${TX}/UriLiteral`) {
|
|
553
|
+
const ref = node.refTo;
|
|
554
|
+
if (typeof ref !== 'string' || ref.length === 0) {
|
|
555
|
+
throw new ExpressionError('UriLiteral is missing refTo');
|
|
556
|
+
}
|
|
557
|
+
return ref;
|
|
558
|
+
}
|
|
559
|
+
if (!options?.resolveRef) {
|
|
560
|
+
throw new ExpressionError(`No resolveRef supplied for identity leaf '${node.type}'`);
|
|
561
|
+
}
|
|
562
|
+
return options.resolveRef(node, ctx);
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Fold an ordered comparison (`IsAtLeast` / `Dominates`) to `1`/`0`.
|
|
566
|
+
*
|
|
567
|
+
* The ordering is the supplied closure for the node's `viaProperty` —
|
|
568
|
+
* membership in already-closed data, nothing more. Identity is canonical
|
|
569
|
+
* versionless URI string equality, matching `tx.Equals`' identity rule.
|
|
570
|
+
* `IsAtLeast` folds reflexivity into the operator (same member → 1) so a
|
|
571
|
+
* strictly-ordered vocabulary need not declare itself reflexive; `Dominates`
|
|
572
|
+
* is strict (same member → 0). Two members with no path yield 0 — the
|
|
573
|
+
* fail-closed direction for a predicate — but a MISSING closure table is a
|
|
574
|
+
* configuration failure and errors loudly.
|
|
575
|
+
*/
|
|
576
|
+
function foldOrdered(node, ctx, options) {
|
|
577
|
+
const via = node.viaProperty;
|
|
578
|
+
if (typeof via !== 'string' || via.length === 0) {
|
|
579
|
+
throw new ExpressionError(`${node.type} is missing viaProperty`);
|
|
580
|
+
}
|
|
581
|
+
const left = identityOf(operand(node, 'compareLeft'), ctx, options);
|
|
582
|
+
const right = identityOf(operand(node, 'compareRight'), ctx, options);
|
|
583
|
+
const closure = options?.closures?.[via];
|
|
584
|
+
if (!closure) {
|
|
585
|
+
throw new ExpressionError(`No closure supplied for ordering property '${via}'`);
|
|
586
|
+
}
|
|
587
|
+
const value = left === right
|
|
588
|
+
? bool(node.type === `${TX}/IsAtLeast`)
|
|
589
|
+
: bool((closure[left] ?? []).includes(right));
|
|
590
|
+
return { value, left, right };
|
|
591
|
+
}
|
|
592
|
+
/** Innermost-wins lookup of a lambda-bound variable. */
|
|
593
|
+
function boundValue(frames, name) {
|
|
594
|
+
for (let i = frames.length - 1; i >= 0; i--) {
|
|
595
|
+
if (frames[i].name === name)
|
|
596
|
+
return frames[i].value;
|
|
597
|
+
}
|
|
598
|
+
return undefined;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Evaluate an expression tree to a value. Operators fold via the frozen
|
|
602
|
+
* dispatch + primitive tables; literals yield their value; any other node is
|
|
603
|
+
* delegated to `resolve`. `options` carries the ordered-comparison context
|
|
604
|
+
* (closures + identity-leaf resolution) and is only consulted when an
|
|
605
|
+
* `IsAtLeast` / `Dominates` node is reached.
|
|
606
|
+
*/
|
|
607
|
+
export function evaluate(node, ctx, resolve, options) {
|
|
608
|
+
return evalNode(node, ctx, resolve, options, []);
|
|
609
|
+
}
|
|
610
|
+
/** `source` operand evaluated as a list: a scalar promotes to a one-element
|
|
611
|
+
* list (the reference-engine rule); an empty list is absence. */
|
|
612
|
+
function evalSourceList(node, ctx, resolve, options, frames) {
|
|
613
|
+
const v = evalNode(operand(node, 'source'), ctx, resolve, options, frames);
|
|
614
|
+
return Array.isArray(v) ? v : [v];
|
|
615
|
+
}
|
|
616
|
+
function evalNode(node, ctx, resolve, options, frames) {
|
|
617
|
+
const recurse = (n, c) => evalNode(n, c, resolve, options, frames);
|
|
618
|
+
const recurseNumber = (n, c, op) => requireNumber(recurse(n, c), op);
|
|
137
619
|
const arity = OPERATOR_ARITY[node.type];
|
|
138
620
|
if (arity) {
|
|
139
621
|
switch (arity.kind) {
|
|
140
622
|
case 'unary': {
|
|
141
|
-
const x =
|
|
623
|
+
const x = recurseNumber(operand(node, arity.operand), ctx, node.type);
|
|
142
624
|
return UNARY[node.type](x);
|
|
143
625
|
}
|
|
144
626
|
case 'binary': {
|
|
145
627
|
const a = recurse(operand(node, arity.left), ctx);
|
|
146
628
|
const b = recurse(operand(node, arity.right), ctx);
|
|
147
|
-
|
|
629
|
+
if (node.type === `${TX}/Equals`)
|
|
630
|
+
return bool(valuesEqual(a, b));
|
|
631
|
+
const order = BINARY_ORDER[node.type];
|
|
632
|
+
if (order) {
|
|
633
|
+
// Predicate: non-numeric operands fail CLOSED.
|
|
634
|
+
if (typeof a !== 'number' || typeof b !== 'number')
|
|
635
|
+
return 0;
|
|
636
|
+
return order(a, b);
|
|
637
|
+
}
|
|
638
|
+
// Arithmetic: computation — fail LOUD on non-numbers.
|
|
639
|
+
return BINARY_ARITH[node.type](requireNumber(a, node.type), requireNumber(b, node.type));
|
|
148
640
|
}
|
|
149
641
|
case 'nary': {
|
|
150
642
|
const items = node[arity.operands];
|
|
@@ -153,7 +645,7 @@ export function evaluate(node, ctx, resolve) {
|
|
|
153
645
|
const isAnd = node.type === `${TX}/And`;
|
|
154
646
|
// Short-circuit; empty And is vacuously true, empty Or vacuously false.
|
|
155
647
|
for (const item of items) {
|
|
156
|
-
const v = truthy(recurse(item, ctx));
|
|
648
|
+
const v = truthy(requireNumber(recurse(item, ctx), node.type));
|
|
157
649
|
if (isAnd && !v)
|
|
158
650
|
return 0;
|
|
159
651
|
if (!isAnd && v)
|
|
@@ -163,27 +655,280 @@ export function evaluate(node, ctx, resolve) {
|
|
|
163
655
|
}
|
|
164
656
|
case 'ternary': {
|
|
165
657
|
// Only Clip today: clamp clipValue into [clipLower, clipUpper].
|
|
166
|
-
const v =
|
|
167
|
-
const lo =
|
|
168
|
-
const hi =
|
|
658
|
+
const v = recurseNumber(operand(node, arity.a), ctx, node.type);
|
|
659
|
+
const lo = recurseNumber(operand(node, arity.b), ctx, node.type);
|
|
660
|
+
const hi = recurseNumber(operand(node, arity.c), ctx, node.type);
|
|
169
661
|
return Math.min(Math.max(v, lo), hi);
|
|
170
662
|
}
|
|
171
663
|
}
|
|
172
664
|
}
|
|
173
665
|
if (node.type === `${TX}/Not`) {
|
|
174
|
-
return bool(!truthy(recurse(operand(node, 'operand'), ctx)));
|
|
666
|
+
return bool(!truthy(requireNumber(recurse(operand(node, 'operand'), ctx), node.type)));
|
|
667
|
+
}
|
|
668
|
+
if (node.type === `${TX}/IsAtLeast` || node.type === `${TX}/Dominates`) {
|
|
669
|
+
return foldOrdered(node, ctx, options).value;
|
|
670
|
+
}
|
|
671
|
+
const listFold = LIST_FOLDS[node.type];
|
|
672
|
+
if (listFold) {
|
|
673
|
+
return listFold(evalSourceList(node, ctx, resolve, options, frames), node);
|
|
674
|
+
}
|
|
675
|
+
const body = ITERATOR_BODY[node.type];
|
|
676
|
+
if (body) {
|
|
677
|
+
const loopVar = node.loopVar;
|
|
678
|
+
if (typeof loopVar !== 'string' || loopVar.length === 0) {
|
|
679
|
+
throw new ExpressionError(`${node.type} is missing loopVar`);
|
|
680
|
+
}
|
|
681
|
+
const list = evalSourceList(node, ctx, resolve, options, frames);
|
|
682
|
+
const bodyNode = operand(node, body);
|
|
683
|
+
const out = [];
|
|
684
|
+
for (const el of list) {
|
|
685
|
+
const inner = [...frames, { name: loopVar, value: el }];
|
|
686
|
+
const v = evalNode(bodyNode, ctx, resolve, options, inner);
|
|
687
|
+
if (node.type === `${TX}/Filter`) {
|
|
688
|
+
if (truthy(requireNumber(v, 'Filter predicate')))
|
|
689
|
+
out.push(el);
|
|
690
|
+
}
|
|
691
|
+
else if (node.type === `${TX}/ForEach`) {
|
|
692
|
+
// Flatten one level; an empty list contributes nothing — which is
|
|
693
|
+
// exactly the absence rule doing the reference engine's skip.
|
|
694
|
+
if (Array.isArray(v))
|
|
695
|
+
out.push(...v);
|
|
696
|
+
else
|
|
697
|
+
out.push(v);
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
out.push(v);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return out;
|
|
704
|
+
}
|
|
705
|
+
if (node.type === `${TX}/Contains`) {
|
|
706
|
+
const haystack = evalNode(operand(node, 'haystack'), ctx, resolve, options, frames);
|
|
707
|
+
const needle = evalNode(operand(node, 'needle'), ctx, resolve, options, frames);
|
|
708
|
+
const list = Array.isArray(haystack) ? haystack : [haystack];
|
|
709
|
+
return bool(list.some((el) => valuesEqual(el, needle)));
|
|
710
|
+
}
|
|
711
|
+
if (node.type === `${TX}/IsSet`) {
|
|
712
|
+
return bool(isSet(evalNode(operand(node, 'checkExpr'), ctx, resolve, options, frames)));
|
|
713
|
+
}
|
|
714
|
+
if (node.type === `${TX}/ListItemAt`) {
|
|
715
|
+
const list = evalSourceList(node, ctx, resolve, options, frames);
|
|
716
|
+
const idx = evalNode(operand(node, 'itemIndex'), ctx, resolve, options, frames);
|
|
717
|
+
if (typeof idx !== 'number' || !Number.isInteger(idx) || idx < 0) {
|
|
718
|
+
throw new ExpressionError('ListItemAt itemIndex must be a non-negative integer');
|
|
719
|
+
}
|
|
720
|
+
// Past the end is ABSENCE, not an error — the empty list; guard with IsSet.
|
|
721
|
+
return idx < list.length ? list[idx] : [];
|
|
722
|
+
}
|
|
723
|
+
if (node.type === `${TX}/Matches`) {
|
|
724
|
+
const src = evalNode(operand(node, 'matchSource'), ctx, resolve, options, frames);
|
|
725
|
+
if (typeof src !== 'string') {
|
|
726
|
+
throw new ExpressionError(`Matches requires a string matchSource, got ${kindOf(src)}`);
|
|
727
|
+
}
|
|
728
|
+
const pattern = node.pattern;
|
|
729
|
+
if (typeof pattern !== 'string')
|
|
730
|
+
throw new ExpressionError('Matches is missing pattern');
|
|
731
|
+
return bool(matchesPattern(src, pattern));
|
|
732
|
+
}
|
|
733
|
+
const kind = KIND_PREDICATES[node.type];
|
|
734
|
+
if (kind) {
|
|
735
|
+
return bool(kind(evalNode(operand(node, 'kindCheck'), ctx, resolve, options, frames)));
|
|
175
736
|
}
|
|
176
737
|
const lit = literalValue(node);
|
|
177
738
|
if (lit !== undefined)
|
|
178
739
|
return lit;
|
|
179
|
-
//
|
|
180
|
-
|
|
740
|
+
// A VarRef naming a lexically-enclosing loopVar is the kernel's own bound
|
|
741
|
+
// variable — the ONLY leaf the kernel answers (see the header). Any other
|
|
742
|
+
// VarRef, and every other leaf, is the caller's.
|
|
743
|
+
if (node.type === `${TX}/VarRef` && typeof node.varName === 'string') {
|
|
744
|
+
const bound = boundValue(frames, node.varName);
|
|
745
|
+
if (bound !== undefined)
|
|
746
|
+
return bound;
|
|
747
|
+
}
|
|
748
|
+
// Not an operator or literal — a binding, graph read, or domain leaf. The
|
|
749
|
+
// caller owns it. (Recursion from inside `resolve` re-enters WITHOUT lambda
|
|
750
|
+
// frames: the caller's subtrees are the caller's scope.)
|
|
751
|
+
return resolve(node, ctx, (n, c) => evalNode(n, c, resolve, options, []));
|
|
181
752
|
}
|
|
182
753
|
function operand(node, key) {
|
|
183
754
|
const v = node[key];
|
|
184
|
-
if (v === null || v === undefined || typeof v !== 'object') {
|
|
755
|
+
if (v === null || v === undefined || typeof v !== 'object' || Array.isArray(v)) {
|
|
185
756
|
throw new ExpressionError(`${node.type} is missing operand '${key}'`);
|
|
186
757
|
}
|
|
187
758
|
return v;
|
|
188
759
|
}
|
|
760
|
+
/**
|
|
761
|
+
* Evaluate an expression tree and return the verdict tree — the regex-debugger
|
|
762
|
+
* view: every evaluated node, its own result, and (for ordered comparisons)
|
|
763
|
+
* the identities it compared. The root's `value` is exactly what
|
|
764
|
+
* {@link evaluate} returns for the same inputs; the conformance suite runs
|
|
765
|
+
* every vector through both and requires agreement, so the two entry points
|
|
766
|
+
* cannot drift. Kept separate from `evaluate` so the hot path never pays for
|
|
767
|
+
* trace allocation.
|
|
768
|
+
*
|
|
769
|
+
* Errors propagate exactly as in `evaluate` — a failed evaluation yields an
|
|
770
|
+
* error, not a partial trace.
|
|
771
|
+
*/
|
|
772
|
+
export function explain(node, ctx, resolve, options) {
|
|
773
|
+
// Value recursion for subtrees the caller's `resolve` re-enters: those
|
|
774
|
+
// folds happen inside the caller and are invisible to the trace, exactly
|
|
775
|
+
// like the caller's own computation. Only kernel-visited nodes appear.
|
|
776
|
+
const recurseValue = (n, c) => evalNode(n, c, resolve, options, []);
|
|
777
|
+
const trace = (n, c, frames) => {
|
|
778
|
+
const leaf = (value) => ({ type: n.type, value, children: [] });
|
|
779
|
+
const arity = OPERATOR_ARITY[n.type];
|
|
780
|
+
if (arity) {
|
|
781
|
+
switch (arity.kind) {
|
|
782
|
+
case 'unary': {
|
|
783
|
+
const x = trace(operand(n, arity.operand), c, frames);
|
|
784
|
+
return { type: n.type, value: UNARY[n.type](requireNumber(x.value, n.type)), children: [x] };
|
|
785
|
+
}
|
|
786
|
+
case 'binary': {
|
|
787
|
+
const a = trace(operand(n, arity.left), c, frames);
|
|
788
|
+
const b = trace(operand(n, arity.right), c, frames);
|
|
789
|
+
let value;
|
|
790
|
+
if (n.type === `${TX}/Equals`) {
|
|
791
|
+
value = bool(valuesEqual(a.value, b.value));
|
|
792
|
+
}
|
|
793
|
+
else {
|
|
794
|
+
const order = BINARY_ORDER[n.type];
|
|
795
|
+
if (order) {
|
|
796
|
+
value = typeof a.value !== 'number' || typeof b.value !== 'number'
|
|
797
|
+
? 0
|
|
798
|
+
: order(a.value, b.value);
|
|
799
|
+
}
|
|
800
|
+
else {
|
|
801
|
+
value = BINARY_ARITH[n.type](requireNumber(a.value, n.type), requireNumber(b.value, n.type));
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
return { type: n.type, value, children: [a, b] };
|
|
805
|
+
}
|
|
806
|
+
case 'nary': {
|
|
807
|
+
const items = n[arity.operands];
|
|
808
|
+
if (!Array.isArray(items))
|
|
809
|
+
throw new ExpressionError(`${n.type} expects an '${arity.operands}' list`);
|
|
810
|
+
const isAnd = n.type === `${TX}/And`;
|
|
811
|
+
const children = [];
|
|
812
|
+
for (const item of items) {
|
|
813
|
+
const child = trace(item, c, frames);
|
|
814
|
+
children.push(child);
|
|
815
|
+
const v = truthy(requireNumber(child.value, n.type));
|
|
816
|
+
// Same short-circuit as `evaluate`: operands after the deciding
|
|
817
|
+
// one are never evaluated and never appear in the trace.
|
|
818
|
+
if (isAnd && !v)
|
|
819
|
+
return { type: n.type, value: 0, children };
|
|
820
|
+
if (!isAnd && v)
|
|
821
|
+
return { type: n.type, value: 1, children };
|
|
822
|
+
}
|
|
823
|
+
return { type: n.type, value: bool(isAnd), children };
|
|
824
|
+
}
|
|
825
|
+
case 'ternary': {
|
|
826
|
+
const v = trace(operand(n, arity.a), c, frames);
|
|
827
|
+
const lo = trace(operand(n, arity.b), c, frames);
|
|
828
|
+
const hi = trace(operand(n, arity.c), c, frames);
|
|
829
|
+
return {
|
|
830
|
+
type: n.type,
|
|
831
|
+
value: Math.min(Math.max(requireNumber(v.value, n.type), requireNumber(lo.value, n.type)), requireNumber(hi.value, n.type)),
|
|
832
|
+
children: [v, lo, hi],
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
if (n.type === `${TX}/Not`) {
|
|
838
|
+
const x = trace(operand(n, 'operand'), c, frames);
|
|
839
|
+
return { type: n.type, value: bool(!truthy(requireNumber(x.value, n.type))), children: [x] };
|
|
840
|
+
}
|
|
841
|
+
if (n.type === `${TX}/IsAtLeast` || n.type === `${TX}/Dominates`) {
|
|
842
|
+
const r = foldOrdered(n, c, options);
|
|
843
|
+
return { type: n.type, value: r.value, children: [], leftRef: r.left, rightRef: r.right };
|
|
844
|
+
}
|
|
845
|
+
const listFold = LIST_FOLDS[n.type];
|
|
846
|
+
if (listFold) {
|
|
847
|
+
const src = trace(operand(n, 'source'), c, frames);
|
|
848
|
+
const list = Array.isArray(src.value) ? src.value : [src.value];
|
|
849
|
+
return { type: n.type, value: listFold(list, n), children: [src] };
|
|
850
|
+
}
|
|
851
|
+
const body = ITERATOR_BODY[n.type];
|
|
852
|
+
if (body) {
|
|
853
|
+
const loopVar = n.loopVar;
|
|
854
|
+
if (typeof loopVar !== 'string' || loopVar.length === 0) {
|
|
855
|
+
throw new ExpressionError(`${n.type} is missing loopVar`);
|
|
856
|
+
}
|
|
857
|
+
const src = trace(operand(n, 'source'), c, frames);
|
|
858
|
+
const list = Array.isArray(src.value) ? src.value : [src.value];
|
|
859
|
+
const bodyNode = operand(n, body);
|
|
860
|
+
const children = [src];
|
|
861
|
+
const out = [];
|
|
862
|
+
for (const el of list) {
|
|
863
|
+
const inner = [...frames, { name: loopVar, value: el }];
|
|
864
|
+
const bodyTrace = trace(bodyNode, c, inner);
|
|
865
|
+
children.push(bodyTrace);
|
|
866
|
+
const v = bodyTrace.value;
|
|
867
|
+
if (n.type === `${TX}/Filter`) {
|
|
868
|
+
if (truthy(requireNumber(v, 'Filter predicate')))
|
|
869
|
+
out.push(el);
|
|
870
|
+
}
|
|
871
|
+
else if (n.type === `${TX}/ForEach`) {
|
|
872
|
+
if (Array.isArray(v))
|
|
873
|
+
out.push(...v);
|
|
874
|
+
else
|
|
875
|
+
out.push(v);
|
|
876
|
+
}
|
|
877
|
+
else {
|
|
878
|
+
out.push(v);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
return { type: n.type, value: out, children };
|
|
882
|
+
}
|
|
883
|
+
if (n.type === `${TX}/Contains`) {
|
|
884
|
+
const hay = trace(operand(n, 'haystack'), c, frames);
|
|
885
|
+
const needle = trace(operand(n, 'needle'), c, frames);
|
|
886
|
+
const list = Array.isArray(hay.value) ? hay.value : [hay.value];
|
|
887
|
+
return {
|
|
888
|
+
type: n.type,
|
|
889
|
+
value: bool(list.some((el) => valuesEqual(el, needle.value))),
|
|
890
|
+
children: [hay, needle],
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
if (n.type === `${TX}/IsSet`) {
|
|
894
|
+
const x = trace(operand(n, 'checkExpr'), c, frames);
|
|
895
|
+
return { type: n.type, value: bool(isSet(x.value)), children: [x] };
|
|
896
|
+
}
|
|
897
|
+
if (n.type === `${TX}/ListItemAt`) {
|
|
898
|
+
const src = trace(operand(n, 'source'), c, frames);
|
|
899
|
+
const idx = trace(operand(n, 'itemIndex'), c, frames);
|
|
900
|
+
const list = Array.isArray(src.value) ? src.value : [src.value];
|
|
901
|
+
if (typeof idx.value !== 'number' || !Number.isInteger(idx.value) || idx.value < 0) {
|
|
902
|
+
throw new ExpressionError('ListItemAt itemIndex must be a non-negative integer');
|
|
903
|
+
}
|
|
904
|
+
const value = idx.value < list.length ? list[idx.value] : [];
|
|
905
|
+
return { type: n.type, value, children: [src, idx] };
|
|
906
|
+
}
|
|
907
|
+
if (n.type === `${TX}/Matches`) {
|
|
908
|
+
const src = trace(operand(n, 'matchSource'), c, frames);
|
|
909
|
+
if (typeof src.value !== 'string') {
|
|
910
|
+
throw new ExpressionError(`Matches requires a string matchSource, got ${kindOf(src.value)}`);
|
|
911
|
+
}
|
|
912
|
+
const pattern = n.pattern;
|
|
913
|
+
if (typeof pattern !== 'string')
|
|
914
|
+
throw new ExpressionError('Matches is missing pattern');
|
|
915
|
+
return { type: n.type, value: bool(matchesPattern(src.value, pattern)), children: [src] };
|
|
916
|
+
}
|
|
917
|
+
const kind = KIND_PREDICATES[n.type];
|
|
918
|
+
if (kind) {
|
|
919
|
+
const x = trace(operand(n, 'kindCheck'), c, frames);
|
|
920
|
+
return { type: n.type, value: bool(kind(x.value)), children: [x] };
|
|
921
|
+
}
|
|
922
|
+
const lit = literalValue(n);
|
|
923
|
+
if (lit !== undefined)
|
|
924
|
+
return leaf(lit);
|
|
925
|
+
if (n.type === `${TX}/VarRef` && typeof n.varName === 'string') {
|
|
926
|
+
const bound = boundValue(frames, n.varName);
|
|
927
|
+
if (bound !== undefined)
|
|
928
|
+
return leaf(bound);
|
|
929
|
+
}
|
|
930
|
+
return leaf(resolve(n, c, recurseValue));
|
|
931
|
+
};
|
|
932
|
+
return trace(node, ctx, []);
|
|
933
|
+
}
|
|
189
934
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C,MAAM,EAAE,GAAG,6BAA6B,CAAC;AACzC,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAkBhC,MAAM,OAAO,eAAgB,SAAQ,KAAK;CAAG;AAS7C,MAAM,EAAE,GAAG,CAAC,OAAe,EAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACpE,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,KAAa,EAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QA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AO,CAAC,CAAC;YAC5C,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanonak-protocol/expression",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "The Kanonak expression runtime (expressionRuntimeVersion \"
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "The Kanonak expression runtime (expressionRuntimeVersion \"2\") — a deterministic tree-walker that folds a kanonak.org/transformations + kanonak.org/math expression to a value (number | string | ref | list), verified against the shared parity vectors. The behavior every generated SDK evaluates through.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://kanonak.org",
|
|
7
7
|
"author": "Kanonak Maintainers (https://github.com/kanonak-protocol/runtime)",
|