aontu 0.52.1 → 0.54.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 +88 -0
- package/bin/aontu-mcp.js +4 -0
- package/dist/agentsmd.d.ts +16 -0
- package/dist/agentsmd.js +107 -0
- package/dist/agentsmd.js.map +1 -0
- package/dist/aontu.d.ts +15 -3
- package/dist/aontu.js +126 -5
- package/dist/aontu.js.map +1 -1
- package/dist/cli.d.ts +45 -1
- package/dist/cli.js +2845 -69
- package/dist/cli.js.map +1 -1
- package/dist/ctx.d.ts +18 -0
- package/dist/ctx.js +44 -0
- package/dist/ctx.js.map +1 -1
- package/dist/diff.d.ts +22 -0
- package/dist/diff.js +141 -0
- package/dist/diff.js.map +1 -0
- package/dist/err.d.ts +3 -1
- package/dist/err.js +45 -8
- package/dist/err.js.map +1 -1
- package/dist/graph.d.ts +13 -0
- package/dist/graph.js +110 -0
- package/dist/graph.js.map +1 -0
- package/dist/hcanon.d.ts +3 -0
- package/dist/hcanon.js +145 -0
- package/dist/hcanon.js.map +1 -0
- package/dist/hints.js +235 -8
- package/dist/hints.js.map +1 -1
- package/dist/jsonschema.d.ts +20 -0
- package/dist/jsonschema.js +425 -0
- package/dist/jsonschema.js.map +1 -0
- package/dist/lang.js +955 -110
- package/dist/lang.js.map +1 -1
- package/dist/lsp.d.ts +9 -2
- package/dist/lsp.js +343 -48
- package/dist/lsp.js.map +1 -1
- package/dist/mcp-server.d.ts +20 -0
- package/dist/mcp-server.js +147 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/mcp.d.ts +42 -0
- package/dist/mcp.js +941 -0
- package/dist/mcp.js.map +1 -0
- package/dist/mod-tool.d.ts +58 -0
- package/dist/mod-tool.js +532 -0
- package/dist/mod-tool.js.map +1 -0
- package/dist/mod.d.ts +35 -0
- package/dist/mod.js +345 -0
- package/dist/mod.js.map +1 -0
- package/dist/patch.d.ts +49 -0
- package/dist/patch.js +506 -0
- package/dist/patch.js.map +1 -0
- package/dist/provenance.d.ts +41 -0
- package/dist/provenance.js +336 -0
- package/dist/provenance.js.map +1 -0
- package/dist/query.d.ts +27 -0
- package/dist/query.js +294 -0
- package/dist/query.js.map +1 -0
- package/dist/reach.d.ts +15 -0
- package/dist/reach.js +168 -0
- package/dist/reach.js.map +1 -0
- package/dist/relation.d.ts +23 -0
- package/dist/relation.js +230 -0
- package/dist/relation.js.map +1 -0
- package/dist/report-sarif.d.ts +14 -0
- package/dist/report-sarif.js +102 -0
- package/dist/report-sarif.js.map +1 -0
- package/dist/sig.d.ts +25 -0
- package/dist/sig.js +277 -0
- package/dist/sig.js.map +1 -0
- package/dist/sigdecl.d.ts +2 -0
- package/dist/sigdecl.js +11 -0
- package/dist/sigdecl.js.map +1 -0
- package/dist/siggate.d.ts +4 -0
- package/dist/siggate.js +90 -0
- package/dist/siggate.js.map +1 -0
- package/dist/site.d.ts +4 -0
- package/dist/site.js +31 -0
- package/dist/site.js.map +1 -1
- package/dist/std.d.ts +1 -0
- package/dist/std.js +129 -0
- package/dist/std.js.map +1 -0
- package/dist/subsume.d.ts +39 -0
- package/dist/subsume.js +573 -0
- package/dist/subsume.js.map +1 -0
- package/dist/trim.d.ts +19 -0
- package/dist/trim.js +155 -0
- package/dist/trim.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/type.d.ts +17 -1
- package/dist/type.js.map +1 -1
- package/dist/unify.d.ts +2 -1
- package/dist/unify.js +234 -38
- package/dist/unify.js.map +1 -1
- package/dist/utility.d.ts +8 -1
- package/dist/utility.js +68 -1
- package/dist/utility.js.map +1 -1
- package/dist/val/AggFuncVal.d.ts +44 -0
- package/dist/val/AggFuncVal.js +364 -0
- package/dist/val/AggFuncVal.js.map +1 -0
- package/dist/val/ArithFuncVal.d.ts +31 -0
- package/dist/val/ArithFuncVal.js +62 -0
- package/dist/val/ArithFuncVal.js.map +1 -0
- package/dist/val/BagVal.d.ts +7 -0
- package/dist/val/BagVal.js +150 -11
- package/dist/val/BagVal.js.map +1 -1
- package/dist/val/CloseFuncVal.js +9 -1
- package/dist/val/CloseFuncVal.js.map +1 -1
- package/dist/val/ConjunctVal.d.ts +1 -1
- package/dist/val/ConjunctVal.js +19 -0
- package/dist/val/ConjunctVal.js.map +1 -1
- package/dist/val/ConstraintVal.d.ts +7 -1
- package/dist/val/ConstraintVal.js +523 -45
- package/dist/val/ConstraintVal.js.map +1 -1
- package/dist/val/ContainerKindVal.d.ts +35 -0
- package/dist/val/ContainerKindVal.js +99 -0
- package/dist/val/ContainerKindVal.js.map +1 -0
- package/dist/val/CopyFuncVal.d.ts +1 -2
- package/dist/val/CopyFuncVal.js.map +1 -1
- package/dist/val/Decimal.d.ts +1 -0
- package/dist/val/Decimal.js +13 -0
- package/dist/val/Decimal.js.map +1 -1
- package/dist/val/DeprecateFuncVal.d.ts +11 -0
- package/dist/val/DeprecateFuncVal.js +47 -0
- package/dist/val/DeprecateFuncVal.js.map +1 -0
- package/dist/val/DisjunctVal.d.ts +1 -2
- package/dist/val/DisjunctVal.js +269 -53
- package/dist/val/DisjunctVal.js.map +1 -1
- package/dist/val/EachFuncVal.d.ts +15 -0
- package/dist/val/EachFuncVal.js +75 -0
- package/dist/val/EachFuncVal.js.map +1 -0
- package/dist/val/ExpectVal.js +62 -4
- package/dist/val/ExpectVal.js.map +1 -1
- package/dist/val/FeatureVal.js +1 -1
- package/dist/val/FeatureVal.js.map +1 -1
- package/dist/val/FilterFuncVal.d.ts +15 -0
- package/dist/val/FilterFuncVal.js +91 -0
- package/dist/val/FilterFuncVal.js.map +1 -0
- package/dist/val/FuncBaseVal.d.ts +7 -1
- package/dist/val/FuncBaseVal.js +183 -2
- package/dist/val/FuncBaseVal.js.map +1 -1
- package/dist/val/GraphAtomVal.d.ts +39 -0
- package/dist/val/GraphAtomVal.js +184 -0
- package/dist/val/GraphAtomVal.js.map +1 -0
- package/dist/val/HideFuncVal.js.map +1 -1
- package/dist/val/JunctionVal.js +24 -1
- package/dist/val/JunctionVal.js.map +1 -1
- package/dist/val/KeyFuncVal.d.ts +1 -1
- package/dist/val/KeyFuncVal.js +38 -30
- package/dist/val/KeyFuncVal.js.map +1 -1
- package/dist/val/ListVal.js +94 -14
- package/dist/val/ListVal.js.map +1 -1
- package/dist/val/LowerFuncVal.js.map +1 -1
- package/dist/val/MapVal.d.ts +1 -0
- package/dist/val/MapVal.js +146 -14
- package/dist/val/MapVal.js.map +1 -1
- package/dist/val/MatchFuncVal.d.ts +15 -0
- package/dist/val/MatchFuncVal.js +107 -0
- package/dist/val/MatchFuncVal.js.map +1 -0
- package/dist/val/MoveFuncVal.js.map +1 -1
- package/dist/val/NilVal.js +24 -0
- package/dist/val/NilVal.js.map +1 -1
- package/dist/val/OpBaseVal.d.ts +1 -1
- package/dist/val/OpBaseVal.js +19 -1
- package/dist/val/OpBaseVal.js.map +1 -1
- package/dist/val/OpenFuncVal.js +4 -1
- package/dist/val/OpenFuncVal.js.map +1 -1
- package/dist/val/PackFuncVal.d.ts +15 -0
- package/dist/val/PackFuncVal.js +108 -0
- package/dist/val/PackFuncVal.js.map +1 -0
- package/dist/val/PathFuncVal.d.ts +2 -2
- package/dist/val/PathFuncVal.js +75 -16
- package/dist/val/PathFuncVal.js.map +1 -1
- package/dist/val/PathVal.d.ts +25 -0
- package/dist/val/PathVal.js +150 -0
- package/dist/val/PathVal.js.map +1 -0
- package/dist/val/PlaceVal.d.ts +13 -0
- package/dist/val/PlaceVal.js +131 -0
- package/dist/val/PlaceVal.js.map +1 -0
- package/dist/val/PlusOpVal.d.ts +2 -1
- package/dist/val/PlusOpVal.js +61 -37
- package/dist/val/PlusOpVal.js.map +1 -1
- package/dist/val/PrefFuncVal.js.map +1 -1
- package/dist/val/PrefVal.d.ts +4 -2
- package/dist/val/PrefVal.js +223 -41
- package/dist/val/PrefVal.js.map +1 -1
- package/dist/val/RecurseVal.d.ts +19 -0
- package/dist/val/RecurseVal.js +217 -0
- package/dist/val/RecurseVal.js.map +1 -0
- package/dist/val/RefVal.d.ts +3 -2
- package/dist/val/RefVal.js +181 -66
- package/dist/val/RefVal.js.map +1 -1
- package/dist/val/ReferFuncVal.d.ts +59 -0
- package/dist/val/ReferFuncVal.js +604 -0
- package/dist/val/ReferFuncVal.js.map +1 -0
- package/dist/val/ScalarKindVal.d.ts +4 -3
- package/dist/val/ScalarKindVal.js +12 -12
- package/dist/val/ScalarKindVal.js.map +1 -1
- package/dist/val/SuperFuncVal.d.ts +4 -2
- package/dist/val/SuperFuncVal.js +118 -14
- package/dist/val/SuperFuncVal.js.map +1 -1
- package/dist/val/TopVal.d.ts +1 -1
- package/dist/val/TopVal.js.map +1 -1
- package/dist/val/TypeFuncVal.js.map +1 -1
- package/dist/val/UpperFuncVal.js.map +1 -1
- package/dist/val/Val.d.ts +7 -1
- package/dist/val/Val.js +170 -2
- package/dist/val/Val.js.map +1 -1
- package/dist/val/VarVal.js.map +1 -1
- package/dist/val/arith.d.ts +6 -0
- package/dist/val/arith.js +173 -0
- package/dist/val/arith.js.map +1 -0
- package/dist/vet.d.ts +45 -0
- package/dist/vet.js +802 -0
- package/dist/vet.js.map +1 -0
- package/dist/view.d.ts +85 -0
- package/dist/view.js +1948 -0
- package/dist/view.js.map +1 -0
- package/dist/walk.d.ts +2 -0
- package/dist/walk.js +91 -0
- package/dist/walk.js.map +1 -0
- package/grammar/aontu.gbnf +138 -0
- package/grammar/aontu.lark +118 -0
- package/grammar/aontu.tmLanguage.json +184 -0
- package/package.json +30 -8
- package/skill/SKILL.md +37 -0
- package/skill/error-codes.md +62 -0
- package/skill/examples.md +99 -0
- package/skill/grammar-card.md +56 -0
- package/src/agentsmd.ts +135 -0
- package/src/aontu.ts +166 -5
- package/src/cli.ts +3324 -72
- package/src/ctx.ts +93 -1
- package/src/diff.ts +198 -0
- package/src/err.ts +50 -8
- package/src/graph.ts +185 -0
- package/src/hcanon.ts +167 -0
- package/src/hints.ts +291 -8
- package/src/jsonschema.ts +552 -0
- package/src/lang.ts +1049 -110
- package/src/lsp.ts +351 -49
- package/src/mcp-server.ts +187 -0
- package/src/mcp.ts +1130 -0
- package/src/mod-tool.ts +718 -0
- package/src/mod.ts +453 -0
- package/src/patch.ts +628 -0
- package/src/provenance.ts +437 -0
- package/src/query.ts +381 -0
- package/src/reach.ts +213 -0
- package/src/relation.ts +298 -0
- package/src/report-sarif.ts +137 -0
- package/src/sig.ts +345 -0
- package/src/sigdecl.ts +11 -0
- package/src/siggate.ts +144 -0
- package/src/site.ts +36 -1
- package/src/std.ts +131 -0
- package/src/subsume.ts +739 -0
- package/src/trim.ts +195 -0
- package/src/tsconfig.json +10 -4
- package/src/type.ts +51 -2
- package/src/unify.ts +253 -38
- package/src/utility.ts +79 -1
- package/src/val/AggFuncVal.ts +546 -0
- package/src/val/ArithFuncVal.ts +108 -0
- package/src/val/BagVal.ts +158 -12
- package/src/val/CloseFuncVal.ts +9 -1
- package/src/val/ConjunctVal.ts +20 -0
- package/src/val/ConstraintVal.ts +576 -48
- package/src/val/ContainerKindVal.ts +158 -0
- package/src/val/CopyFuncVal.ts +0 -1
- package/src/val/Decimal.ts +15 -0
- package/src/val/DeprecateFuncVal.ts +84 -0
- package/src/val/DisjunctVal.ts +282 -59
- package/src/val/EachFuncVal.ts +133 -0
- package/src/val/ExpectVal.ts +65 -8
- package/src/val/FeatureVal.ts +1 -1
- package/src/val/FilterFuncVal.ts +154 -0
- package/src/val/FuncBaseVal.ts +206 -2
- package/src/val/GraphAtomVal.ts +264 -0
- package/src/val/HideFuncVal.ts +0 -2
- package/src/val/JunctionVal.ts +24 -1
- package/src/val/KeyFuncVal.ts +39 -35
- package/src/val/ListVal.ts +101 -15
- package/src/val/LowerFuncVal.ts +0 -1
- package/src/val/MapVal.ts +153 -14
- package/src/val/MatchFuncVal.ts +176 -0
- package/src/val/MoveFuncVal.ts +0 -2
- package/src/val/NilVal.ts +25 -0
- package/src/val/OpBaseVal.ts +20 -1
- package/src/val/OpenFuncVal.ts +4 -2
- package/src/val/PackFuncVal.ts +175 -0
- package/src/val/PathFuncVal.ts +107 -20
- package/src/val/PathVal.ts +221 -0
- package/src/val/PlaceVal.ts +193 -0
- package/src/val/PlusOpVal.ts +67 -39
- package/src/val/PrefFuncVal.ts +0 -1
- package/src/val/PrefVal.ts +251 -60
- package/src/val/RecurseVal.ts +285 -0
- package/src/val/RefVal.ts +183 -78
- package/src/val/ReferFuncVal.ts +732 -0
- package/src/val/ScalarKindVal.ts +12 -13
- package/src/val/SuperFuncVal.ts +137 -13
- package/src/val/TopVal.ts +1 -2
- package/src/val/TypeFuncVal.ts +0 -2
- package/src/val/UpperFuncVal.ts +0 -1
- package/src/val/Val.ts +216 -4
- package/src/val/VarVal.ts +0 -1
- package/src/val/arith.ts +319 -0
- package/src/vet.ts +1025 -0
- package/src/view.ts +2563 -0
- package/src/walk.ts +99 -0
package/dist/val/ExpectVal.js
CHANGED
|
@@ -21,29 +21,87 @@ class ExpectVal extends FeatureVal_1.FeatureVal {
|
|
|
21
21
|
// canon reparsed into a document that accepts values the original
|
|
22
22
|
// rejects. A canon that silently drops a constraint is worse than one
|
|
23
23
|
// that fails to parse. Go's ExpectVal.Canon renders the same peg.
|
|
24
|
+
//
|
|
25
|
+
// Which is why `peg` is kept the WHOLE expectation as peers arrive
|
|
26
|
+
// (BUGS.md §48) rather than only what was first written: see unify.
|
|
24
27
|
get canon() { return this.peg.canon; }
|
|
25
28
|
constructor(spec, ctx) {
|
|
26
29
|
super(spec, ctx);
|
|
27
30
|
this.isExpect = true;
|
|
28
31
|
}
|
|
32
|
+
// PURE, deliberately (the unequal-spread crosswire, BUGS.md §6-§7).
|
|
33
|
+
// The old body accumulated `this.peer` IN PLACE, which was invisible
|
|
34
|
+
// while an expectation only ever lived at one destination -- but the
|
|
35
|
+
// spread-combination meet (MapVal.unify's 'map-self' unite) bakes an
|
|
36
|
+
// ExpectVal INTO the combined template, and a path-independent
|
|
37
|
+
// template is SHARED across every destination (spreadClone tier 1).
|
|
38
|
+
// One stateful node in a shared template unified each sibling's own
|
|
39
|
+
// data with the next sibling's ($.w.y.r: "Cannot unify value: 6 with
|
|
40
|
+
// value: 5", both values sibling data). An expectation now answers
|
|
41
|
+
// with a NEW node when it must keep accumulated state, so a shared
|
|
42
|
+
// template's expect stays exactly what was written.
|
|
29
43
|
unify(peer, ctx) {
|
|
30
44
|
const te = ctx.explain && (0, utility_1.explainOpen)(ctx, ctx.explain, 'Expect', this, peer);
|
|
31
45
|
let out = this;
|
|
32
46
|
if (!peer.isTop) {
|
|
33
|
-
|
|
47
|
+
// THE PEER MEETS THE WHOLE EXPECTATION. `peg` already carries
|
|
48
|
+
// every peer met so far (see below), so meeting the incoming peer
|
|
49
|
+
// against the ACCUMULATED `peer` first -- as this did -- refused
|
|
50
|
+
// against only the atom that happened to reject. A conflict with
|
|
51
|
+
// `peg` is a conflict with the accumulation too, since peg
|
|
52
|
+
// subsumes it, so nothing stops being refused: only the sentence
|
|
53
|
+
// changes, to the residual the error's own hint promises
|
|
54
|
+
// (BUGS.md §48).
|
|
55
|
+
const peeru = (0, unify_1.unite)(te ? ctx.clone({ explain: (0, utility_1.ec)(te, 'EXPECT') }) : ctx, peer, this.peg, 'expect-self');
|
|
56
|
+
// Accumulated for the `expect` finding's operand. Computed BEFORE
|
|
57
|
+
// the escape below, where it has always been: an expectation that
|
|
58
|
+
// escapes still passed through here, and moving it after the
|
|
59
|
+
// escape leaves the accumulating arm reachable only by a node
|
|
60
|
+
// that both carries an accumulation AND fails to escape -- which
|
|
61
|
+
// the suite never produces, so it reads as dead code against the
|
|
62
|
+
// ADR-002 gate. Go's ExpectVal.Unify keeps the same order.
|
|
63
|
+
const acc = undefined === this.peer ? peer :
|
|
34
64
|
(0, unify_1.unite)(te ? ctx.clone({ explain: (0, utility_1.ec)(te, 'PEER') }) : ctx, this.peer, peer, 'expect-peer');
|
|
35
|
-
const peeru = (0, unify_1.unite)(te ? ctx.clone({ explain: (0, utility_1.ec)(te, 'EXPECT') }) : ctx, this.peer, this.peg, 'expect-self');
|
|
36
65
|
if (peeru.isGenable) {
|
|
37
66
|
out = peeru;
|
|
38
67
|
}
|
|
68
|
+
else {
|
|
69
|
+
// Still an expectation: carry the accumulated peer forward in a
|
|
70
|
+
// fresh node stored at THIS destination by the caller, leaving
|
|
71
|
+
// `this` -- possibly a shared template's child -- untouched.
|
|
72
|
+
//
|
|
73
|
+
// THE MEET IS THE NEW PEG (BUGS.md §48). An expectation that
|
|
74
|
+
// has met a peer without being freed by it stands for `peg &
|
|
75
|
+
// peer` from then on -- that is what a later peer must satisfy,
|
|
76
|
+
// and what canon has to state. Rebuilding from the ORIGINAL peg
|
|
77
|
+
// dropped the peer everywhere the node was later copied (the
|
|
78
|
+
// bag re-wrap, Val.clone), so `b:{z:1} b:{u8:min(0)}
|
|
79
|
+
// a:$.b.u8&max(15)` -- whose reference resolves a pass late, so
|
|
80
|
+
// `max(15)` arrives as a peer -- canoned as `min(0)`. That text
|
|
81
|
+
// reparses into a document admitting 20, which the original
|
|
82
|
+
// rejects, and hashed differently in each port. Storing the
|
|
83
|
+
// meet in `peg` needs no new field and no carrying: every copy
|
|
84
|
+
// site already preserves `peg`.
|
|
85
|
+
//
|
|
86
|
+
// Purity is untouched -- this is a NEW node, so a shared
|
|
87
|
+
// template's own expectation keeps the peg it was written with
|
|
88
|
+
// (§6-§7).
|
|
89
|
+
const e = new ExpectVal({ peg: peeru }, ctx);
|
|
90
|
+
e.key = this.key;
|
|
91
|
+
e.parent = this.parent;
|
|
92
|
+
e.peer = acc;
|
|
93
|
+
out = e;
|
|
94
|
+
}
|
|
39
95
|
}
|
|
40
96
|
out.dc = type_1.DONE;
|
|
41
97
|
ctx.explain && (0, utility_1.explainClose)(te, out);
|
|
42
98
|
return out;
|
|
43
99
|
}
|
|
44
100
|
gen(ctx) {
|
|
45
|
-
// Unresolved expect cannot be generated, so always an error.
|
|
46
|
-
|
|
101
|
+
// Unresolved expect cannot be generated, so always an error. The
|
|
102
|
+
// CALL is the point -- it records the failure on ctx -- and there
|
|
103
|
+
// is no value to bind: generation answers nothing.
|
|
104
|
+
(0, err_1.makeNilErr)(ctx, 'expect', this.peg, this.peer);
|
|
47
105
|
return undefined;
|
|
48
106
|
}
|
|
49
107
|
inspection(d) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpectVal.js","sourceRoot":"","sources":["../../src/val/ExpectVal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAOzD,kCAEgB;AAMhB,oCAAgC;AAEhC,
|
|
1
|
+
{"version":3,"file":"ExpectVal.js","sourceRoot":"","sources":["../../src/val/ExpectVal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAOzD,kCAEgB;AAMhB,oCAAgC;AAEhC,wCAImB;AAEnB,gCAAmC;AAGnC,6CAAyC;AAGzC,MAAM,SAAU,SAAQ,uBAAU;IAOhC,sEAAsE;IACtE,gEAAgE;IAChE,uEAAuE;IACvE,qEAAqE;IACrE,4BAA4B;IAC5B,EAAE;IACF,sEAAsE;IACtE,uEAAuE;IACvE,uEAAuE;IACvE,uEAAuE;IACvE,kEAAkE;IAClE,sEAAsE;IACtE,kEAAkE;IAClE,EAAE;IACF,mEAAmE;IACnE,oEAAoE;IACpE,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAA,CAAC,CAAC;IAErC,YACE,IAAa,EACb,GAAkB;QAElB,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QA5BlB,aAAQ,GAAG,IAAI,CAAA;IA6Bf,CAAC;IAED,oEAAoE;IACpE,qEAAqE;IACrE,qEAAqE;IACrE,qEAAqE;IACrE,+DAA+D;IAC/D,oEAAoE;IACpE,oEAAoE;IACpE,qEAAqE;IACrE,mEAAmE;IACnE,mEAAmE;IACnE,oDAAoD;IACpD,KAAK,CAAC,IAAS,EAAE,GAAiB;QAChC,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,IAAI,IAAA,qBAAW,EAAC,GAAG,EAAE,GAAG,CAAC,OAAO,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
(0, err_1.descErr)(nerr, ctx);
|
|
20
20
|
ctx?.adderr(nerr);
|
|
21
|
-
if (null == ctx || !ctx
|
|
21
|
+
if (null == ctx || !ctx.collect) {
|
|
22
22
|
const aerr = new err_1.AontuError(nerr.msg, [nerr]);
|
|
23
23
|
throw aerr;
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureVal.js","sourceRoot":"","sources":["../../src/val/FeatureVal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAYzD,+BAA2B;AAE3B,+BAA2B;AAE3B,gCAAwD;AAGxD,MAAe,UAAW,SAAQ,SAAG;IAGnC,YACE,IAAa,EACb,GAAkB;QAElB,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QANlB,cAAS,GAAG,IAAI,CAAA;IAOhB,CAAC;IAGD,QAAQ;QACN,OAAO,IAAA,SAAG,GAAE,CAAA;IACd,CAAC;IAGD,GAAG,CAAC,GAAiB;QACnB,0DAA0D;QAE1D,IAAI,IAAI,GAAG,IAAA,gBAAU,EAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;QAC1C,IAAA,aAAO,EAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QAClB,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;QAEjB,IAAI,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"FeatureVal.js","sourceRoot":"","sources":["../../src/val/FeatureVal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAYzD,+BAA2B;AAE3B,+BAA2B;AAE3B,gCAAwD;AAGxD,MAAe,UAAW,SAAQ,SAAG;IAGnC,YACE,IAAa,EACb,GAAkB;QAElB,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QANlB,cAAS,GAAG,IAAI,CAAA;IAOhB,CAAC;IAGD,QAAQ;QACN,OAAO,IAAA,SAAG,GAAE,CAAA;IACd,CAAC;IAGD,GAAG,CAAC,GAAiB;QACnB,0DAA0D;QAE1D,IAAI,IAAI,GAAG,IAAA,gBAAU,EAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;QAC1C,IAAA,aAAO,EAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QAClB,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;QAEjB,IAAI,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,IAAI,gBAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;YAC7C,MAAM,IAAI,CAAA;QACZ,CAAC;QAED,OAAO,SAAS,CAAA;IAClB,CAAC;CAEF,CAAC,iCAAiC;QAIjC,UAAU"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Val, ValSpec } from '../type';
|
|
2
|
+
import { AontuContext } from '../ctx';
|
|
3
|
+
import { MapVal } from './MapVal';
|
|
4
|
+
import { ListVal } from './ListVal';
|
|
5
|
+
import { FuncBaseVal } from './FuncBaseVal';
|
|
6
|
+
declare class FilterFuncVal extends FuncBaseVal {
|
|
7
|
+
isFilterFunc: boolean;
|
|
8
|
+
staged: boolean;
|
|
9
|
+
constructor(spec: ValSpec, ctx?: AontuContext);
|
|
10
|
+
funcname(): string;
|
|
11
|
+
prepare(_ctx: AontuContext, _args: Val[]): null;
|
|
12
|
+
unify(peer: Val, ctx: AontuContext): Val;
|
|
13
|
+
resolve(ctx: AontuContext, args: Val[]): ListVal | MapVal | import("./NilVal").NilVal;
|
|
14
|
+
}
|
|
15
|
+
export { FilterFuncVal, };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright (c) 2025 Richard Rodger, MIT License */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.FilterFuncVal = void 0;
|
|
5
|
+
const err_1 = require("../err");
|
|
6
|
+
const MapVal_1 = require("./MapVal");
|
|
7
|
+
const ListVal_1 = require("./ListVal");
|
|
8
|
+
const FuncBaseVal_1 = require("./FuncBaseVal");
|
|
9
|
+
const Val_1 = require("./Val");
|
|
10
|
+
const PlaceVal_1 = require("./PlaceVal");
|
|
11
|
+
class FilterFuncVal extends FuncBaseVal_1.FuncBaseVal {
|
|
12
|
+
constructor(spec, ctx) {
|
|
13
|
+
super(spec, ctx);
|
|
14
|
+
this.isFilterFunc = true;
|
|
15
|
+
// THE STAGING RULE (G8 phase 0). A subset of a bag that is still
|
|
16
|
+
// being merged into is a subset of the wrong bag.
|
|
17
|
+
this.staged = true;
|
|
18
|
+
}
|
|
19
|
+
funcname() {
|
|
20
|
+
return 'filter';
|
|
21
|
+
}
|
|
22
|
+
// Neither argument is driven by the base: `unify` below drives the
|
|
23
|
+
// DATA by hand, because a staged func must advance the argument it
|
|
24
|
+
// is waiting on every pass rather than only on the one it fires.
|
|
25
|
+
//
|
|
26
|
+
// The CONDITION is not driven at all, and that is deliberate: it is
|
|
27
|
+
// a template, tested against each child at that child's position,
|
|
28
|
+
// so it may hold a `_` (G8 phase 3, the child it is being tested
|
|
29
|
+
// against) or a relative reference — neither of which has an answer
|
|
30
|
+
// at the call site. Driving it there would freeze both.
|
|
31
|
+
prepare(_ctx, _args) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
unify(peer, ctx) {
|
|
35
|
+
const ready = this.driveStagedArgs(ctx, 1);
|
|
36
|
+
if (!ready || !ctx.settle) {
|
|
37
|
+
return this.residuate(peer, ctx);
|
|
38
|
+
}
|
|
39
|
+
return super.unify(peer, ctx);
|
|
40
|
+
}
|
|
41
|
+
resolve(ctx, args) {
|
|
42
|
+
const data = args[0];
|
|
43
|
+
const cond = args[1];
|
|
44
|
+
// The trial is run against CLONES: `unite` refines a bag in place,
|
|
45
|
+
// and a child that failed the test must reach the result -- when
|
|
46
|
+
// it passes -- exactly as it was written.
|
|
47
|
+
//
|
|
48
|
+
// Canon is the comparison because canon is what "the same value"
|
|
49
|
+
// MEANS in this language: it is the form the two ports agree on,
|
|
50
|
+
// the form `aontu diff` compares, and the form a hash is taken of.
|
|
51
|
+
const keeps = (child, kctx) => {
|
|
52
|
+
// `_` inside the condition binds the child being tested (G8
|
|
53
|
+
// phase 3), so a condition can be about the child as a whole
|
|
54
|
+
// rather than only about its shape. The condition is cloned as
|
|
55
|
+
// a FULL instance per trial (`dup`, ADR-005) — a bare clone
|
|
56
|
+
// shares call/pref innards across trials (see PackFuncVal).
|
|
57
|
+
const inst = cond.clone(kctx, { dup: true });
|
|
58
|
+
(0, Val_1.repathInstance)(inst, inst.path);
|
|
59
|
+
const test = (0, PlaceVal_1.fillPlace)(inst, child, kctx);
|
|
60
|
+
const met = (0, FuncBaseVal_1.trialUnify)(kctx, child.clone(kctx), test);
|
|
61
|
+
return undefined !== met && met.canon === child.canon;
|
|
62
|
+
};
|
|
63
|
+
if (true === data?.isMap) {
|
|
64
|
+
const peg = {};
|
|
65
|
+
for (const key of Object.keys(data.peg)) {
|
|
66
|
+
const kctx = ctx.descend(key);
|
|
67
|
+
if (keeps(data.peg[key], kctx)) {
|
|
68
|
+
peg[key] = data.peg[key].clone(kctx);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return new MapVal_1.MapVal({ peg }, ctx);
|
|
72
|
+
}
|
|
73
|
+
if (true === data?.isList) {
|
|
74
|
+
const peg = [];
|
|
75
|
+
for (const el of data.peg) {
|
|
76
|
+
// The element context is the position it will END UP at, which
|
|
77
|
+
// is its index in the RESULT: dropping the third of five moves
|
|
78
|
+
// the fourth up, and a kept element must be pathed where it
|
|
79
|
+
// lands rather than where it came from.
|
|
80
|
+
const ectx = ctx.descend(String(peg.length));
|
|
81
|
+
if (keeps(el, ectx)) {
|
|
82
|
+
peg.push(el.clone(ectx));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return new ListVal_1.ListVal({ peg }, ctx);
|
|
86
|
+
}
|
|
87
|
+
return (0, err_1.makeNilErr)(ctx, 'filter_data', this);
|
|
88
|
+
}
|
|
89
|
+
} /* node:coverage ignore next 5 */
|
|
90
|
+
exports.FilterFuncVal = FilterFuncVal;
|
|
91
|
+
//# sourceMappingURL=FilterFuncVal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterFuncVal.js","sourceRoot":"","sources":["../../src/val/FilterFuncVal.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AA0CpD,gCAAmC;AACnC,qCAAiC;AACjC,uCAAmC;AACnC,+CAAuD;AACvD,+BAAsC;AACtC,yCAAsC;AAGtC,MAAM,aAAc,SAAQ,yBAAW;IAOrC,YACE,IAAa,EACb,GAAkB;QAElB,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QAVlB,iBAAY,GAAG,IAAI,CAAA;QAEnB,iEAAiE;QACjE,kDAAkD;QAClD,WAAM,GAAG,IAAI,CAAA;IAOb,CAAC;IAGD,QAAQ;QACN,OAAO,QAAQ,CAAA;IACjB,CAAC;IAGD,mEAAmE;IACnE,mEAAmE;IACnE,iEAAiE;IACjE,EAAE;IACF,oEAAoE;IACpE,kEAAkE;IAClE,iEAAiE;IACjE,oEAAoE;IACpE,wDAAwD;IACxD,OAAO,CAAC,IAAkB,EAAE,KAAY;QACtC,OAAO,IAAI,CAAA;IACb,CAAC;IAGD,KAAK,CAAC,IAAS,EAAE,GAAiB;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QAE1C,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QAClC,CAAC;QAED,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/B,CAAC;IAGD,OAAO,CAAC,GAAiB,EAAE,IAAW;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G,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;gBACtC,CAAC;YACH,CAAC;YACD,OAAO,IAAI,eAAM,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,CAAC,CAAA;QACjC,CAAC;QAED,IAAI,IAAI,KAAK,IAAI,EAAE,MAAM,EAAE,CAAC;YAC1B,MAAM,GAAG,GAAU,EAAE,CAAA;YACrB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,GAAY,EAAE,CAAC;gBACnC,+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"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import type { Val, ValSpec } from '../type';
|
|
2
2
|
import { AontuContext } from '../ctx';
|
|
3
3
|
import { FeatureVal } from '../val/FeatureVal';
|
|
4
|
+
declare function trialUnify(ctx: AontuContext, a: Val, b: Val): Val | undefined;
|
|
4
5
|
declare class FuncBaseVal extends FeatureVal {
|
|
5
6
|
isFunc: boolean;
|
|
6
7
|
isGenable: boolean;
|
|
8
|
+
staged: boolean;
|
|
7
9
|
constructor(spec: ValSpec, ctx?: AontuContext);
|
|
8
10
|
validateArgs(args: Val[], min: number): void;
|
|
9
11
|
make(ctx: AontuContext, _spec: ValSpec): Val;
|
|
12
|
+
driveStagedArgs(ctx: AontuContext, count: number): boolean;
|
|
13
|
+
clone(ctx: AontuContext, spec?: ValSpec): Val;
|
|
14
|
+
residuate(peer: Val, ctx: AontuContext): Val;
|
|
10
15
|
unify(peer: Val, ctx: AontuContext): Val;
|
|
11
16
|
get canon(): string;
|
|
12
17
|
funcname(): string;
|
|
13
18
|
prepare(_ctx: AontuContext, args: Val[]): Val[] | null;
|
|
14
19
|
resolve(ctx: AontuContext, _args: Val[]): Val;
|
|
20
|
+
deferResolve(_ctx: AontuContext, _args?: Val[]): boolean;
|
|
15
21
|
}
|
|
16
|
-
export { FuncBaseVal, };
|
|
22
|
+
export { trialUnify, FuncBaseVal, };
|
package/dist/val/FuncBaseVal.js
CHANGED
|
@@ -2,18 +2,55 @@
|
|
|
2
2
|
/* Copyright (c) 2021-2025 Richard Rodger, MIT License */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.FuncBaseVal = void 0;
|
|
5
|
+
exports.trialUnify = trialUnify;
|
|
5
6
|
const type_1 = require("../type");
|
|
6
7
|
const unify_1 = require("../unify");
|
|
7
8
|
const utility_1 = require("../utility");
|
|
8
9
|
const err_1 = require("../err");
|
|
10
|
+
const siggate_1 = require("../siggate");
|
|
9
11
|
const top_1 = require("./top");
|
|
10
12
|
const ConjunctVal_1 = require("../val/ConjunctVal");
|
|
11
13
|
const FeatureVal_1 = require("../val/FeatureVal");
|
|
14
|
+
const PlaceVal_1 = require("../val/PlaceVal");
|
|
15
|
+
// A TRIAL meet: does `a` unify with `b`, and if so as what? Failure is
|
|
16
|
+
// an ANSWER here rather than an error, which is exactly what
|
|
17
|
+
// DisjunctVal already needs when it tries each member against a peer —
|
|
18
|
+
// so this is that mechanism (`ctx._trialMode`, which makes makeNilErr
|
|
19
|
+
// return the shared TRIAL_NIL instead of allocating and recording),
|
|
20
|
+
// lent to the combinators that select by unifiability.
|
|
21
|
+
//
|
|
22
|
+
// The error list and the trial flag are saved and restored in a
|
|
23
|
+
// `finally`: a trial that throws must not leave the surrounding
|
|
24
|
+
// evaluation collapsing every later error into the sentinel.
|
|
25
|
+
function trialUnify(ctx, a, b) {
|
|
26
|
+
const savedErr = ctx.err;
|
|
27
|
+
const savedTrial = ctx._trialMode;
|
|
28
|
+
const trialErr = [];
|
|
29
|
+
ctx.err = trialErr;
|
|
30
|
+
ctx._trialMode = true;
|
|
31
|
+
let out;
|
|
32
|
+
try {
|
|
33
|
+
out = (0, unify_1.unite)(ctx, a, b, 'trial');
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
ctx.err = savedErr;
|
|
37
|
+
ctx._trialMode = savedTrial;
|
|
38
|
+
}
|
|
39
|
+
return 0 < trialErr.length || out.isNil ? undefined : out;
|
|
40
|
+
}
|
|
12
41
|
class FuncBaseVal extends FeatureVal_1.FeatureVal {
|
|
13
42
|
constructor(spec, ctx) {
|
|
14
43
|
super(spec, ctx);
|
|
15
44
|
this.isFunc = true;
|
|
16
45
|
this.isGenable = true;
|
|
46
|
+
// THE STAGING RULE (G8 phase 0, see AontuContext.settle). A func
|
|
47
|
+
// whose answer depends on WHERE IT IS -- `key()`, whose answer is a
|
|
48
|
+
// segment of its own path, and the generation combinators, whose
|
|
49
|
+
// data argument can still be merged into by a sibling -- sets this
|
|
50
|
+
// and residuates until the model stops moving. Everything else
|
|
51
|
+
// resolves as soon as its arguments are done, which is the rule that
|
|
52
|
+
// has always been here.
|
|
53
|
+
this.staged = false;
|
|
17
54
|
// console.log('FBV', this.id, this.constructor.name, this.peg?.[0]?.canon)
|
|
18
55
|
}
|
|
19
56
|
validateArgs(args, min) {
|
|
@@ -26,7 +63,103 @@ class FuncBaseVal extends FeatureVal_1.FeatureVal {
|
|
|
26
63
|
make(ctx, _spec) {
|
|
27
64
|
return (0, err_1.makeNilErr)(ctx, 'func:' + this.funcname(), this, undefined, 'make');
|
|
28
65
|
}
|
|
66
|
+
// Drive the first `count` arguments IN PLACE, every pass — not only
|
|
67
|
+
// on the settle pass. A staged func waits for the model to settle,
|
|
68
|
+
// and its own arguments are part of that model: leaving them
|
|
69
|
+
// standing until settle would guarantee the model was still moving
|
|
70
|
+
// when settle arrived. Answers whether they are all done, which is
|
|
71
|
+
// the other half of "ready to fire".
|
|
72
|
+
driveStagedArgs(ctx, count) {
|
|
73
|
+
const TOP = (0, top_1.top)();
|
|
74
|
+
let alldone = true;
|
|
75
|
+
// THE SNAPSHOT WAITS FOR THE SOURCE (the spread-then-pack defect,
|
|
76
|
+
// use-cases/BUGS.md pack-refs family). A reference resolving inside
|
|
77
|
+
// a staged argument is this argument's SNAPSHOT of its source, and
|
|
78
|
+
// the snapshot is not part of the tree: a spread-injected relative
|
|
79
|
+
// reference inside a too-early copy dangles at the argument's
|
|
80
|
+
// location (`.containerPort` rebased under the generator, where no
|
|
81
|
+
// root traversal reaches it) and the generator never fires. The
|
|
82
|
+
// `argsnap` flag makes RefVal.find defer until the target has
|
|
83
|
+
// finished resolving IN THE TREE — where its own spreads and
|
|
84
|
+
// relative references answer at their real location — and only then
|
|
85
|
+
// take the copy. Inherited by every descended ctx, so a reference
|
|
86
|
+
// anywhere in the argument subtree waits the same way.
|
|
87
|
+
const actx = ctx.clone({});
|
|
88
|
+
actx.argsnap = true;
|
|
89
|
+
for (let i = 0; i < count && i < this.peg.length; i++) {
|
|
90
|
+
const arg = this.peg[i];
|
|
91
|
+
if (!arg.done) {
|
|
92
|
+
// Charged to the depth budget, as FuncBaseVal's own arg loop is:
|
|
93
|
+
// this recurses without going through `unite`.
|
|
94
|
+
this.peg[i] = (0, unify_1.withDepth)(ctx, arg, TOP, () => arg.unify(TOP, actx));
|
|
95
|
+
}
|
|
96
|
+
alldone = alldone && true === this.peg[i].done;
|
|
97
|
+
}
|
|
98
|
+
return alldone;
|
|
99
|
+
}
|
|
100
|
+
// THE PER-DESTINATION INSTANTIATION RULE (ADR-005). The default
|
|
101
|
+
// clone shares the argument array AND the argument Vals — pinned
|
|
102
|
+
// sharing for the move()/copy() ghost artifacts (test/spec/func.tsv,
|
|
103
|
+
// ghost-*-innard-canon) — but a clone that is a template INSTANCE
|
|
104
|
+
// must own the full inner structure: with the args shared,
|
|
105
|
+
// `pack($.names, close({name: key()}))` resolved key() once inside
|
|
106
|
+
// the one shared inner map and stamped the FIRST child's key on
|
|
107
|
+
// every child (use-cases/BUGS.md §8). The `dup` spec flag asks for
|
|
108
|
+
// that depth; everything else keeps the sharing it has always had.
|
|
109
|
+
clone(ctx, spec) {
|
|
110
|
+
const out = super.clone(ctx, spec);
|
|
111
|
+
if (true === spec?.dup && Array.isArray(this.peg)) {
|
|
112
|
+
// Every argument is a Val by construction (the parser builds
|
|
113
|
+
// them; make() rebuilds from driven Vals), as the Go twin's
|
|
114
|
+
// []Val typing states outright. The instantiation sites then
|
|
115
|
+
// normalise every path in the clone (repathInstance), so the
|
|
116
|
+
// argument-shaped parse paths never leak into an instance.
|
|
117
|
+
out.peg = this.peg.map((a) => a.clone(ctx, { dup: true }));
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
// The shape a staged func holds while it waits: not done, so the pass
|
|
122
|
+
// loop keeps going; unchanged against TOP, so nothing reads an answer
|
|
123
|
+
// it has not given; and collapsed against an identical twin at the
|
|
124
|
+
// same position, so `key() & key()` does not grow a conjunct per pass.
|
|
125
|
+
residuate(peer, ctx) {
|
|
126
|
+
this.notdone();
|
|
127
|
+
if (peer.isTop || (peer.id === this.id)) {
|
|
128
|
+
// Cloned rather than returned: a driver that met the same object
|
|
129
|
+
// twice in one pass would charge the revisit budget and report
|
|
130
|
+
// `unify_cycle`.
|
|
131
|
+
return this.clone(ctx);
|
|
132
|
+
}
|
|
133
|
+
if (peer.isNil) {
|
|
134
|
+
return peer;
|
|
135
|
+
}
|
|
136
|
+
if (peer.isFunc
|
|
137
|
+
&& peer.funcname() === this.funcname()
|
|
138
|
+
&& peer.path.join('.') === this.path.join('.')
|
|
139
|
+
&& peer.canon === this.canon) {
|
|
140
|
+
return this;
|
|
141
|
+
}
|
|
142
|
+
return new ConjunctVal_1.ConjunctVal({ peg: [this, peer] }, ctx);
|
|
143
|
+
}
|
|
29
144
|
unify(peer, ctx) {
|
|
145
|
+
if (this.staged && !ctx.settle) {
|
|
146
|
+
return this.residuate(peer, ctx);
|
|
147
|
+
}
|
|
148
|
+
// THE PLACEHOLDER (G8 phase 3, see PlaceVal). A call holding a hole
|
|
149
|
+
// waits for a peer, and the peer is what fills it: the call is
|
|
150
|
+
// rebuilt with the hole replaced and resolved on the spot, so
|
|
151
|
+
// `upper(_) & hello` is `"HELLO"` and not `"HELLO" & "hello"` --
|
|
152
|
+
// the peer went INTO the call, it is not also a constraint on the
|
|
153
|
+
// way out.
|
|
154
|
+
if (!peer.isTop && !peer.isNil && this.id !== peer.id && (0, PlaceVal_1.hasPlace)(this)) {
|
|
155
|
+
// TWO HOLES AND NOTHING TO FILL THEM. `upper(_) & lower(_)` has
|
|
156
|
+
// no value on either side, and picking one call to be the other's
|
|
157
|
+
// filling would be inventing an order the language does not have.
|
|
158
|
+
if ((0, PlaceVal_1.hasPlace)(peer)) {
|
|
159
|
+
return (0, err_1.makeNilErr)(ctx, 'place_pair', this, peer);
|
|
160
|
+
}
|
|
161
|
+
return (0, PlaceVal_1.fillPlace)(this, peer, ctx).unify((0, top_1.top)(), ctx);
|
|
162
|
+
}
|
|
30
163
|
const TOP = (0, top_1.top)();
|
|
31
164
|
const te = ctx.explain && (0, utility_1.explainOpen)(ctx, ctx.explain, 'Func:' + this.funcname(), this, peer);
|
|
32
165
|
// const sc = this.id + '=' + this.canon
|
|
@@ -71,9 +204,15 @@ class FuncBaseVal extends FeatureVal_1.FeatureVal {
|
|
|
71
204
|
}
|
|
72
205
|
}
|
|
73
206
|
// console.log('FUNCBASE-PEG', this.id, pegdone, this.peg.map((p: any) => p?.canon))
|
|
74
|
-
if (pegdone) {
|
|
75
|
-
|
|
207
|
+
if (pegdone && !this.deferResolve(ctx, newpeg)) {
|
|
208
|
+
// THE SIGNATURE GATE (docs/design/SIGNATURES.0.md): the
|
|
209
|
+
// driven arguments against the declared signature, before
|
|
210
|
+
// the builtin's own logic sees them. See siggate.ts for
|
|
211
|
+
// what the gate owns and what stays with the builtins.
|
|
212
|
+
const resolved = (0, siggate_1.sigRefuse)(ctx, this, newpeg) ??
|
|
213
|
+
this.resolve(ctx, newpeg);
|
|
76
214
|
// console.log('FUNC-RESOLVED', ctx.cc, resolved?.canon)
|
|
215
|
+
// The TOP peer is DROPPED as the unit it is.
|
|
77
216
|
out = resolved.done && peer.isTop ? resolved :
|
|
78
217
|
(0, unify_1.unite)(te ? ctx.clone({ explain: (0, utility_1.ec)(te, 'PEG') }) : ctx, resolved, peer, 'func-' + this.funcname() + '/' + this.id);
|
|
79
218
|
(0, utility_1.propagateMarks)(this, out);
|
|
@@ -81,6 +220,17 @@ class FuncBaseVal extends FeatureVal_1.FeatureVal {
|
|
|
81
220
|
out.site.row = this.site.row;
|
|
82
221
|
out.site.col = this.site.col;
|
|
83
222
|
out.site.url = this.site.url;
|
|
223
|
+
// THE SPAN COMES WITH THE POSITION, always. Moving row and
|
|
224
|
+
// col onto the result while leaving its own text behind
|
|
225
|
+
// produced a site that contradicted itself: `close({...})`
|
|
226
|
+
// reported the call's column and the map's `{`, so reading
|
|
227
|
+
// the document at (row, col, len) found `c` where `src` said
|
|
228
|
+
// `{`. A consumer following the verification contract would
|
|
229
|
+
// refuse every such repair; one skipping it would edit the
|
|
230
|
+
// wrong token. Whatever the position names, the text names
|
|
231
|
+
// too. Twin: the same assignment in go/func.go.
|
|
232
|
+
out.site.len = this.site.len;
|
|
233
|
+
out.site.src = this.site.src;
|
|
84
234
|
out.path = this.path;
|
|
85
235
|
why += 'pegdone';
|
|
86
236
|
}
|
|
@@ -91,6 +241,17 @@ class FuncBaseVal extends FeatureVal_1.FeatureVal {
|
|
|
91
241
|
out.site.row = this.site.row;
|
|
92
242
|
out.site.col = this.site.col;
|
|
93
243
|
out.site.url = this.site.url;
|
|
244
|
+
// THE SPAN COMES WITH THE POSITION, always. Moving row and
|
|
245
|
+
// col onto the result while leaving its own text behind
|
|
246
|
+
// produced a site that contradicted itself: `close({...})`
|
|
247
|
+
// reported the call's column and the map's `{`, so reading
|
|
248
|
+
// the document at (row, col, len) found `c` where `src` said
|
|
249
|
+
// `{`. A consumer following the verification contract would
|
|
250
|
+
// refuse every such repair; one skipping it would edit the
|
|
251
|
+
// wrong token. Whatever the position names, the text names
|
|
252
|
+
// too. Twin: the same assignment in go/func.go.
|
|
253
|
+
out.site.len = this.site.len;
|
|
254
|
+
out.site.src = this.site.src;
|
|
94
255
|
out.path = this.path;
|
|
95
256
|
why += 'top';
|
|
96
257
|
}
|
|
@@ -108,6 +269,17 @@ class FuncBaseVal extends FeatureVal_1.FeatureVal {
|
|
|
108
269
|
out.site.row = this.site.row;
|
|
109
270
|
out.site.col = this.site.col;
|
|
110
271
|
out.site.url = this.site.url;
|
|
272
|
+
// THE SPAN COMES WITH THE POSITION, always. Moving row and
|
|
273
|
+
// col onto the result while leaving its own text behind
|
|
274
|
+
// produced a site that contradicted itself: `close({...})`
|
|
275
|
+
// reported the call's column and the map's `{`, so reading
|
|
276
|
+
// the document at (row, col, len) found `c` where `src` said
|
|
277
|
+
// `{`. A consumer following the verification contract would
|
|
278
|
+
// refuse every such repair; one skipping it would edit the
|
|
279
|
+
// wrong token. Whatever the position names, the text names
|
|
280
|
+
// too. Twin: the same assignment in go/func.go.
|
|
281
|
+
out.site.len = this.site.len;
|
|
282
|
+
out.site.src = this.site.src;
|
|
111
283
|
out.path = this.path;
|
|
112
284
|
why += 'defer';
|
|
113
285
|
}
|
|
@@ -133,6 +305,15 @@ class FuncBaseVal extends FeatureVal_1.FeatureVal {
|
|
|
133
305
|
resolve(ctx, _args) {
|
|
134
306
|
return (0, err_1.makeNilErr)(ctx, 'func:' + this.funcname(), this, undefined, 'resolve');
|
|
135
307
|
}
|
|
308
|
+
// A function may hold its resolution for a later pass even with its
|
|
309
|
+
// arguments settled -- it then rides the ordinary args-not-done
|
|
310
|
+
// path, residuating as any unresolved call does. super() defers on a
|
|
311
|
+
// recursion residual argument (SuperFuncVal), which is why the DRIVEN
|
|
312
|
+
// arguments are passed: this.peg still holds the undriven originals
|
|
313
|
+
// at the decision point.
|
|
314
|
+
deferResolve(_ctx, _args) {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
136
317
|
} /* node:coverage ignore next 6 */
|
|
137
318
|
exports.FuncBaseVal = FuncBaseVal;
|
|
138
319
|
//# sourceMappingURL=FuncBaseVal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FuncBaseVal.js","sourceRoot":"","sources":["../../src/val/FuncBaseVal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;
|
|
1
|
+
{"version":3,"file":"FuncBaseVal.js","sourceRoot":"","sources":["../../src/val/FuncBaseVal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;QA4ZvD,UAAU;AApZZ,kCAEgB;AAGhB,oCAA2C;AAG3C,wCAKmB;AAEnB,gCAA+C;AAC/C,wCAAsC;AAEtC,+BAEc;AAEd,oDAAgD;AAChD,kDAA8C;AAC9C,8CAAqD;AAGrD,uEAAuE;AACvE,6DAA6D;AAC7D,uEAAuE;AACvE,sEAAsE;AACtE,oEAAoE;AACpE,uDAAuD;AACvD,EAAE;AACF,gEAAgE;AAChE,gEAAgE;AAChE,6DAA6D;AAC7D,SAAS,UAAU,CAAC,GAAiB,EAAE,CAAM,EAAE,CAAM;IACnD,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAA;IACxB,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,CAAA;IACjC,MAAM,QAAQ,GAAU,EAAE,CAAA;IAE1B,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAA;IAClB,GAAG,CAAC,UAAU,GAAG,IAAI,CAAA;IAErB,IAAI,GAAQ,CAAA;IACZ,IAAI,CAAC;QACH,GAAG,GAAG,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IAAI,CAAC,GAAG,CAAA;oBAC5B,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;oBAEpB,GAAG,IAAI,OAAO,CAAA;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;QAED,8JAA8J;QAE9J,IAAA,sBAAY,EAAC,EAAE,EAAE,GAAG,CAAC,CAAA;QAErB,OAAO,GAAG,CAAA;IACZ,CAAC;IAID,IAAI,KAAK;QACP,OAAO,EAAE;YACP,gCAAgC;YAChC,gCAAgC;YAChC,oBAAoB;YACpB,IAAI,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAA;IAC/E,CAAC;IAGD,QAAQ;QACN,OAAO,MAAM,CAAA;IACf,CAAC;IAGD,OAAO,CAAC,IAAkB,EAAE,IAAW;QACrC,OAAO,IAAI,CAAA;IACb,CAAC;IAGD,OAAO,CAAC,GAAiB,EAAE,KAAY;QACrC,OAAO,IAAA,gBAAU,EAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;IAC/E,CAAC;IAGD,oEAAoE;IACpE,gEAAgE;IAChE,qEAAqE;IACrE,sEAAsE;IACtE,oEAAoE;IACpE,yBAAyB;IACzB,YAAY,CAAC,IAAkB,EAAE,KAAa;QAC5C,OAAO,KAAK,CAAA;IACd,CAAC;CAGF,CAAC,iCAAiC;QAKjC,WAAW"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Val, ValSpec } from '../type';
|
|
2
|
+
import { AontuContext } from '../ctx';
|
|
3
|
+
import { FuncBaseVal } from './FuncBaseVal';
|
|
4
|
+
import { FeatureVal } from './FeatureVal';
|
|
5
|
+
export type RelDecl = {
|
|
6
|
+
acyclic?: boolean;
|
|
7
|
+
inverses: Set<string>;
|
|
8
|
+
};
|
|
9
|
+
export declare function relDecls(ctx: any): Map<string, RelDecl>;
|
|
10
|
+
declare class GraphAtomVal extends FeatureVal {
|
|
11
|
+
isGraphAtom: boolean;
|
|
12
|
+
isGenable: boolean;
|
|
13
|
+
cjo: number;
|
|
14
|
+
akind: 'acyclic' | 'inverse';
|
|
15
|
+
invname?: string;
|
|
16
|
+
held?: Val;
|
|
17
|
+
constructor(spec: ValSpec, ctx?: AontuContext);
|
|
18
|
+
clone(ctx: AontuContext, spec?: ValSpec): Val;
|
|
19
|
+
private carry;
|
|
20
|
+
register(ctx: AontuContext): void;
|
|
21
|
+
unify(peer: Val, ctx: AontuContext): Val;
|
|
22
|
+
get canon(): string;
|
|
23
|
+
gen(ctx: AontuContext): any;
|
|
24
|
+
}
|
|
25
|
+
declare class AcyclicFuncVal extends FuncBaseVal {
|
|
26
|
+
isAcyclicFunc: boolean;
|
|
27
|
+
constructor(spec: ValSpec, ctx?: AontuContext);
|
|
28
|
+
make(_ctx: AontuContext, spec: ValSpec): Val;
|
|
29
|
+
funcname(): string;
|
|
30
|
+
resolve(ctx: AontuContext, _args: Val[]): any;
|
|
31
|
+
}
|
|
32
|
+
declare class InverseFuncVal extends FuncBaseVal {
|
|
33
|
+
isInverseFunc: boolean;
|
|
34
|
+
constructor(spec: ValSpec, ctx?: AontuContext);
|
|
35
|
+
make(_ctx: AontuContext, spec: ValSpec): Val;
|
|
36
|
+
funcname(): string;
|
|
37
|
+
resolve(ctx: AontuContext, args: Val[]): any;
|
|
38
|
+
}
|
|
39
|
+
export { GraphAtomVal, AcyclicFuncVal, InverseFuncVal, };
|