parseman 0.48.1 → 0.49.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/cli/index.js +2 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/compiler/ir-serialize.d.ts.map +1 -1
- package/dist/compiler/linker.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/language-service/index.js.map +1 -1
- package/dist/plugin/direct-builder-static.d.ts +20 -0
- package/dist/plugin/direct-builder-static.d.ts.map +1 -1
- package/dist/plugin/evaluator.d.ts +13 -0
- package/dist/plugin/evaluator.d.ts.map +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +207 -20
- package/dist/plugin/index.js.map +2 -2
- package/dist/spec/index.js +2 -1
- package/dist/spec/index.js.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/compiler/ir-serialize.ts +15 -3
- package/src/compiler/linker.ts +14 -1
- package/src/plugin/direct-builder-static.ts +116 -12
- package/src/plugin/evaluator.ts +50 -2
- package/src/plugin/index.ts +140 -1
- package/src/types.ts +1 -1
- package/src/version.ts +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -152,7 +152,12 @@ export type ParserDef = {
|
|
|
152
152
|
buildSigSrc?: string; /** Declared positional arity of `build`: author-declared via `node(..., { buildArity })`, or resolved from the reducer's declaration. Wins over source inspection. */
|
|
153
153
|
buildArity?: number; /** Why arity could not be resolved, for the diagnostic. */
|
|
154
154
|
buildArityUnresolved?: string;
|
|
155
|
-
buildStaticError?: readonly string[];
|
|
155
|
+
buildStaticError?: readonly string[]; /** Import provenance for a direct builder's free names — each `{ local, source, imported }` lets a downstream compose() re-emit `import { imported as local } from source` so the inlined builder source can bind. Carried through the IR round-trip. */
|
|
156
|
+
buildImports?: ReadonlyArray<{
|
|
157
|
+
local: string;
|
|
158
|
+
source: string;
|
|
159
|
+
imported: string;
|
|
160
|
+
}>;
|
|
156
161
|
unwrap?: boolean;
|
|
157
162
|
collapse?: boolean;
|
|
158
163
|
project?: number;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IACvB,EAAE,EAAE,IAAI,CAAA;IACR,KAAK,EAAE,CAAC,CAAA;IACR,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,CAAC,EAAE,IAAI,EAAE,CAAA;IACf,oHAAoH;IACpH,MAAM,CAAC,EAAE,UAAU,EAAE,CAAA;IACrB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,KAAK,CAAA;IACT,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,IAAI,EAAE,IAAI,CAAA;IACV;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;AAMnD,MAAM,MAAM,SAAS,GACjB;IAAE,GAAG,EAAE,SAAS,CAAC;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,OAAO,CAAA;CAAE,GAC7D;IAAE,GAAG,EAAE,OAAO,CAAC;IAAK,MAAM,EAAE,MAAM,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
13
13
|
* Kept in sync with `package.json` by `test/unit/version-sync.test.ts`, which fails
|
|
14
14
|
* the build if this constant drifts from the published version.
|
|
15
15
|
*/
|
|
16
|
-
export declare const PARSEMAN_VERSION = "0.
|
|
16
|
+
export declare const PARSEMAN_VERSION = "0.49.0";
|
|
17
17
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -179,8 +179,12 @@ export function evalRuleMapIR(ir: string): Array<[string, Comb]> {
|
|
|
179
179
|
;(l._def as { fnSrc?: string }).fnSrc = src
|
|
180
180
|
return l as Comb
|
|
181
181
|
}
|
|
182
|
-
const _nd = (type: string, child: Comb, src: string, opts?: unknown, staticError?: readonly string[], sigSrc?: string): Comb => {
|
|
182
|
+
const _nd = (type: string, child: Comb, src: string, opts?: unknown, staticError?: readonly string[], sigSrc?: string, buildImports?: ReadonlyArray<{ local: string; source: string; imported: string }>): Comb => {
|
|
183
183
|
if (staticError !== undefined && staticError.length > 0) {
|
|
184
|
+
// Fail closed: a builder with an un-rescuable binding is NOT fused. The
|
|
185
|
+
// plugin catches this and leaves the runtime compose() in place rather than
|
|
186
|
+
// shipping a fused table that would ReferenceError on import. Import-rescued
|
|
187
|
+
// free names never reach here — they ride in `buildImports`, not `staticError`.
|
|
184
188
|
throw new Error(`IR direct node builder for ${type} must be macro-static and self-contained; unsupported binding(s): ${staticError.join(', ')}`)
|
|
185
189
|
}
|
|
186
190
|
// A serialized direct builder needs an inert sentinel as well as buildSrc.
|
|
@@ -196,6 +200,10 @@ export function evalRuleMapIR(ir: string): Array<[string, Comb]> {
|
|
|
196
200
|
// re-lowered composed artifact silently re-acquires the fail-open capture cost the
|
|
197
201
|
// authoring module had already resolved away.
|
|
198
202
|
if (sigSrc !== undefined) (n._def as { buildSigSrc?: string }).buildSigSrc = sigSrc
|
|
203
|
+
// Re-attach the direct-builder import provenance so the plugin's re-lower pass
|
|
204
|
+
// can re-emit the imports into the consuming module. Plain data — this runtime
|
|
205
|
+
// module never resolves or emits imports itself.
|
|
206
|
+
if (buildImports !== undefined) (n._def as { buildImports?: ReadonlyArray<{ local: string; source: string; imported: string }> }).buildImports = buildImports
|
|
199
207
|
return n as Comb
|
|
200
208
|
}
|
|
201
209
|
// `_gch` rebuilds a GATED choice AND restores its `_def.gateSrcs` (parallel to the
|
|
@@ -569,11 +577,15 @@ class Serializer {
|
|
|
569
577
|
// Trailing optionals, emitted only when present so an artifact that carries
|
|
570
578
|
// neither is byte-identical to what previous versions produced.
|
|
571
579
|
const tail: string[] = []
|
|
572
|
-
|
|
580
|
+
// Positional args to `_nd`: (…, staticError, sigSrc, buildImports). A later
|
|
581
|
+
// arg being present forces the earlier ones to be emitted (as `undefined`)
|
|
582
|
+
// so the positions line up.
|
|
583
|
+
if (def.buildStaticError !== undefined || def.buildSigSrc !== undefined || def.buildImports !== undefined) {
|
|
573
584
|
if (!opts) tail.push('undefined')
|
|
574
585
|
tail.push(def.buildStaticError === undefined ? 'undefined' : JSON.stringify(def.buildStaticError))
|
|
575
586
|
}
|
|
576
|
-
if (def.buildSigSrc !== undefined) tail.push(JSON.stringify(def.buildSigSrc))
|
|
587
|
+
if (def.buildSigSrc !== undefined || def.buildImports !== undefined) tail.push(def.buildSigSrc === undefined ? 'undefined' : JSON.stringify(def.buildSigSrc))
|
|
588
|
+
if (def.buildImports !== undefined) tail.push(JSON.stringify(def.buildImports))
|
|
577
589
|
const trailing = tail.length > 0 ? `, ${tail.join(', ')}` : ''
|
|
578
590
|
return `_nd(${JSON.stringify(def.type)}, ${kid(def.parser)}, ${JSON.stringify(def.buildSrc)}${opts}${trailing})`
|
|
579
591
|
}
|
package/src/compiler/linker.ts
CHANGED
|
@@ -281,8 +281,21 @@ function materializeDirectBuilders(ruleMap: ReadonlyArray<readonly [string, Comb
|
|
|
281
281
|
const visit = (p: Combinator<unknown>): void => {
|
|
282
282
|
if (seen.has(p)) return
|
|
283
283
|
seen.add(p)
|
|
284
|
-
const d = p._def as { tag: string; build?: unknown; buildSrc?: string }
|
|
284
|
+
const d = p._def as { tag: string; type?: string; build?: unknown; buildSrc?: string; buildImports?: ReadonlyArray<{ local: string; source: string; imported: string }> }
|
|
285
285
|
if (d.tag === 'node' && typeof d.buildSrc === 'string') {
|
|
286
|
+
// FAIL CLOSED for the runtime fuse: a builder whose free names are module
|
|
287
|
+
// imports can be re-bound by the MACRO plugin (it re-emits the imports into the
|
|
288
|
+
// generated module), but an in-process `(0, eval)` here has no import to give it,
|
|
289
|
+
// so the builder would throw ReferenceError at parse time — wrong output deferred.
|
|
290
|
+
// Refuse now, with a message that points at the build-time path. The macro never
|
|
291
|
+
// reaches this function (it prints `buildSrc`, see the doc above).
|
|
292
|
+
if (d.buildImports !== undefined && d.buildImports.length > 0) {
|
|
293
|
+
throw new Error(
|
|
294
|
+
`IR direct node builder for ${d.type ?? '<anonymous>'} references module import(s) `
|
|
295
|
+
+ `${d.buildImports.map(bi => bi.local).join(', ')} that a runtime compose() cannot supply; `
|
|
296
|
+
+ `compose at build time via the parseman macro plugin, which re-emits the imports.`,
|
|
297
|
+
)
|
|
298
|
+
}
|
|
286
299
|
try {
|
|
287
300
|
// eslint-disable-next-line no-eval
|
|
288
301
|
const fn = (0, eval)(`(${d.buildSrc})`) as unknown
|
|
@@ -8,6 +8,13 @@ import { parseSync } from 'oxc-parser'
|
|
|
8
8
|
const STATIC_BUILDER_GLOBALS = new Set([
|
|
9
9
|
'Array', 'Boolean', 'Date', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'String',
|
|
10
10
|
'Infinity', 'parseFloat', 'parseInt', 'undefined',
|
|
11
|
+
// Frozen intrinsic error constructors. Reducers pervasively `throw new TypeError(…)`;
|
|
12
|
+
// once the statement walker walks a `throw` argument these surface as free names, and
|
|
13
|
+
// refusing them would re-refuse the very productions the block-body lift clears. They
|
|
14
|
+
// carry no closure state, so admitting them cannot make an unanalyzable builder
|
|
15
|
+
// analyzable by accident. A MODULE-SCOPE custom error stays a free name (rescued by
|
|
16
|
+
// provenance or refused) — unchanged.
|
|
17
|
+
'Error', 'TypeError', 'RangeError', 'SyntaxError',
|
|
11
18
|
])
|
|
12
19
|
|
|
13
20
|
type Ast = { type: string; [key: string]: unknown }
|
|
@@ -33,30 +40,70 @@ function unwrapCallbackExpression(node: Ast | undefined): Ast | undefined {
|
|
|
33
40
|
* AST binding check, never a source-text heuristic: property names and plain
|
|
34
41
|
* object keys are not lexical reads. The result becomes inert metadata on the
|
|
35
42
|
* macro-produced node and is enforced later by the runtime IR re-lowerer.
|
|
43
|
+
*
|
|
44
|
+
* Kept as the combined `structural ++ free` list so every existing caller and the
|
|
45
|
+
* standalone unit gate see one flat array. `directBuilderBindings` exposes the
|
|
46
|
+
* split the provenance path needs.
|
|
36
47
|
*/
|
|
37
48
|
export function directBuilderUnsupportedBindings(src: string): string[] {
|
|
49
|
+
const r = directBuilderBindings(src)
|
|
50
|
+
return [...r.structural, ...r.free]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The analysis, SPLIT into two kinds of unsupported binding:
|
|
55
|
+
*
|
|
56
|
+
* - `structural` — a refusal no provenance can rescue: an un-analyzable node
|
|
57
|
+
* kind, a non-Identifier parameter, `this` / `arguments`, an async or generator
|
|
58
|
+
* reducer. These fail closed and fall back to the interpreter.
|
|
59
|
+
* - `free` — a plain lexical read of a name declared OUTSIDE the builder. Such a
|
|
60
|
+
* name is a refusal on its own, but it CAN be re-bound in a downstream module if
|
|
61
|
+
* that module re-emits the import it came from. The evaluator resolves each free
|
|
62
|
+
* name against the authoring module's imports: one that resolves is carried as
|
|
63
|
+
* import provenance; one that does not stays a refusal.
|
|
64
|
+
*/
|
|
65
|
+
export function directBuilderBindings(src: string): { structural: string[]; free: string[] } {
|
|
38
66
|
let init: Ast | undefined
|
|
39
67
|
try {
|
|
40
68
|
const parsed = parseSync('parseman-direct-builder.ts', `const _direct = (${src})`)
|
|
41
|
-
if (parsed.errors.length > 0) return ['invalid callback source']
|
|
69
|
+
if (parsed.errors.length > 0) return { structural: ['invalid callback source'], free: [] }
|
|
42
70
|
const program = parsed.program as unknown as Ast
|
|
43
|
-
const
|
|
44
|
-
const declaration = (
|
|
71
|
+
const statementNode = (program.body as Ast[] | undefined)?.[0]
|
|
72
|
+
const declaration = (statementNode?.declarations as Ast[] | undefined)?.[0]
|
|
45
73
|
init = unwrapCallbackExpression(declaration?.init as Ast | undefined)
|
|
46
74
|
} catch {
|
|
47
|
-
return ['invalid callback source']
|
|
75
|
+
return { structural: ['invalid callback source'], free: [] }
|
|
48
76
|
}
|
|
49
|
-
|
|
77
|
+
// A direct builder is an arrow OR a resolved `function` reducer (a bare reference
|
|
78
|
+
// to a top-level `function foldOperation(…) {…}` resolves to a FunctionExpression
|
|
79
|
+
// here). Both inline verbatim into the fused table. An async or generator reducer
|
|
80
|
+
// is NOT a pure synchronous builder and stays refused.
|
|
81
|
+
if (init === undefined) return { structural: ['unsupported callback shape'], free: [] }
|
|
82
|
+
const isCallable = init.type === 'ArrowFunctionExpression'
|
|
83
|
+
|| init.type === 'FunctionExpression'
|
|
84
|
+
|| init.type === 'FunctionDeclaration'
|
|
85
|
+
if (!isCallable || !Array.isArray(init.params)) return { structural: ['unsupported callback shape'], free: [] }
|
|
86
|
+
if (init.async === true || init.generator === true) return { structural: ['unsupported callback shape'], free: [] }
|
|
50
87
|
const allowed = new Set(STATIC_BUILDER_GLOBALS)
|
|
51
88
|
for (const param of init.params as Ast[]) {
|
|
52
|
-
if (param.type !== 'Identifier' || typeof param.name !== 'string') return ['unsupported parameter pattern']
|
|
89
|
+
if (param.type !== 'Identifier' || typeof param.name !== 'string') return { structural: ['unsupported parameter pattern'], free: [] }
|
|
53
90
|
allowed.add(param.name)
|
|
54
91
|
}
|
|
55
|
-
|
|
56
|
-
|
|
92
|
+
// A named function expression binds its own name inside its body (recursion), so
|
|
93
|
+
// an inlined `function foldOperation(…) { … foldOperation(…) … }` is self-contained.
|
|
94
|
+
const selfName = astChild(init.id)
|
|
95
|
+
if (selfName?.type === 'Identifier' && typeof selfName.name === 'string') allowed.add(selfName.name)
|
|
96
|
+
|
|
97
|
+
const structural = new Set<string>()
|
|
98
|
+
const free = new Set<string>()
|
|
99
|
+
const reportUnsupportedNode = (ast: Ast): void => { structural.add(`unsupported ${ast.type}`) }
|
|
57
100
|
const read = (ast: Ast, allowedNames: ReadonlySet<string>): void => {
|
|
58
101
|
if (typeof ast.name === 'string' && allowedNames.has(ast.name)) return
|
|
59
|
-
|
|
102
|
+
// `arguments` is a function-only binding that no import can supply; refuse it
|
|
103
|
+
// structurally rather than letting it masquerade as a rescuable free name.
|
|
104
|
+
if (ast.name === 'arguments') { structural.add('unsupported arguments'); return }
|
|
105
|
+
if (typeof ast.name === 'string') free.add(ast.name)
|
|
106
|
+
else structural.add('unsupported identifier')
|
|
60
107
|
}
|
|
61
108
|
const expression = (node: unknown, allowedNames: ReadonlySet<string>): void => {
|
|
62
109
|
const ast = astChild(node)
|
|
@@ -89,14 +136,71 @@ export function directBuilderUnsupportedBindings(src: string): string[] {
|
|
|
89
136
|
if (param.type !== 'Identifier' || typeof param.name !== 'string') { reportUnsupportedNode(param); continue }
|
|
90
137
|
nested.add(param.name)
|
|
91
138
|
}
|
|
92
|
-
|
|
139
|
+
// A nested arrow with a block body is carried as source and inlined verbatim,
|
|
140
|
+
// exactly like the top-level builder — walk it, do not refuse it.
|
|
141
|
+
const nestedBody = astChild(ast.body)
|
|
142
|
+
if (nestedBody?.type === 'BlockStatement') { statement(nestedBody, nested); return }
|
|
93
143
|
expression(ast.body, nested)
|
|
94
144
|
return
|
|
95
145
|
}
|
|
96
146
|
default: reportUnsupportedNode(ast); return
|
|
97
147
|
}
|
|
98
148
|
}
|
|
99
|
-
|
|
149
|
+
// A block body is not a SERIALIZATION limit — `buildSrc` is carried as text and
|
|
150
|
+
// inlined verbatim downstream, so a statement inlines exactly as an expression
|
|
151
|
+
// does. The refusal was an ANALYZER gap: the walker only knew expressions. Walk
|
|
152
|
+
// statements too and the refusal disappears for the shapes grammar reducers use.
|
|
153
|
+
const statement = (node: unknown, names: Set<string>): void => {
|
|
154
|
+
const ast = astChild(node)
|
|
155
|
+
if (!ast) return
|
|
156
|
+
switch (ast.type) {
|
|
157
|
+
case 'VariableDeclaration':
|
|
158
|
+
for (const d of astArray(ast.declarations)) {
|
|
159
|
+
expression(d.init, names)
|
|
160
|
+
const idAst = astChild(d.id)
|
|
161
|
+
if (idAst?.type === 'Identifier' && typeof idAst.name === 'string') names.add(idAst.name)
|
|
162
|
+
else reportUnsupportedNode(idAst ?? ast)
|
|
163
|
+
}
|
|
164
|
+
return
|
|
165
|
+
case 'ReturnStatement': expression(ast.argument, names); return
|
|
166
|
+
case 'ExpressionStatement': expression(ast.expression, names); return
|
|
167
|
+
case 'ThrowStatement': expression(ast.argument, names); return
|
|
168
|
+
case 'IfStatement':
|
|
169
|
+
expression(ast.test, names)
|
|
170
|
+
statement(ast.consequent, new Set(names))
|
|
171
|
+
if (ast.alternate) statement(ast.alternate, new Set(names))
|
|
172
|
+
return
|
|
173
|
+
case 'ForStatement': {
|
|
174
|
+
// The init's bindings (`index`) are visible to test / update / body but must
|
|
175
|
+
// not leak to the enclosing scope — hence the child set.
|
|
176
|
+
const inner = new Set(names)
|
|
177
|
+
if (ast.init) {
|
|
178
|
+
const initAst = astChild(ast.init)
|
|
179
|
+
if (initAst?.type === 'VariableDeclaration') statement(initAst, inner)
|
|
180
|
+
else expression(initAst, inner)
|
|
181
|
+
}
|
|
182
|
+
if (ast.test) expression(ast.test, inner)
|
|
183
|
+
if (ast.update) expression(ast.update, inner)
|
|
184
|
+
statement(ast.body, inner)
|
|
185
|
+
return
|
|
186
|
+
}
|
|
187
|
+
case 'ForOfStatement': case 'ForInStatement': {
|
|
188
|
+
// The iterable (`ast.right`) is read in the OUTER scope; the loop variable is
|
|
189
|
+
// in scope only for the body. A non-declaration target (`for (x of …)`, a
|
|
190
|
+
// destructuring or member target) is refused by the statement walker.
|
|
191
|
+
const inner = new Set(names)
|
|
192
|
+
statement(ast.left, inner)
|
|
193
|
+
expression(ast.right, names)
|
|
194
|
+
statement(ast.body, inner)
|
|
195
|
+
return
|
|
196
|
+
}
|
|
197
|
+
case 'BlockStatement': { const inner = new Set(names); for (const s of astArray(ast.body)) statement(s, inner); return }
|
|
198
|
+
case 'BreakStatement': case 'ContinueStatement': case 'EmptyStatement': return
|
|
199
|
+
default: reportUnsupportedNode(ast); return
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const bodyAst = astChild(init.body)
|
|
203
|
+
if (bodyAst?.type === 'BlockStatement') statement(bodyAst, allowed)
|
|
100
204
|
else expression(init.body, allowed)
|
|
101
|
-
return [...
|
|
205
|
+
return { structural: [...structural], free: [...free] }
|
|
102
206
|
}
|
package/src/plugin/evaluator.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type { DispatchArm } from '../combinators/dispatch.ts'
|
|
|
18
18
|
import { ref } from '../combinators/ref.ts'
|
|
19
19
|
import { rules, type RulesOptions } from '../combinators/parser.ts'
|
|
20
20
|
import * as parseman from '../index.ts'
|
|
21
|
-
import {
|
|
21
|
+
import { directBuilderBindings } from './direct-builder-static.ts'
|
|
22
22
|
import type { ReducerResolver } from './reducer-resolver.ts'
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -124,6 +124,20 @@ export function setReducerResolver(r: ReducerResolver | null, entrySource: strin
|
|
|
124
124
|
_entrySource = entrySource
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Map a free lexical name read by a direct node builder to the import it came from
|
|
129
|
+
* in the AUTHORING module. A name that resolves is no longer a refusal — the node
|
|
130
|
+
* carries `{ source, imported }` provenance, and a downstream `compose()` re-binds
|
|
131
|
+
* it by re-emitting the same import into the consuming module. A name that does not
|
|
132
|
+
* resolve (a module-private const, a genuinely undefined read) stays a refusal.
|
|
133
|
+
*/
|
|
134
|
+
export type BuilderImportResolver = (name: string) => { source: string; imported: string } | null
|
|
135
|
+
let _builderImports: BuilderImportResolver | null = null
|
|
136
|
+
/** Install (or clear, with `null`) the import-provenance resolver for the module being transformed. */
|
|
137
|
+
export function setBuilderImportResolver(r: BuilderImportResolver | null): void {
|
|
138
|
+
_builderImports = r
|
|
139
|
+
}
|
|
140
|
+
|
|
127
141
|
// ---------------------------------------------------------------------------
|
|
128
142
|
// Scope types
|
|
129
143
|
//
|
|
@@ -700,8 +714,42 @@ function exprToCombi(node: Expression, scope: XScope, code?: string, mfs?: strin
|
|
|
700
714
|
if (combi._def.buildArity === undefined && resolved.arity !== null) combi._def.buildArity = resolved.arity
|
|
701
715
|
if (resolved.reason !== undefined) combi._def.buildArityUnresolved = resolved.reason
|
|
702
716
|
}
|
|
703
|
-
|
|
717
|
+
// Analyze the REDUCER BODY, not the call-site reference. A named `function`
|
|
718
|
+
// reducer (`node(..., foldOperation)`) arrives here as the bare identifier
|
|
719
|
+
// `foldOperation`, which the analyzer can only read as `unsupported callback
|
|
720
|
+
// shape`. `buildSigSrc` is the resolved declaration source (see the resolver
|
|
721
|
+
// above and `buildAnalysisSrc`), so preferring it lets the function-reducer
|
|
722
|
+
// lift walk the real body and report its real free names. An inline builder
|
|
723
|
+
// has no `buildSigSrc`, so this is exactly `buildSrc` for that case.
|
|
724
|
+
const analysisSrc = combi._def.buildSigSrc ?? buildSrc
|
|
725
|
+
const report = directBuilderBindings(analysisSrc)
|
|
726
|
+
// Import-provenance rescue and free-name refusals apply ONLY to an INLINE
|
|
727
|
+
// builder body, whose source (`buildSrc`) is exactly what the table inlines and
|
|
728
|
+
// a downstream compose re-emits verbatim. A NAMED reducer (`buildSigSrc` set —
|
|
729
|
+
// `node(..., foldOperation)`) is emitted as a live `f:[foldOperation]` binding
|
|
730
|
+
// that runs in ITS OWN module's scope; its body is never inlined here. So its
|
|
731
|
+
// body's free names are not this (entry) module's to resolve — doing so bound a
|
|
732
|
+
// coincidental same-named entry import to the wrong helper (wrong provenance) —
|
|
733
|
+
// and carrying their imports is dead: the emitted source is the NAME, not the
|
|
734
|
+
// body, so re-emitting those imports satisfies nothing. Analyse-only fields
|
|
735
|
+
// (`buildArity`/`buildSigSrc`) are already set above and are unaffected.
|
|
736
|
+
const isInlineBuilder = combi._def.buildSigSrc === undefined
|
|
737
|
+
// A free name that this module IMPORTED is not a refusal: carry its
|
|
738
|
+
// provenance so a downstream compose() re-emits the import. Only structural
|
|
739
|
+
// refusals and free names with NO import provenance become the fail-closed
|
|
740
|
+
// `buildStaticError` — which the runtime re-lowerer still throws on.
|
|
741
|
+
const carriedImports: Array<{ local: string; source: string; imported: string }> = []
|
|
742
|
+
const unresolved: string[] = []
|
|
743
|
+
if (isInlineBuilder) {
|
|
744
|
+
for (const name of report.free) {
|
|
745
|
+
const prov = _builderImports?.(name) ?? null
|
|
746
|
+
if (prov) carriedImports.push({ local: name, source: prov.source, imported: prov.imported })
|
|
747
|
+
else unresolved.push(name)
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
const staticError = [...report.structural, ...unresolved]
|
|
704
751
|
if (staticError.length > 0) combi._def.buildStaticError = staticError
|
|
752
|
+
if (carriedImports.length > 0) combi._def.buildImports = carriedImports
|
|
705
753
|
}
|
|
706
754
|
return combi
|
|
707
755
|
} catch { return null }
|
package/src/plugin/index.ts
CHANGED
|
@@ -23,7 +23,7 @@ import { createUnplugin } from 'unplugin'
|
|
|
23
23
|
import { parseSync } from 'oxc-parser'
|
|
24
24
|
import { ResolverFactory } from 'oxc-resolver'
|
|
25
25
|
import MagicString from 'magic-string'
|
|
26
|
-
import { evaluateExpr, evaluateCombinatorArray, evaluateParserFactory, evaluateStaticValue, evaluateWordFactory, evaluateWhenFactory, evaluateRefDeclaration, applyDefineStatement, referencesAny, setReducerResolver, propName, type Scope, type ScopeEntry } from './evaluator.ts'
|
|
26
|
+
import { evaluateExpr, evaluateCombinatorArray, evaluateParserFactory, evaluateStaticValue, evaluateWordFactory, evaluateWhenFactory, evaluateRefDeclaration, applyDefineStatement, referencesAny, setReducerResolver, setBuilderImportResolver, propName, type Scope, type ScopeEntry } from './evaluator.ts'
|
|
27
27
|
import { classifyRuleMap } from '../analysis/commitment.ts'
|
|
28
28
|
import { compile } from '../table/compile.ts'
|
|
29
29
|
import { compileRuleMap } from '../table/compile-rule-map.ts'
|
|
@@ -516,6 +516,7 @@ export function transformMacro(
|
|
|
516
516
|
return transformMacroImpl(code, id, moduleAliases, warnUnloweredRegex, recovery, grammarCoverage)
|
|
517
517
|
} finally {
|
|
518
518
|
setReducerResolver(null)
|
|
519
|
+
setBuilderImportResolver(null)
|
|
519
520
|
// Both are idempotent: on the success path the body already released them and these
|
|
520
521
|
// are no-ops. On an aborted transform they are what stops the leak.
|
|
521
522
|
for (const d of unwindDegradationCapture(depth)) console.warn(formatDegradation(d))
|
|
@@ -666,6 +667,10 @@ function transformMacroImpl(
|
|
|
666
667
|
*/
|
|
667
668
|
const reducerResolver = createReducerResolver(id, body as unknown[], code)
|
|
668
669
|
setReducerResolver(reducerResolver, code)
|
|
670
|
+
/* A direct builder's free name is rescuable when THIS module imported it — the
|
|
671
|
+
* artifact carries `{ source, imported }` and a downstream compose() re-emits the
|
|
672
|
+
* import (see the re-lower pass below). Module-private consts stay refusals. */
|
|
673
|
+
setBuilderImportResolver(name => importBindings.get(name) ?? null)
|
|
669
674
|
|
|
670
675
|
const topLevelFunction = (moduleBody: AnyNode[], name: string): AnyNode | null => {
|
|
671
676
|
for (const st of moduleBody) {
|
|
@@ -797,6 +802,69 @@ function transformMacroImpl(
|
|
|
797
802
|
* at the end of this transform is what proves it was actually emitted.
|
|
798
803
|
*/
|
|
799
804
|
let usedTableRuntime = false
|
|
805
|
+
/**
|
|
806
|
+
* `source` -> (local -> imported) for direct-builder free names that rode in on a
|
|
807
|
+
* carried piece's IR (a composed base grammar whose reducers call imported AST
|
|
808
|
+
* factories). Re-emitted as real imports into THIS module so the inlined builder
|
|
809
|
+
* source has bindings to resolve. A name this module already imports is skipped.
|
|
810
|
+
*/
|
|
811
|
+
const pendingBuilderImports = new Map<string, Map<string, string>>()
|
|
812
|
+
/**
|
|
813
|
+
* Harvest direct-builder import provenance off a MERGED rule graph so the re-lower
|
|
814
|
+
* pass re-emits those imports. `buildImports` rides on a `node()`'s `_def`, but a
|
|
815
|
+
* rule that ANOTHER rule references (`g.X`) is materialized in the evaluated map as
|
|
816
|
+
* a `lazy` proxy whose definition node sits behind `_def.thunk()` — never an own
|
|
817
|
+
* property. A generic `Object.values` descent therefore skips it entirely, silently
|
|
818
|
+
* dropping the imports of every cross-referenced rule (the css base's `VarCall`,
|
|
819
|
+
* referenced by its selector/value parents, is the canonical case: its `funcCall` /
|
|
820
|
+
* `isValueSlotValue` reads were lost and the fused downstream module threw "bound by
|
|
821
|
+
* nothing" / left a runtime compose()).
|
|
822
|
+
*
|
|
823
|
+
* The fused table encodes exactly the WINNER of each rule name and binds every
|
|
824
|
+
* reference BY NAME to that winner (`enc.winners`), so the imports it inlines are
|
|
825
|
+
* exactly the union over the winning rule bodies. Harvest that set: walk each rule
|
|
826
|
+
* entry's own body (following the entry lazy's thunk), and STOP at a named `lazy`
|
|
827
|
+
* reference inside a body — it resolves to a winner already covered as its own
|
|
828
|
+
* entry, so descending it would reach an OVERRIDDEN rule's shadowed original and
|
|
829
|
+
* re-emit a dead import. An anonymous `lazy` is inline recursion and is followed.
|
|
830
|
+
* One `seen` set is shared across every rule so a cyclic grammar terminates.
|
|
831
|
+
*/
|
|
832
|
+
const collectBuilderImports = (ruleMap: ReadonlyArray<readonly [string, Combinator<unknown>]>): void => {
|
|
833
|
+
const seen = new Set<unknown>()
|
|
834
|
+
const walk = (v: unknown): void => {
|
|
835
|
+
if (v === null || typeof v !== 'object' || seen.has(v)) return
|
|
836
|
+
seen.add(v)
|
|
837
|
+
const def = (v as { _def?: { tag?: string; thunk?: () => unknown; buildImports?: ReadonlyArray<{ local: string; source: string; imported: string }> } })._def
|
|
838
|
+
for (const bi of def?.buildImports ?? []) {
|
|
839
|
+
let m = pendingBuilderImports.get(bi.source)
|
|
840
|
+
if (!m) { m = new Map(); pendingBuilderImports.set(bi.source, m) }
|
|
841
|
+
m.set(bi.local, bi.imported)
|
|
842
|
+
}
|
|
843
|
+
// An ANONYMOUS lazy is inline recursion — follow the thunk. A NAMED lazy is a
|
|
844
|
+
// rule reference bound by name to a winner covered as its own entry; do not
|
|
845
|
+
// descend it (that path reaches an overridden rule's shadowed original).
|
|
846
|
+
if (def?.tag === 'lazy' && (v as { _ruleName?: string })._ruleName === undefined && typeof def.thunk === 'function') {
|
|
847
|
+
let target: unknown = null
|
|
848
|
+
try { target = def.thunk() } catch { /* external ref — no definition to walk */ }
|
|
849
|
+
walk(target)
|
|
850
|
+
}
|
|
851
|
+
for (const child of Object.values(v as Record<string, unknown>)) {
|
|
852
|
+
if (Array.isArray(child)) { for (const c of child) walk(c) } else walk(child)
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
for (const [, rule] of ruleMap) {
|
|
856
|
+
walk(rule)
|
|
857
|
+
// A referenced rule entry is a named lazy whose body node (with its builder
|
|
858
|
+
// imports) is behind the thunk; `walk` skips a named lazy's thunk, so follow
|
|
859
|
+
// the WINNER'S body explicitly here. A raw-node entry was already fully walked.
|
|
860
|
+
const def = rule._def as { tag?: string; thunk?: () => unknown }
|
|
861
|
+
if (def?.tag === 'lazy' && typeof def.thunk === 'function') {
|
|
862
|
+
let body: unknown = null
|
|
863
|
+
try { body = def.thunk() } catch { /* unresolved winner — nothing to walk */ }
|
|
864
|
+
walk(body)
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
800
868
|
/** Exported `rules()` factories, whose bodies are left verbatim. See the push site. */
|
|
801
869
|
const exportedFactories: Array<{ name: string; pos: number }> = []
|
|
802
870
|
let runtimeComposeFallback = false
|
|
@@ -1457,6 +1525,9 @@ function transformMacroImpl(
|
|
|
1457
1525
|
const merged = mergedCarriedRules(carried)
|
|
1458
1526
|
if (merged !== null) {
|
|
1459
1527
|
if (composing) applyComposingTrivia(merged.rules, composing)
|
|
1528
|
+
// Harvest the direct-builder import provenance carried on the merged graph so
|
|
1529
|
+
// the re-lower pass at the end of this transform re-emits those imports.
|
|
1530
|
+
collectBuilderImports(merged.rules)
|
|
1460
1531
|
const refusals: string[] = []
|
|
1461
1532
|
const compiled = compileRuleMap(merged.rules, {
|
|
1462
1533
|
...(composing ? { trivia: composing } : {}),
|
|
@@ -2186,6 +2257,73 @@ function transformMacroImpl(
|
|
|
2186
2257
|
if (usedTableRuntime && applied.length > 0) {
|
|
2187
2258
|
ms.prepend(`import { tableRules } from ${JSON.stringify(TABLE_RUNTIME_SPECIFIER)}\n`)
|
|
2188
2259
|
}
|
|
2260
|
+
/* Re-bind the direct-builder free names carried in on composed IR: a base
|
|
2261
|
+
* grammar's reducer calls `dimension` from '@jesscss/core/ast', that provenance
|
|
2262
|
+
* rode in on the carried piece, and the fused table inlines the reducer source
|
|
2263
|
+
* here — so this module must import the same binding.
|
|
2264
|
+
*
|
|
2265
|
+
* The inlined builder source spells the free name VERBATIM, so a re-emitted import
|
|
2266
|
+
* cannot be aliased away: the local name is load-bearing. Two things therefore make
|
|
2267
|
+
* a carried import unsatisfiable, and both are refused rather than silently mis-bound
|
|
2268
|
+
* or emitted as a duplicate declaration:
|
|
2269
|
+
*
|
|
2270
|
+
* - the name is ALREADY BOUND in this module to something else — a named import
|
|
2271
|
+
* from a DIFFERENT source/symbol (the inlined builder would call the wrong
|
|
2272
|
+
* binding), a default/namespace import, or a top-level const/function/class
|
|
2273
|
+
* (re-emitting the import would be a redeclaration `SyntaxError`). The
|
|
2274
|
+
* free-identifier net below cannot catch either: a wrong-binding read is bound,
|
|
2275
|
+
* and a redeclaration is the opposite of an unbound read.
|
|
2276
|
+
* - two DISTINCT carried sources need the SAME local name (the map is keyed by
|
|
2277
|
+
* source, so each would emit its own `import { X } from …`).
|
|
2278
|
+
*
|
|
2279
|
+
* A name this module already imports from the SAME source under the SAME symbol is
|
|
2280
|
+
* the benign case — the exact import the builder needs is already present, so it is
|
|
2281
|
+
* skipped (no duplicate). */
|
|
2282
|
+
if (applied.length > 0 && pendingBuilderImports.size > 0) {
|
|
2283
|
+
// Every top-level binding of THIS module, not just its named imports.
|
|
2284
|
+
const boundLocally = new Set<string>()
|
|
2285
|
+
for (const stmt of body as Statement[]) {
|
|
2286
|
+
if (stmt.type === 'ImportDeclaration') {
|
|
2287
|
+
for (const sp of (stmt as unknown as ImportDeclaration).specifiers) boundLocally.add(sp.local.name)
|
|
2288
|
+
continue
|
|
2289
|
+
}
|
|
2290
|
+
const decl = stmt.type === 'ExportNamedDeclaration'
|
|
2291
|
+
? ((stmt as unknown as ExportNamedDeclaration).declaration as unknown as AnyNode | undefined)
|
|
2292
|
+
: (stmt as unknown as AnyNode)
|
|
2293
|
+
if (decl?.type === 'FunctionDeclaration' || decl?.type === 'ClassDeclaration') {
|
|
2294
|
+
const n = (decl as unknown as { id?: { name?: string } }).id?.name
|
|
2295
|
+
if (n) boundLocally.add(n)
|
|
2296
|
+
continue
|
|
2297
|
+
}
|
|
2298
|
+
const vd = unwrapVd(stmt)
|
|
2299
|
+
for (const d of vd?.declarations ?? []) {
|
|
2300
|
+
const n = (d.id as unknown as { name?: string }).name
|
|
2301
|
+
if (n) boundLocally.add(n)
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
const emitted = new Set<string>()
|
|
2305
|
+
for (const [source, locals] of pendingBuilderImports) {
|
|
2306
|
+
const needed: Array<[string, string]> = []
|
|
2307
|
+
for (const [local, imported] of locals) {
|
|
2308
|
+
const own = importBindings.get(local)
|
|
2309
|
+
// Exact same import already present: the builder's need is satisfied. Skip.
|
|
2310
|
+
if (own && own.source === source && own.imported === imported) continue
|
|
2311
|
+
if (boundLocally.has(local) || emitted.has(local)) {
|
|
2312
|
+
throw new Error(
|
|
2313
|
+
`${id} — parseman will not emit this module: a fused builder needs \`${imported}\` from `
|
|
2314
|
+
+ `${JSON.stringify(source)} bound as \`${local}\`, but this module already binds \`${local}\` `
|
|
2315
|
+
+ `to something else. The inlined builder source names \`${local}\` verbatim, so the import `
|
|
2316
|
+
+ `cannot be aliased; rename the conflicting local binding so the builder's import can be re-emitted.`,
|
|
2317
|
+
)
|
|
2318
|
+
}
|
|
2319
|
+
emitted.add(local)
|
|
2320
|
+
needed.push([local, imported])
|
|
2321
|
+
}
|
|
2322
|
+
if (needed.length === 0) continue
|
|
2323
|
+
const specs = needed.map(([local, imported]) => imported === local ? local : `${imported} as ${local}`)
|
|
2324
|
+
ms.prepend(`import { ${specs.join(', ')} } from ${JSON.stringify(source)}\n`)
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2189
2327
|
if (applied.length > 0) {
|
|
2190
2328
|
ms.prepend(
|
|
2191
2329
|
`// Generated by parseman v${PARSEMAN_VERSION} — DO NOT EDIT.\n` +
|
|
@@ -2259,6 +2397,7 @@ function transformMacroImpl(
|
|
|
2259
2397
|
// caller's config does not break; it is now inert.
|
|
2260
2398
|
|
|
2261
2399
|
setReducerResolver(null)
|
|
2400
|
+
setBuilderImportResolver(null)
|
|
2262
2401
|
// Every place the compiler chose a correct-but-slower path for this module. Reported
|
|
2263
2402
|
// on the ordinary warning channel and greppable on `[parseman] degraded`, so a
|
|
2264
2403
|
// consumer's build gate can assert zero of them the way jess's `check:macro` already
|
package/src/types.ts
CHANGED
|
@@ -89,7 +89,7 @@ export type ParserDef =
|
|
|
89
89
|
// it requires, so it carries `parser`'s first-set and a leading `peek()` gates
|
|
90
90
|
// its choice arm (see `isPositiveLookahead` / `sequenceFirstSet`).
|
|
91
91
|
| { tag: 'peek'; parser: Combinator<unknown> }
|
|
92
|
-
| { tag: 'node'; type?: string; parser: Combinator<unknown>; build?: ((children: ReadonlyArray<unknown>, fields: FieldMap | undefined, span: { start: number; end: number }, rawChildren: ReadonlyArray<unknown>, triviaLog: readonly number[], state: unknown) => unknown) | undefined; buildSrc?: string; /** The IDENTIFIER the type argument was written as at the `node()` call site, when it was a plain identifier rather than a literal — ANALYSIS ONLY, never emitted. Lets the inline-`mk` matcher recognise `node(t, …, (…) => mk(t, …))` from a factory, where the two `t`s are provably one binding. */ typeSrc?: string; /** Resolved source of a NAMED `buildSrc` — ANALYSIS ONLY, never emitted. See `buildAnalysisSrc`. */ buildSigSrc?: string; /** Declared positional arity of `build`: author-declared via `node(..., { buildArity })`, or resolved from the reducer's declaration. Wins over source inspection. */ buildArity?: number; /** Why arity could not be resolved, for the diagnostic. */ buildArityUnresolved?: string; buildStaticError?: readonly string[]; unwrap?: boolean; collapse?: boolean; project?: number; captureTrivia?: boolean; trailingTrivia?: boolean; tags?: readonly string[] }
|
|
92
|
+
| { tag: 'node'; type?: string; parser: Combinator<unknown>; build?: ((children: ReadonlyArray<unknown>, fields: FieldMap | undefined, span: { start: number; end: number }, rawChildren: ReadonlyArray<unknown>, triviaLog: readonly number[], state: unknown) => unknown) | undefined; buildSrc?: string; /** The IDENTIFIER the type argument was written as at the `node()` call site, when it was a plain identifier rather than a literal — ANALYSIS ONLY, never emitted. Lets the inline-`mk` matcher recognise `node(t, …, (…) => mk(t, …))` from a factory, where the two `t`s are provably one binding. */ typeSrc?: string; /** Resolved source of a NAMED `buildSrc` — ANALYSIS ONLY, never emitted. See `buildAnalysisSrc`. */ buildSigSrc?: string; /** Declared positional arity of `build`: author-declared via `node(..., { buildArity })`, or resolved from the reducer's declaration. Wins over source inspection. */ buildArity?: number; /** Why arity could not be resolved, for the diagnostic. */ buildArityUnresolved?: string; buildStaticError?: readonly string[]; /** Import provenance for a direct builder's free names — each `{ local, source, imported }` lets a downstream compose() re-emit `import { imported as local } from source` so the inlined builder source can bind. Carried through the IR round-trip. */ buildImports?: ReadonlyArray<{ local: string; source: string; imported: string }>; unwrap?: boolean; collapse?: boolean; project?: number; captureTrivia?: boolean; trailingTrivia?: boolean; tags?: readonly string[] }
|
|
93
93
|
// `predSrc`/`extraSrc` (set by the macro evaluator): SOURCE TEXT of the guard
|
|
94
94
|
// predicate / the withCtx `extra` value, so codegen inlines them into `_mf`
|
|
95
95
|
// rather than pushing a `null` source. Absent under runtime compile() (the real
|
package/src/version.ts
CHANGED