aontu 0.56.0 → 0.58.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/README.md +2 -2
- package/dist/agentsmd.js +1 -1
- package/dist/alias.d.ts +3 -0
- package/dist/alias.js +59 -0
- package/dist/alias.js.map +1 -0
- package/dist/aontu.d.ts +5 -2
- package/dist/aontu.js +11 -3
- package/dist/aontu.js.map +1 -1
- package/dist/cli.d.ts +8 -2
- package/dist/cli.js +564 -21
- package/dist/cli.js.map +1 -1
- package/dist/ctx.d.ts +2 -0
- package/dist/ctx.js +1 -0
- package/dist/ctx.js.map +1 -1
- package/dist/escape.d.ts +5 -0
- package/dist/escape.js +455 -0
- package/dist/escape.js.map +1 -0
- package/dist/format.d.ts +9 -0
- package/dist/format.js +550 -55
- package/dist/format.js.map +1 -1
- package/dist/hints.js +74 -9
- package/dist/hints.js.map +1 -1
- package/dist/lang.js +374 -58
- package/dist/lang.js.map +1 -1
- package/dist/lower.d.ts +20 -0
- package/dist/lower.js +575 -0
- package/dist/lower.js.map +1 -0
- package/dist/lsp.d.ts +1 -1
- package/dist/lsp.js +4 -4
- package/dist/lsp.js.map +1 -1
- package/dist/mcp-server.js +2 -2
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.js +40 -3
- package/dist/mcp.js.map +1 -1
- package/dist/mod-tool.js +8 -7
- package/dist/mod-tool.js.map +1 -1
- package/dist/mod.js +6 -6
- package/dist/mod.js.map +1 -1
- package/dist/render.d.ts +53 -0
- package/dist/render.js +542 -0
- package/dist/render.js.map +1 -0
- package/dist/sigdecl.js +1 -1
- package/dist/sigdecl.js.map +1 -1
- package/dist/std.d.ts +2 -0
- package/dist/std.js +498 -2
- package/dist/std.js.map +1 -1
- package/dist/template.d.ts +5 -0
- package/dist/template.js +257 -0
- package/dist/template.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/unify.js +43 -0
- package/dist/unify.js.map +1 -1
- package/dist/val/AggFuncVal.d.ts +1 -1
- package/dist/val/AggFuncVal.js +10 -21
- package/dist/val/AggFuncVal.js.map +1 -1
- package/dist/val/BagVal.js +1 -1
- package/dist/val/BagVal.js.map +1 -1
- package/dist/val/ConstraintVal.js +1 -1
- package/dist/val/EachFuncVal.d.ts +1 -1
- package/dist/val/EachFuncVal.js +9 -15
- package/dist/val/EachFuncVal.js.map +1 -1
- package/dist/val/EmitFuncVal.d.ts +42 -0
- package/dist/val/EmitFuncVal.js +531 -0
- package/dist/val/EmitFuncVal.js.map +1 -0
- package/dist/val/FilterFuncVal.js +9 -6
- package/dist/val/FilterFuncVal.js.map +1 -1
- package/dist/val/FormFuncVal.d.ts +14 -0
- package/dist/val/FormFuncVal.js +55 -0
- package/dist/val/FormFuncVal.js.map +1 -0
- package/dist/val/FuncBaseVal.d.ts +1 -0
- package/dist/val/FuncBaseVal.js +16 -0
- package/dist/val/FuncBaseVal.js.map +1 -1
- package/dist/val/MapVal.d.ts +2 -1
- package/dist/val/MapVal.js +2 -1
- package/dist/val/MapVal.js.map +1 -1
- package/dist/val/PackFuncVal.d.ts +1 -1
- package/dist/val/PackFuncVal.js +23 -20
- package/dist/val/PackFuncVal.js.map +1 -1
- package/dist/val/PlaceVal.d.ts +3 -1
- package/dist/val/PlaceVal.js +9 -6
- package/dist/val/PlaceVal.js.map +1 -1
- package/dist/val/RefVal.d.ts +3 -0
- package/dist/val/RefVal.js +156 -17
- package/dist/val/RefVal.js.map +1 -1
- package/dist/val/StrFuncVal.d.ts +32 -0
- package/dist/val/StrFuncVal.js +292 -0
- package/dist/val/StrFuncVal.js.map +1 -0
- package/dist/val/Val.d.ts +7 -1
- package/dist/val/Val.js +12 -1
- package/dist/val/Val.js.map +1 -1
- package/dist/val/members.d.ts +9 -0
- package/dist/val/members.js +52 -0
- package/dist/val/members.js.map +1 -0
- package/grammar/aontu.abnf +4 -3
- package/grammar/aontu.gbnf +4 -3
- package/grammar/aontu.lark +4 -3
- package/grammar/aontu.tmLanguage.json +1 -1
- package/package.json +1 -1
- package/skill/SKILL.md +4 -4
- package/skill/error-codes.md +1 -1
- package/skill/examples.md +1 -1
- package/skill/grammar-card.md +1 -1
- package/src/agentsmd.ts +1 -1
- package/src/alias.ts +112 -0
- package/src/aontu.ts +20 -2
- package/src/cli.ts +630 -23
- package/src/ctx.ts +13 -0
- package/src/escape.ts +371 -0
- package/src/format.ts +648 -56
- package/src/hints.ts +94 -9
- package/src/lang.ts +430 -63
- package/src/lower.ts +636 -0
- package/src/lsp.ts +4 -4
- package/src/mcp-server.ts +3 -2
- package/src/mcp.ts +43 -4
- package/src/mod-tool.ts +9 -8
- package/src/mod.ts +6 -6
- package/src/render.ts +727 -0
- package/src/sigdecl.ts +1 -1
- package/src/std.ts +506 -1
- package/src/template.ts +291 -0
- package/src/unify.ts +47 -0
- package/src/val/AggFuncVal.ts +10 -21
- package/src/val/BagVal.ts +1 -1
- package/src/val/ConstraintVal.ts +1 -1
- package/src/val/EachFuncVal.ts +9 -19
- package/src/val/EmitFuncVal.ts +738 -0
- package/src/val/FilterFuncVal.ts +12 -7
- package/src/val/FormFuncVal.ts +119 -0
- package/src/val/FuncBaseVal.ts +18 -0
- package/src/val/MapVal.ts +3 -2
- package/src/val/PackFuncVal.ts +24 -22
- package/src/val/PlaceVal.ts +9 -6
- package/src/val/RefVal.ts +167 -18
- package/src/val/StrFuncVal.ts +334 -0
- package/src/val/Val.ts +42 -1
- package/src/val/members.ts +86 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright (c) 2025 Richard Rodger, MIT License */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.EmitFuncVal = void 0;
|
|
5
|
+
const unify_1 = require("../unify");
|
|
6
|
+
const err_1 = require("../err");
|
|
7
|
+
const escape_1 = require("../escape");
|
|
8
|
+
const keyorder_1 = require("../keyorder");
|
|
9
|
+
const top_1 = require("./top");
|
|
10
|
+
const ListVal_1 = require("./ListVal");
|
|
11
|
+
const StringVal_1 = require("./StringVal");
|
|
12
|
+
const FuncBaseVal_1 = require("./FuncBaseVal");
|
|
13
|
+
const Val_1 = require("./Val");
|
|
14
|
+
const PlaceVal_1 = require("./PlaceVal");
|
|
15
|
+
const PlusOpVal_1 = require("./PlusOpVal");
|
|
16
|
+
const members_1 = require("./members");
|
|
17
|
+
function isRefusal(x) {
|
|
18
|
+
return 'string' === typeof x.code;
|
|
19
|
+
}
|
|
20
|
+
// Read the table. A map is one template; a list is many. The shape is
|
|
21
|
+
// checked here rather than at the call, because a table is ordinary
|
|
22
|
+
// data and may be computed.
|
|
23
|
+
function tableTemplates(table) {
|
|
24
|
+
const t = table;
|
|
25
|
+
// A NAMED TABLE IS A PLACEHELD `emit`, and its table is the table.
|
|
26
|
+
// A table written at a document position is DRIVEN there -- a body's
|
|
27
|
+
// relative references resolve against wherever it sits and miss --
|
|
28
|
+
// so the position that holds one unevaluated is the one position the
|
|
29
|
+
// language already never drives: a call's template argument.
|
|
30
|
+
// `%wire = emit(_, [ … ])` is that position with the selection left
|
|
31
|
+
// open, and it reads as what it is, an apply-templates waiting for
|
|
32
|
+
// its nodes: `emit(.listen, %wire)` passes them, `.listen & %wire`
|
|
33
|
+
// fills the hole, and both are the same dispatch.
|
|
34
|
+
if (true === t?.isEmitFunc) {
|
|
35
|
+
return tableTemplates(t.peg[1]);
|
|
36
|
+
}
|
|
37
|
+
if (true === t?.isMap) {
|
|
38
|
+
const one = oneTemplate(t, 0);
|
|
39
|
+
return isRefusal(one) ? one : [one];
|
|
40
|
+
}
|
|
41
|
+
if (true === t?.isList) {
|
|
42
|
+
const out = [];
|
|
43
|
+
for (const el of t.peg) {
|
|
44
|
+
const e = el;
|
|
45
|
+
if (true !== e?.isMap) {
|
|
46
|
+
return { code: 'emit_template' };
|
|
47
|
+
}
|
|
48
|
+
const one = oneTemplate(e, out.length);
|
|
49
|
+
if (isRefusal(one)) {
|
|
50
|
+
return one;
|
|
51
|
+
}
|
|
52
|
+
out.push(one);
|
|
53
|
+
}
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
return { code: 'emit_table' };
|
|
57
|
+
}
|
|
58
|
+
// One rule. Both keys are required: a template with no pattern would
|
|
59
|
+
// match everything by accident, and one with no body would emit
|
|
60
|
+
// nothing while claiming a node. The two optional keys -- a `replace`
|
|
61
|
+
// map and an `esc` naming the convention its values are escaped by,
|
|
62
|
+
// `none` the one opt-out -- are the template's shape too, and D3's two
|
|
63
|
+
// static checks run here, on the template alone, before any node.
|
|
64
|
+
function oneTemplate(m, idx) {
|
|
65
|
+
const match = m.peg.match;
|
|
66
|
+
const body = m.peg.body;
|
|
67
|
+
if (null == match || null == body) {
|
|
68
|
+
return { code: 'emit_template' };
|
|
69
|
+
}
|
|
70
|
+
if (true !== body.isList) {
|
|
71
|
+
return { code: 'emit_body' };
|
|
72
|
+
}
|
|
73
|
+
const replace = m.peg.replace;
|
|
74
|
+
if (null != replace && true !== replace.isMap) {
|
|
75
|
+
return { code: 'emit_template' };
|
|
76
|
+
}
|
|
77
|
+
const escv = m.peg.esc;
|
|
78
|
+
let esc = '';
|
|
79
|
+
if (null != escv) {
|
|
80
|
+
const name = textOf(escv);
|
|
81
|
+
if (undefined === name || ('none' !== name && !(0, escape_1.isEscVariant)(name))) {
|
|
82
|
+
return { code: 'esc_variant' };
|
|
83
|
+
}
|
|
84
|
+
esc = name;
|
|
85
|
+
}
|
|
86
|
+
const lits = literalSpots(body.peg);
|
|
87
|
+
if (null != replace) {
|
|
88
|
+
const bad = checkReplace(Object.keys(replace.peg), lits);
|
|
89
|
+
if (undefined !== bad) {
|
|
90
|
+
return bad;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return { match, body, replace, esc, lits, idx };
|
|
94
|
+
}
|
|
95
|
+
// The string a value carries, or undefined when it is not a string.
|
|
96
|
+
function textOf(v) {
|
|
97
|
+
return true === v?.isScalar && 'string' === typeof v.peg ? v.peg : undefined;
|
|
98
|
+
}
|
|
99
|
+
// The literal strings of a body -- a string element, and the strings
|
|
100
|
+
// written directly in a map element's `of` list or `text` -- which are
|
|
101
|
+
// the text the template wrote. A string an expression or a nested
|
|
102
|
+
// dispatch computes is not one: D3's third rule (a spliced result is
|
|
103
|
+
// finished) and its second (a substituted value is never re-scanned)
|
|
104
|
+
// both follow from substituting at these spots and nowhere else.
|
|
105
|
+
function literalSpots(elems) {
|
|
106
|
+
const out = [];
|
|
107
|
+
elems.forEach((el, i) => {
|
|
108
|
+
const s = textOf(el);
|
|
109
|
+
if (undefined !== s) {
|
|
110
|
+
out.push({ i, s });
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (true !== el?.isMap) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const of = el.peg.of;
|
|
117
|
+
if (true === of?.isList) {
|
|
118
|
+
of.peg.forEach((p, j) => {
|
|
119
|
+
const ps = textOf(p);
|
|
120
|
+
if (undefined !== ps) {
|
|
121
|
+
out.push({ i, of: j, s: ps });
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
const ts = textOf(el.peg.text);
|
|
126
|
+
if (undefined !== ts) {
|
|
127
|
+
out.push({ i, text: true, s: ts });
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
return out;
|
|
131
|
+
}
|
|
132
|
+
// D3's two static checks, on the template alone and before any node:
|
|
133
|
+
// a key inside another is ambiguous whatever the order
|
|
134
|
+
// (replace_overlap), and a key no literal holds means the template
|
|
135
|
+
// drifted from its map (replace_unused). Keys are visited in code
|
|
136
|
+
// point order, so both ports name the same pair.
|
|
137
|
+
function checkReplace(keys, lits) {
|
|
138
|
+
const sorted = [...keys].sort(keyorder_1.cmpCodePoint);
|
|
139
|
+
for (const a of sorted) {
|
|
140
|
+
for (const b of sorted) {
|
|
141
|
+
if (a !== b && b.includes(a)) {
|
|
142
|
+
return { code: 'replace_overlap', details: { key: quoted(a), other: quoted(b) } };
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
for (const k of sorted) {
|
|
147
|
+
if ('' === k || !lits.some((l) => l.s.includes(k))) {
|
|
148
|
+
return { code: 'replace_unused', details: { key: quoted(k) } };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
// D3's first two rules as one scan: at each position the longest key
|
|
154
|
+
// that matches is taken and its value written out whole, and the scan
|
|
155
|
+
// moves past the KEY -- the value is never looked at again, so no
|
|
156
|
+
// value can introduce a key.
|
|
157
|
+
function substitute(text, pairs) {
|
|
158
|
+
let out = '';
|
|
159
|
+
let i = 0;
|
|
160
|
+
while (i < text.length) {
|
|
161
|
+
const hit = pairs.find((p) => text.startsWith(p[0], i));
|
|
162
|
+
if (undefined === hit) {
|
|
163
|
+
out += text[i];
|
|
164
|
+
i += 1;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
out += hit[1];
|
|
168
|
+
i += hit[0].length;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return out;
|
|
172
|
+
}
|
|
173
|
+
// The instance with the template's literal text at element `i`
|
|
174
|
+
// rewritten through the pairs -- on the fresh instance, where the
|
|
175
|
+
// structure is exactly the template's, and before any binding, so a
|
|
176
|
+
// value written in is never scanned again and a spliced result is
|
|
177
|
+
// never touched.
|
|
178
|
+
function substituted(inst, i, lits, pairs, ctx) {
|
|
179
|
+
for (const l of lits) {
|
|
180
|
+
if (l.i !== i) {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
const sv = new StringVal_1.StringVal({ peg: substitute(l.s, pairs) }, ctx);
|
|
184
|
+
if (undefined !== l.of) {
|
|
185
|
+
inst.peg.of.peg[l.of] = sv;
|
|
186
|
+
}
|
|
187
|
+
else if (true === l.text) {
|
|
188
|
+
inst.peg.text = sv;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
inst = sv;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return inst;
|
|
195
|
+
}
|
|
196
|
+
// A key as the message writes it, quoted so an empty key is visible.
|
|
197
|
+
function quoted(s) {
|
|
198
|
+
return '"' + s + '"';
|
|
199
|
+
}
|
|
200
|
+
function unpref(v) {
|
|
201
|
+
while (true === v.isPref) {
|
|
202
|
+
v = v.peg;
|
|
203
|
+
}
|
|
204
|
+
return v;
|
|
205
|
+
}
|
|
206
|
+
// Every relative reference in `v` replaced by the field of `node` it
|
|
207
|
+
// names. Answers `v` unchanged when it holds none, so a body with no
|
|
208
|
+
// substitutions is never needlessly rebuilt -- the identity test
|
|
209
|
+
// `fillPlace` already relies on.
|
|
210
|
+
function bindNode(v, node, ctx, fail) {
|
|
211
|
+
if (true === v?.isRef && true !== v.absolute) {
|
|
212
|
+
const found = nodeField(v, node);
|
|
213
|
+
if (undefined === found) {
|
|
214
|
+
fail.ref = undefined === fail.ref ? v.canon : fail.ref;
|
|
215
|
+
return v;
|
|
216
|
+
}
|
|
217
|
+
const out = found.clone(ctx);
|
|
218
|
+
// A RELATIVE REFERENCE IS A READ TOO (RENDER.0.md P7), and the one
|
|
219
|
+
// read no reference resolution sees: the binding answers it here,
|
|
220
|
+
// from the matched node, rather than letting a path resolve at a
|
|
221
|
+
// position the body never occupies. Without this a nested rule set
|
|
222
|
+
// whose selection is `.handlers` reported its nodes at the address
|
|
223
|
+
// they came to rest, which is in the OUTPUT. A node carries an
|
|
224
|
+
// address only under an instrumented run, which is what makes the
|
|
225
|
+
// second test the whole guard.
|
|
226
|
+
if (null == out.origin && null != node.origin) {
|
|
227
|
+
;
|
|
228
|
+
out.origin = node.origin +
|
|
229
|
+
v.peg.map((seg) => '.' + seg).join('');
|
|
230
|
+
}
|
|
231
|
+
return out;
|
|
232
|
+
}
|
|
233
|
+
const peg = v?.peg;
|
|
234
|
+
const bound = (0, PlaceVal_1.boundArgStart)(v);
|
|
235
|
+
if (Array.isArray(peg)) {
|
|
236
|
+
let changed = false;
|
|
237
|
+
const out = peg.map((c, cI) => {
|
|
238
|
+
if (true !== c?.isVal || bound <= cI) {
|
|
239
|
+
return c;
|
|
240
|
+
}
|
|
241
|
+
const b = bindNode(c, node, ctx, fail);
|
|
242
|
+
changed = changed || b !== c;
|
|
243
|
+
return b;
|
|
244
|
+
});
|
|
245
|
+
return changed ? (0, PlaceVal_1.rebuild)(v, out, ctx) : v;
|
|
246
|
+
}
|
|
247
|
+
if (true === peg?.isVal) {
|
|
248
|
+
const b = bindNode(peg, node, ctx, fail);
|
|
249
|
+
return b === peg ? v : (0, PlaceVal_1.rebuild)(v, b, ctx);
|
|
250
|
+
}
|
|
251
|
+
if (null != peg && 'object' === typeof peg) {
|
|
252
|
+
let changed = false;
|
|
253
|
+
const out = {};
|
|
254
|
+
for (const k of Object.keys(peg)) {
|
|
255
|
+
const c = peg[k];
|
|
256
|
+
// No isVal guard, for the reason fillPlace gives: a slot holding
|
|
257
|
+
// something that is not a Val answers itself, because the tests
|
|
258
|
+
// above -- is it a reference, has it a peg -- are both false for
|
|
259
|
+
// one.
|
|
260
|
+
const b = bindNode(c, node, ctx, fail);
|
|
261
|
+
changed = changed || b !== c;
|
|
262
|
+
out[k] = b;
|
|
263
|
+
}
|
|
264
|
+
return changed ? (0, PlaceVal_1.rebuild)(v, out, ctx) : v;
|
|
265
|
+
}
|
|
266
|
+
return v;
|
|
267
|
+
}
|
|
268
|
+
// The field of `node` a reference names, or undefined when it names
|
|
269
|
+
// none. Only a chain of plain NAMES is a field: a parent step has no
|
|
270
|
+
// answer at a node that is an origin rather than a position, and a
|
|
271
|
+
// variable segment is not a name until something resolves it -- both
|
|
272
|
+
// are refused here rather than left to resolve somewhere else, which
|
|
273
|
+
// is the failure mode the binding exists to remove.
|
|
274
|
+
function nodeField(ref, node) {
|
|
275
|
+
let cur = node;
|
|
276
|
+
for (const seg of ref.peg) {
|
|
277
|
+
if ('string' !== typeof seg || '.' === seg) {
|
|
278
|
+
return undefined;
|
|
279
|
+
}
|
|
280
|
+
const peg = cur?.peg;
|
|
281
|
+
if (true !== cur?.isBag || null == peg) {
|
|
282
|
+
return undefined;
|
|
283
|
+
}
|
|
284
|
+
cur = true === cur.isList ? peg[Number(seg)] : peg[seg];
|
|
285
|
+
if (true !== cur?.isVal) {
|
|
286
|
+
return undefined;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return cur;
|
|
290
|
+
}
|
|
291
|
+
// The address of one matched node: its own read address when it has
|
|
292
|
+
// one, else the SELECTION's read address and the node's key under it
|
|
293
|
+
// -- a selection is read once and walked, so its members carry no read
|
|
294
|
+
// of their own.
|
|
295
|
+
//
|
|
296
|
+
// A COMPUTED SELECTION HAS NO ADDRESS, AND THE TRACE SAYS SO: an empty
|
|
297
|
+
// node. `filter(...)` builds a bag no path in the document names, and
|
|
298
|
+
// the only other thing to report is where the bag came to REST -- a
|
|
299
|
+
// position inside a template instance, which is not in the document,
|
|
300
|
+
// and which the two ports number differently. Publishing that would
|
|
301
|
+
// have made the trace a parity break as well as a fiction. The rule
|
|
302
|
+
// address answers the same way: `<table>#<index>` for a table a
|
|
303
|
+
// reference reached, and `#<index>` alone for one written inline at the
|
|
304
|
+
// call site, which has no address of its own. `#` is in no path, so a
|
|
305
|
+
// rule's address can never be read as one.
|
|
306
|
+
function nodeAddr(sel, key, node) {
|
|
307
|
+
if (null != node.origin) {
|
|
308
|
+
return node.origin;
|
|
309
|
+
}
|
|
310
|
+
return undefined === sel ? '' : sel + '.' + key;
|
|
311
|
+
}
|
|
312
|
+
// A body element that is itself a list splices, which is what makes a
|
|
313
|
+
// nested emit compose into one flat sequence.
|
|
314
|
+
function splice(v, out) {
|
|
315
|
+
if (true === v?.isList) {
|
|
316
|
+
for (const el of v.peg) {
|
|
317
|
+
splice(el, out);
|
|
318
|
+
}
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
out.push(v);
|
|
322
|
+
}
|
|
323
|
+
class EmitFuncVal extends FuncBaseVal_1.FuncBaseVal {
|
|
324
|
+
constructor(spec, ctx) {
|
|
325
|
+
super(spec, ctx);
|
|
326
|
+
this.isEmitFunc = true;
|
|
327
|
+
// THE STAGING RULE (G8 phase 0, see AontuContext.settle). The
|
|
328
|
+
// selection is not settled merely by being `done` once -- a sibling
|
|
329
|
+
// conjunct, an include or a spread can still merge nodes into it,
|
|
330
|
+
// and pieces emitted from the half-merged bag would be missing.
|
|
331
|
+
this.staged = true;
|
|
332
|
+
}
|
|
333
|
+
funcname() {
|
|
334
|
+
return 'emit';
|
|
335
|
+
}
|
|
336
|
+
// NEITHER ARGUMENT IS DRIVEN BY THE BASE. The selection is driven by
|
|
337
|
+
// hand below; the TABLE is not driven at all, because a body is a
|
|
338
|
+
// template and driving it would resolve its references at the call
|
|
339
|
+
// site -- the one position a body is never used at.
|
|
340
|
+
prepare(_ctx, _args) {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
unify(peer, ctx) {
|
|
344
|
+
// ONE argument is driven: the selection. The table holds bodies,
|
|
345
|
+
// which are templates (see prepare above).
|
|
346
|
+
if (!this.stagedReady(peer, ctx, 1)) {
|
|
347
|
+
return this.residuate(peer, ctx);
|
|
348
|
+
}
|
|
349
|
+
return super.unify(peer, ctx);
|
|
350
|
+
}
|
|
351
|
+
resolve(ctx, args) {
|
|
352
|
+
// THE MEMBERS WITH THEIR KEYS, read through the one helper every
|
|
353
|
+
// fold reads a bag by (./members.ts): source order for a list,
|
|
354
|
+
// sorted-key order for a map, a hidden child and an unfilled
|
|
355
|
+
// optional left out. The KEY is what the trace addresses a node by
|
|
356
|
+
// -- it is the node's key IN THE SELECTION, which is the only
|
|
357
|
+
// thing a walk of a computed bag knows about where a node sits.
|
|
358
|
+
const nodes = (0, members_1.bagMembers)(args?.[0], ctx);
|
|
359
|
+
if (undefined === nodes) {
|
|
360
|
+
return (0, err_1.makeNilErr)(ctx, 'emit_data', this);
|
|
361
|
+
}
|
|
362
|
+
// A NAMED TABLE IS REACHED BY REFERENCE, and the reference -- not
|
|
363
|
+
// the table -- is what is followed. Followed HERE rather than in
|
|
364
|
+
// the staged drive, which waits for a SETTLED target: a table is a
|
|
365
|
+
// template, a template holding a hole never settles, and waiting
|
|
366
|
+
// for one would mean the dispatch never fires.
|
|
367
|
+
let table = args?.[1];
|
|
368
|
+
if (true === table?.isRef) {
|
|
369
|
+
table = table.unify((0, top_1.top)(), ctx);
|
|
370
|
+
}
|
|
371
|
+
const templates = tableTemplates(table);
|
|
372
|
+
if (isRefusal(templates)) {
|
|
373
|
+
return this.refuse(ctx, templates);
|
|
374
|
+
}
|
|
375
|
+
// THE TRACE'S TWO ADDRESSES (RENDER.0.md D11, P7), computed once
|
|
376
|
+
// per dispatch and only when the run is instrumented: the table's
|
|
377
|
+
// own, which every rule of it is numbered under, and the
|
|
378
|
+
// selection's, which every node of it is keyed under.
|
|
379
|
+
const rec = undefined !== ctx.reads;
|
|
380
|
+
const tableAddr = rec ? (table?.origin ?? '') : '';
|
|
381
|
+
const selAddr = rec ? args?.[0]?.origin : undefined;
|
|
382
|
+
const peg = [];
|
|
383
|
+
for (const member of nodes) {
|
|
384
|
+
const node = member.val;
|
|
385
|
+
const tmpl = this.dispatch(ctx, node, templates);
|
|
386
|
+
if ('string' === typeof tmpl) {
|
|
387
|
+
return (0, err_1.makeNilErr)(ctx, 'emit_none', this, undefined, 'resolve', {
|
|
388
|
+
value: node.canon,
|
|
389
|
+
tried: tmpl,
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
const fail = {};
|
|
393
|
+
let mark = undefined;
|
|
394
|
+
if (rec) {
|
|
395
|
+
// THE NODE KEEPS ITS ADDRESS (P7). A body passes the node on
|
|
396
|
+
// through `_`, and a nested rule set dispatching over it can
|
|
397
|
+
// then say where it came from -- otherwise the node arrives as
|
|
398
|
+
// an element of a list the body wrote, and the only address
|
|
399
|
+
// left is where that list came to rest.
|
|
400
|
+
const naddr = nodeAddr(selAddr, member.key, node);
|
|
401
|
+
if ('' !== naddr && null == node.origin) {
|
|
402
|
+
;
|
|
403
|
+
node.origin = naddr;
|
|
404
|
+
}
|
|
405
|
+
mark = { node: naddr, rule: tableAddr + '#' + tmpl.idx };
|
|
406
|
+
}
|
|
407
|
+
this.instantiate(ctx, node, tmpl, peg, fail, mark);
|
|
408
|
+
if (undefined !== fail.ref) {
|
|
409
|
+
return (0, err_1.makeNilErr)(ctx, 'emit_ref', this, undefined, 'resolve', {
|
|
410
|
+
ref: fail.ref,
|
|
411
|
+
value: node.canon,
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
if (undefined !== fail.code) {
|
|
415
|
+
return this.refuse(ctx, { code: fail.code, details: fail.details });
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
// THE PIECES ARE PATHED WHERE THEY LAND, once the splicing has
|
|
419
|
+
// settled how many there are. A piece keeps no trace of the body
|
|
420
|
+
// it was written in: the body is a template, and a template's
|
|
421
|
+
// parse position is the one place it is never used.
|
|
422
|
+
for (let i = 0; i < peg.length; i++) {
|
|
423
|
+
(0, Val_1.repathInstance)(peg[i], [...ctx.path, String(i)]);
|
|
424
|
+
}
|
|
425
|
+
return new ListVal_1.ListVal({ peg }, ctx);
|
|
426
|
+
}
|
|
427
|
+
// The located error for a refusal, with the message's details when
|
|
428
|
+
// the refusal carries them.
|
|
429
|
+
refuse(ctx, r) {
|
|
430
|
+
return undefined === r.details ? (0, err_1.makeNilErr)(ctx, r.code, this)
|
|
431
|
+
: (0, err_1.makeNilErr)(ctx, r.code, this, undefined, 'resolve', r.details);
|
|
432
|
+
}
|
|
433
|
+
// First match wins, in table order, by unifiability -- the same
|
|
434
|
+
// question `match` and `filter` ask, answered the same way. Returns
|
|
435
|
+
// the patterns tried when nothing matched, for the located error.
|
|
436
|
+
dispatch(ctx, node, templates) {
|
|
437
|
+
const tried = [];
|
|
438
|
+
for (const tmpl of templates) {
|
|
439
|
+
tried.push(tmpl.match.canon);
|
|
440
|
+
// The trial is against CLONES: `unite` refines a bag in place
|
|
441
|
+
// against a TOP peer, and a pattern that failed must be untouched
|
|
442
|
+
// for the next node.
|
|
443
|
+
if (undefined !== (0, FuncBaseVal_1.trialUnify)(ctx, node.clone(ctx), tmpl.match.clone(ctx))) {
|
|
444
|
+
return tmpl;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return tried.join(' ');
|
|
448
|
+
}
|
|
449
|
+
// The replacement pairs for one node: the template's `replace` map
|
|
450
|
+
// instantiated at the node -- bound, filled and driven as a body is
|
|
451
|
+
// -- each value as text by the one number-to-text rule (`plusText`,
|
|
452
|
+
// the rule `+` and `join` share), escaped by the template's
|
|
453
|
+
// convention unless that is `none`, and sorted longest key first so
|
|
454
|
+
// the scan takes the longest match at every position (D3's first
|
|
455
|
+
// rule). A value that is not text, or has not settled, is
|
|
456
|
+
// replace_value.
|
|
457
|
+
replacements(ctx, node, tmpl, fail) {
|
|
458
|
+
if (undefined === tmpl.replace) {
|
|
459
|
+
return undefined;
|
|
460
|
+
}
|
|
461
|
+
let inst = tmpl.replace.clone(ctx, { dup: true });
|
|
462
|
+
inst = (0, PlaceVal_1.fillPlace)(bindNode(inst, node, ctx, fail), node, ctx);
|
|
463
|
+
if (!inst.done) {
|
|
464
|
+
inst = (0, unify_1.unite)(ctx, inst, (0, top_1.top)(), 'emit');
|
|
465
|
+
}
|
|
466
|
+
const pairs = [];
|
|
467
|
+
for (const key of Object.keys(inst.peg)) {
|
|
468
|
+
const v = unpref(inst.peg[key]);
|
|
469
|
+
const text = (0, PlusOpVal_1.plusText)(v);
|
|
470
|
+
if (undefined === text) {
|
|
471
|
+
fail.code = 'replace_value';
|
|
472
|
+
fail.details = { key: quoted(key), value: String(v?.canon) };
|
|
473
|
+
return undefined;
|
|
474
|
+
}
|
|
475
|
+
pairs.push([key, 'none' === tmpl.esc ? text : (0, escape_1.escapeText)(text, tmpl.esc)]);
|
|
476
|
+
}
|
|
477
|
+
pairs.sort((a, b) => b[0].length - a[0].length || (0, keyorder_1.cmpCodePoint)(a[0], b[0]));
|
|
478
|
+
return pairs;
|
|
479
|
+
}
|
|
480
|
+
// Instantiate one body at the node and SPLICE its pieces into the
|
|
481
|
+
// output. A full instance to the leaves (`dup`, ADR-005), because a
|
|
482
|
+
// bare clone shares the inner structure of any call in the body and
|
|
483
|
+
// the first node's resolution would answer for every node; the
|
|
484
|
+
// template's replacements written into the instance's literal text;
|
|
485
|
+
// then the two bindings, relative references and the hole, both to
|
|
486
|
+
// the node.
|
|
487
|
+
instantiate(ctx, node, tmpl, out, fail, mark) {
|
|
488
|
+
const pairs = this.replacements(ctx, node, tmpl, fail);
|
|
489
|
+
if (undefined !== fail.code) {
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
const elems = tmpl.body.peg;
|
|
493
|
+
for (let i = 0; i < elems.length; i++) {
|
|
494
|
+
const elctx = ctx.descend(String(out.length));
|
|
495
|
+
let inst = elems[i].clone(elctx, { dup: true });
|
|
496
|
+
if (undefined !== pairs) {
|
|
497
|
+
inst = substituted(inst, i, tmpl.lits, pairs, elctx);
|
|
498
|
+
}
|
|
499
|
+
let piece = (0, PlaceVal_1.fillPlace)(bindNode(inst, node, elctx, fail), node, elctx);
|
|
500
|
+
// A NESTED DISPATCH IS DRIVEN HERE, not left for the next pass.
|
|
501
|
+
// Its selection is bound and the model has settled, so it has
|
|
502
|
+
// everything it needs -- and it must answer NOW, because what
|
|
503
|
+
// makes the result flat is splicing its pieces into this one.
|
|
504
|
+
// Left standing, a nested `emit` resolved a pass later, as a
|
|
505
|
+
// list INSIDE the list, and the fragment algebra is flat.
|
|
506
|
+
// Through `unite` rather than by hand: a rule set that walks
|
|
507
|
+
// into itself for ever is charged to the depth budget and
|
|
508
|
+
// refused as `unify_cycle`, like any other runaway descent.
|
|
509
|
+
if (!piece.done) {
|
|
510
|
+
piece = (0, unify_1.unite)(elctx, piece, (0, top_1.top)(), 'emit');
|
|
511
|
+
}
|
|
512
|
+
// THE INNERMOST DISPATCH OWNS THE PIECE (P7). A body element
|
|
513
|
+
// that is a nested rule set has already stamped what it emitted,
|
|
514
|
+
// and those pieces are spliced into this result here: the rule
|
|
515
|
+
// that WROTE a line is the one the trace names, so a stamp is
|
|
516
|
+
// written only where there is none.
|
|
517
|
+
const at = out.length;
|
|
518
|
+
splice(piece, out);
|
|
519
|
+
if (undefined !== mark) {
|
|
520
|
+
for (let k = at; k < out.length; k++) {
|
|
521
|
+
if (null == out[k].emitted) {
|
|
522
|
+
;
|
|
523
|
+
out[k].emitted = mark;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
} /* node:coverage ignore next 6 */
|
|
530
|
+
exports.EmitFuncVal = EmitFuncVal;
|
|
531
|
+
//# sourceMappingURL=EmitFuncVal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmitFuncVal.js","sourceRoot":"","sources":["../../src/val/EmitFuncVal.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AA6FpD,oCAAgC;AAChC,gCAAmC;AACnC,sCAAoD;AACpD,0CAA0C;AAC1C,+BAA2B;AAC3B,uCAAmC;AACnC,2CAAuC;AACvC,+CAAuD;AACvD,+BAAsC;AAEtC,yCAA8D;AAC9D,2CAAsC;AACtC,uCAAsC;AAkCtC,SAAS,SAAS,CAAC,CAAM;IACvB,OAAO,QAAQ,KAAK,OAAO,CAAC,CAAC,IAAI,CAAA;AACnC,CAAC;AAGD,sEAAsE;AACtE,oEAAoE;AACpE,4BAA4B;AAC5B,SAAS,cAAc,CAAC,KAAsB;IAC5C,MAAM,CAAC,GAAQ,KAAK,CAAA;IAEpB,mEAAmE;IACnE,qEAAqE;IACrE,mEAAmE;IACnE,qEAAqE;IACrE,6DAA6D;IAC7D,oEAAoE;IACpE,mEAAmE;IACnE,mEAAmE;IACnE,kDAAkD;IAClD,IAAI,IAAI,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;QAC3B,OAAO,cAAc,CAAC,CAAC,CAAC,G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EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;YAErE,gEAAgE;YAChE,8DAA8D;YAC9D,8DAA8D;YAC9D,8DAA8D;YAC9D,6DAA6D;YAC7D,0DAA0D;YAC1D,6DAA6D;YAC7D,0DAA0D;YAC1D,4DAA4D;YAC5D,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;gBAChB,KAAK,GAAG,IAAA,aAAK,EAAC,KAAK,EAAE,KAAK,EAAE,IAAA,SAAG,GAAE,EAAE,MAAM,CAAC,CAAA;YAC5C,CAAC;YAED,6DAA6D;YAC7D,iEAAiE;YACjE,+DAA+D;YAC/D,8DAA8D;YAC9D,oCAAoC;YACpC,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAA;YACrB,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;YAClB,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;gBACvB,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBACrC,IAAI,IAAI,IAAK,GAAG,CAAC,CAAC,CAAS,CAAC,OAAO,EAAE,CAAC;wBACpC,CAAC;wBAAE,GAAG,CAAC,CAAC,CAAS,CAAC,OAAO,GAAG,IAAI,CAAA;oBAClC,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CAEF,CAAC,iCAAiC;QAIjC,WAAW"}
|
|
@@ -8,6 +8,7 @@ const ListVal_1 = require("./ListVal");
|
|
|
8
8
|
const FuncBaseVal_1 = require("./FuncBaseVal");
|
|
9
9
|
const Val_1 = require("./Val");
|
|
10
10
|
const PlaceVal_1 = require("./PlaceVal");
|
|
11
|
+
const members_1 = require("./members");
|
|
11
12
|
class FilterFuncVal extends FuncBaseVal_1.FuncBaseVal {
|
|
12
13
|
constructor(spec, ctx) {
|
|
13
14
|
super(spec, ctx);
|
|
@@ -32,8 +33,7 @@ class FilterFuncVal extends FuncBaseVal_1.FuncBaseVal {
|
|
|
32
33
|
return null;
|
|
33
34
|
}
|
|
34
35
|
unify(peer, ctx) {
|
|
35
|
-
|
|
36
|
-
if (!ready || !ctx.settle) {
|
|
36
|
+
if (!this.stagedReady(peer, ctx, 1)) {
|
|
37
37
|
return this.residuate(peer, ctx);
|
|
38
38
|
}
|
|
39
39
|
return super.unify(peer, ctx);
|
|
@@ -60,19 +60,22 @@ class FilterFuncVal extends FuncBaseVal_1.FuncBaseVal {
|
|
|
60
60
|
const met = (0, FuncBaseVal_1.trialUnify)(kctx, child.clone(kctx), test);
|
|
61
61
|
return undefined !== met && met.canon === child.canon;
|
|
62
62
|
};
|
|
63
|
+
// The candidates are the bag's MEMBERS -- what generation would
|
|
64
|
+
// emit (./members.ts, BUGS.md §79) -- so a hidden child is never
|
|
65
|
+
// selected into the result.
|
|
63
66
|
if (true === data?.isMap) {
|
|
64
67
|
const peg = {};
|
|
65
|
-
for (const key of
|
|
68
|
+
for (const { key, val } of (0, members_1.bagMembers)(data, ctx)) {
|
|
66
69
|
const kctx = ctx.descend(key);
|
|
67
|
-
if (keeps(
|
|
68
|
-
peg[key] =
|
|
70
|
+
if (keeps(val, kctx)) {
|
|
71
|
+
peg[key] = val.clone(kctx);
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
return new MapVal_1.MapVal({ peg }, ctx);
|
|
72
75
|
}
|
|
73
76
|
if (true === data?.isList) {
|
|
74
77
|
const peg = [];
|
|
75
|
-
for (const el of
|
|
78
|
+
for (const { val: el } of (0, members_1.bagMembers)(data, ctx)) {
|
|
76
79
|
// The element context is the position it will END UP at, which
|
|
77
80
|
// is its index in the RESULT: dropping the third of five moves
|
|
78
81
|
// the fourth up, and a kept element must be pathed where it
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterFuncVal.js","sourceRoot":"","sources":["../../src/val/FilterFuncVal.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AA0CpD,gCA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ED,IAAI,IAAI,KAAK,IAAI,EAAE,MAAM,EAAE,CAAC;YAC1B,MAAM,GAAG,GAAU,EAAE,CAAA;YACrB,KAAK,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,IAAA,oBAAU,EAAC,IAAI,EAAE,GAAG,CAAa,EAAE,CAAC;gBAC5D,+DAA+D;gBAC/D,+DAA+D;gBAC/D,4DAA4D;gBAC5D,wCAAwC;gBACxC,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;gBAC5C,IAAI,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;oBACpB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;gBAC1B,CAAC;YACH,CAAC;YACD,OAAO,IAAI,iBAAO,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,CAAC,CAAA;QAClC,CAAC;QAED,OAAO,IAAA,gBAAU,EAAC,GAAG,EAAE,aAAa,EAAE,IAAI,CAAC,CAAA;IAC7C,CAAC;CAEF,CAAC,iCAAiC;QAIjC,aAAa"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Val, ValSpec } from '../type';
|
|
2
|
+
import { AontuContext } from '../ctx';
|
|
3
|
+
import { ListVal } from './ListVal';
|
|
4
|
+
import { FuncBaseVal } from './FuncBaseVal';
|
|
5
|
+
declare class FormFuncVal extends FuncBaseVal {
|
|
6
|
+
isFormFunc: boolean;
|
|
7
|
+
staged: boolean;
|
|
8
|
+
constructor(spec: ValSpec, ctx?: AontuContext);
|
|
9
|
+
funcname(): string;
|
|
10
|
+
prepare(_ctx: AontuContext, _args: Val[]): null;
|
|
11
|
+
unify(peer: Val, ctx: AontuContext): Val;
|
|
12
|
+
resolve(ctx: AontuContext, args: Val[]): ListVal | import("./NilVal").NilVal;
|
|
13
|
+
}
|
|
14
|
+
export { FormFuncVal, };
|