aontu 0.61.0 → 0.63.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 +4 -4
- package/dist/agentsmd.d.ts +1 -0
- package/dist/agentsmd.js +7 -28
- package/dist/agentsmd.js.map +1 -1
- package/dist/alias.js.map +1 -1
- package/dist/allow.d.ts +23 -0
- package/dist/allow.js +138 -0
- package/dist/allow.js.map +1 -0
- package/dist/aontu.d.ts +4 -2
- package/dist/aontu.js +4 -80
- package/dist/aontu.js.map +1 -1
- package/dist/aontumodel.d.ts +4 -0
- package/dist/aontumodel.js +33 -0
- package/dist/aontumodel.js.map +1 -0
- package/dist/cli.d.ts +10 -1
- package/dist/cli.js +877 -479
- package/dist/cli.js.map +1 -1
- package/dist/ctx.js +0 -48
- package/dist/ctx.js.map +1 -1
- package/dist/diff.js +0 -32
- package/dist/diff.js.map +1 -1
- package/dist/err.js +0 -40
- package/dist/err.js.map +1 -1
- package/dist/escape.js +0 -45
- package/dist/escape.js.map +1 -1
- package/dist/exactjson.d.ts +0 -35
- package/dist/exactjson.js +0 -131
- package/dist/exactjson.js.map +1 -1
- package/dist/format.js +55 -189
- package/dist/format.js.map +1 -1
- package/dist/grammar.d.ts +9 -0
- package/dist/grammar.js +54 -0
- package/dist/grammar.js.map +1 -0
- package/dist/graph.js +0 -26
- package/dist/graph.js.map +1 -1
- package/dist/hcanon.js +0 -82
- package/dist/hcanon.js.map +1 -1
- package/dist/helpdoc.d.ts +16 -0
- package/dist/helpdoc.js +59 -0
- package/dist/helpdoc.js.map +1 -0
- package/dist/hints.d.ts +0 -6
- package/dist/hints.js +59 -47
- package/dist/hints.js.map +1 -1
- package/dist/jsonschema.js +0 -114
- package/dist/jsonschema.js.map +1 -1
- package/dist/keyorder.d.ts +0 -7
- package/dist/keyorder.js +0 -41
- package/dist/keyorder.js.map +1 -1
- package/dist/lang.js +32 -877
- package/dist/lang.js.map +1 -1
- package/dist/lower.d.ts +3 -0
- package/dist/lower.js +14 -61
- package/dist/lower.js.map +1 -1
- package/dist/lsp-server.js +0 -16
- package/dist/lsp-server.js.map +1 -1
- package/dist/lsp.d.ts +1 -1
- package/dist/lsp.js +12 -159
- package/dist/lsp.js.map +1 -1
- package/dist/mcp-server.js +0 -26
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp.js +0 -113
- package/dist/mcp.js.map +1 -1
- package/dist/mod-tool.js +0 -130
- package/dist/mod-tool.js.map +1 -1
- package/dist/mod.js +0 -162
- package/dist/mod.js.map +1 -1
- package/dist/patch.js +0 -217
- package/dist/patch.js.map +1 -1
- package/dist/provenance.js +0 -140
- package/dist/provenance.js.map +1 -1
- package/dist/query.js +0 -75
- package/dist/query.js.map +1 -1
- package/dist/reach.js +0 -43
- package/dist/reach.js.map +1 -1
- package/dist/relation.d.ts +2 -0
- package/dist/relation.js +3 -58
- package/dist/relation.js.map +1 -1
- package/dist/render.js +33 -143
- package/dist/render.js.map +1 -1
- package/dist/report-sarif.d.ts +0 -11
- package/dist/report-sarif.js +0 -28
- package/dist/report-sarif.js.map +1 -1
- package/dist/sig.js +0 -35
- package/dist/sig.js.map +1 -1
- package/dist/sigdecl.js +1 -1
- package/dist/sigdecl.js.map +1 -1
- package/dist/siggate.js +0 -4
- package/dist/siggate.js.map +1 -1
- package/dist/site.js +3 -29
- package/dist/site.js.map +1 -1
- package/dist/subsume.d.ts +0 -10
- package/dist/subsume.js +0 -137
- package/dist/subsume.js.map +1 -1
- package/dist/template.d.ts +2 -1
- package/dist/template.js +58 -138
- package/dist/template.js.map +1 -1
- package/dist/trim.js +0 -41
- package/dist/trim.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/type.js.map +1 -1
- package/dist/unify.js +12 -242
- package/dist/unify.js.map +1 -1
- package/dist/utility.js +0 -22
- package/dist/utility.js.map +1 -1
- package/dist/val/AbnfFuncVal.d.ts +18 -0
- package/dist/val/AbnfFuncVal.js +132 -0
- package/dist/val/AbnfFuncVal.js.map +1 -0
- package/dist/val/AbsentVal.d.ts +11 -0
- package/dist/val/AbsentVal.js +30 -0
- package/dist/val/AbsentVal.js.map +1 -0
- package/dist/val/AggFuncVal.d.ts +10 -1
- package/dist/val/AggFuncVal.js +104 -116
- package/dist/val/AggFuncVal.js.map +1 -1
- package/dist/val/ArithFuncVal.js +0 -12
- package/dist/val/ArithFuncVal.js.map +1 -1
- package/dist/val/BagVal.js +1 -78
- package/dist/val/BagVal.js.map +1 -1
- package/dist/val/BigDecimalVal.js +0 -16
- package/dist/val/BigDecimalVal.js.map +1 -1
- package/dist/val/BigIntegerVal.js +0 -16
- package/dist/val/BigIntegerVal.js.map +1 -1
- package/dist/val/CloseFuncVal.js +0 -9
- package/dist/val/CloseFuncVal.js.map +1 -1
- package/dist/val/CmpFuncVal.d.ts +20 -0
- package/dist/val/CmpFuncVal.js +188 -0
- package/dist/val/CmpFuncVal.js.map +1 -0
- package/dist/val/ConjunctVal.js +0 -29
- package/dist/val/ConjunctVal.js.map +1 -1
- package/dist/val/ConstraintVal.js +0 -500
- package/dist/val/ConstraintVal.js.map +1 -1
- package/dist/val/ContainerKindVal.js +0 -2
- package/dist/val/ContainerKindVal.js.map +1 -1
- package/dist/val/CopyFuncVal.js +0 -3
- package/dist/val/CopyFuncVal.js.map +1 -1
- package/dist/val/Decimal.js +0 -179
- package/dist/val/Decimal.js.map +1 -1
- package/dist/val/DeprecateFuncVal.js.map +1 -1
- package/dist/val/DisjunctVal.js +0 -152
- package/dist/val/DisjunctVal.js.map +1 -1
- package/dist/val/EachFuncVal.d.ts +1 -2
- package/dist/val/EachFuncVal.js +12 -29
- package/dist/val/EachFuncVal.js.map +1 -1
- package/dist/val/EmitFuncVal.d.ts +1 -1
- package/dist/val/EmitFuncVal.js +6 -119
- package/dist/val/EmitFuncVal.js.map +1 -1
- package/dist/val/ExpectVal.js +0 -62
- package/dist/val/ExpectVal.js.map +1 -1
- package/dist/val/FilterFuncVal.js +0 -25
- package/dist/val/FilterFuncVal.js.map +1 -1
- package/dist/val/FuncBaseVal.d.ts +1 -0
- package/dist/val/FuncBaseVal.js +7 -127
- package/dist/val/FuncBaseVal.js.map +1 -1
- package/dist/val/GraphAtomVal.js +0 -15
- package/dist/val/GraphAtomVal.js.map +1 -1
- package/dist/val/HideFuncVal.js +0 -13
- package/dist/val/HideFuncVal.js.map +1 -1
- package/dist/val/IntegerVal.js +0 -61
- package/dist/val/IntegerVal.js.map +1 -1
- package/dist/val/JunctionVal.js +0 -20
- package/dist/val/JunctionVal.js.map +1 -1
- package/dist/val/KeyFuncVal.js +0 -46
- package/dist/val/KeyFuncVal.js.map +1 -1
- package/dist/val/ListVal.js +0 -57
- package/dist/val/ListVal.js.map +1 -1
- package/dist/val/LowerFuncVal.js +11 -6
- package/dist/val/LowerFuncVal.js.map +1 -1
- package/dist/val/MapVal.js +0 -151
- package/dist/val/MapVal.js.map +1 -1
- package/dist/val/MatchFuncVal.js +0 -27
- package/dist/val/MatchFuncVal.js.map +1 -1
- package/dist/val/{FormFuncVal.d.ts → MaybeFuncVal.d.ts} +5 -5
- package/dist/val/MaybeFuncVal.js +50 -0
- package/dist/val/MaybeFuncVal.js.map +1 -0
- package/dist/val/MoveFuncVal.js +0 -18
- package/dist/val/MoveFuncVal.js.map +1 -1
- package/dist/val/NilVal.js +2 -36
- package/dist/val/NilVal.js.map +1 -1
- package/dist/val/NomFuncVal.d.ts +12 -0
- package/dist/val/NomFuncVal.js +153 -0
- package/dist/val/NomFuncVal.js.map +1 -0
- package/dist/val/NumberVal.js +0 -15
- package/dist/val/NumberVal.js.map +1 -1
- package/dist/val/OpBaseVal.d.ts +1 -0
- package/dist/val/OpBaseVal.js +3 -15
- package/dist/val/OpBaseVal.js.map +1 -1
- package/dist/val/PackFuncVal.js +0 -34
- package/dist/val/PackFuncVal.js.map +1 -1
- package/dist/val/PathFuncVal.js +0 -6
- package/dist/val/PathFuncVal.js.map +1 -1
- package/dist/val/PathVal.js +0 -41
- package/dist/val/PathVal.js.map +1 -1
- package/dist/val/PlaceVal.js +0 -25
- package/dist/val/PlaceVal.js.map +1 -1
- package/dist/val/PlusOpVal.d.ts +1 -7
- package/dist/val/PlusOpVal.js +13 -74
- package/dist/val/PlusOpVal.js.map +1 -1
- package/dist/val/PrefFuncVal.js +0 -1
- package/dist/val/PrefFuncVal.js.map +1 -1
- package/dist/val/PrefVal.js +0 -167
- package/dist/val/PrefVal.js.map +1 -1
- package/dist/val/RecurseVal.js +0 -55
- package/dist/val/RecurseVal.js.map +1 -1
- package/dist/val/RefVal.js +0 -282
- package/dist/val/RefVal.js.map +1 -1
- package/dist/val/ReferFuncVal.js +0 -232
- package/dist/val/ReferFuncVal.js.map +1 -1
- package/dist/val/ScalarKindVal.js +0 -49
- package/dist/val/ScalarKindVal.js.map +1 -1
- package/dist/val/ScalarVal.js +0 -11
- package/dist/val/ScalarVal.js.map +1 -1
- package/dist/val/StrFuncVal.js +0 -18
- package/dist/val/StrFuncVal.js.map +1 -1
- package/dist/val/SuperFuncVal.js +0 -32
- package/dist/val/SuperFuncVal.js.map +1 -1
- package/dist/val/TopVal.js +0 -1
- package/dist/val/TopVal.js.map +1 -1
- package/dist/val/TranslateFuncVal.d.ts +12 -0
- package/dist/val/TranslateFuncVal.js +99 -0
- package/dist/val/TranslateFuncVal.js.map +1 -0
- package/dist/val/UpperFuncVal.js +11 -6
- package/dist/val/UpperFuncVal.js.map +1 -1
- package/dist/val/Val.d.ts +1 -0
- package/dist/val/Val.js +2 -133
- package/dist/val/Val.js.map +1 -1
- package/dist/val/VarVal.js +0 -12
- package/dist/val/VarVal.js.map +1 -1
- package/dist/val/arith.js +0 -37
- package/dist/val/arith.js.map +1 -1
- package/dist/val/caserange.d.ts +3 -0
- package/dist/val/caserange.js +49 -0
- package/dist/val/caserange.js.map +1 -0
- package/dist/val/members.js +0 -6
- package/dist/val/members.js.map +1 -1
- package/dist/val/numcmp.js +0 -11
- package/dist/val/numcmp.js.map +1 -1
- package/dist/val/numkind.js +0 -145
- package/dist/val/numkind.js.map +1 -1
- package/dist/val/valutil.js +0 -16
- package/dist/val/valutil.js.map +1 -1
- package/dist/vet.d.ts +12 -0
- package/dist/vet.js +159 -412
- package/dist/vet.js.map +1 -1
- package/dist/view.js +0 -414
- package/dist/view.js.map +1 -1
- package/dist/walk.js +0 -41
- package/dist/walk.js.map +1 -1
- package/grammar/aontu.abnf +9 -7
- package/grammar/aontu.gbnf +5 -5
- package/grammar/aontu.lark +5 -5
- package/grammar/aontu.tmLanguage.json +1 -1
- package/package.json +4 -2
- package/skill/SKILL.md +8 -0
- package/skill/init/check.sh +28 -0
- package/skill/init/data.aon +12 -0
- package/skill/init/model.aon +19 -0
- package/skill/tasks.md +151 -0
- package/src/agentsmd.ts +8 -32
- package/src/alias.ts +0 -39
- package/src/allow.ts +221 -0
- package/src/aontu.ts +10 -108
- package/src/aontumodel.ts +32 -0
- package/src/cli.ts +1009 -540
- package/src/ctx.ts +0 -103
- package/src/diff.ts +0 -40
- package/src/err.ts +0 -40
- package/src/escape.ts +0 -46
- package/src/exactjson.ts +0 -131
- package/src/format.ts +63 -234
- package/src/grammar.ts +72 -0
- package/src/graph.ts +0 -61
- package/src/hcanon.ts +0 -82
- package/src/helpdoc.ts +77 -0
- package/src/hints.ts +72 -49
- package/src/jsonschema.ts +0 -123
- package/src/keyorder.ts +0 -42
- package/src/lang.ts +39 -895
- package/src/lower.ts +15 -65
- package/src/lsp-server.ts +0 -16
- package/src/lsp.ts +12 -180
- package/src/mcp-server.ts +0 -31
- package/src/mcp.ts +0 -130
- package/src/mod-tool.ts +0 -158
- package/src/mod.ts +0 -178
- package/src/patch.ts +0 -232
- package/src/provenance.ts +0 -183
- package/src/query.ts +0 -84
- package/src/reach.ts +0 -53
- package/src/relation.ts +7 -71
- package/src/render.ts +33 -180
- package/src/report-sarif.ts +0 -48
- package/src/sig.ts +0 -35
- package/src/sigdecl.ts +1 -1
- package/src/siggate.ts +0 -30
- package/src/site.ts +3 -29
- package/src/subsume.ts +1 -161
- package/src/template.ts +69 -140
- package/src/trim.ts +0 -53
- package/src/type.ts +2 -45
- package/src/unify.ts +13 -251
- package/src/utility.ts +0 -31
- package/src/val/AbnfFuncVal.ts +181 -0
- package/src/val/AbsentVal.ts +54 -0
- package/src/val/AggFuncVal.ts +152 -188
- package/src/val/ArithFuncVal.ts +0 -20
- package/src/val/BagVal.ts +1 -78
- package/src/val/BigDecimalVal.ts +0 -16
- package/src/val/BigIntegerVal.ts +0 -16
- package/src/val/CloseFuncVal.ts +0 -9
- package/src/val/CmpFuncVal.ts +249 -0
- package/src/val/ConjunctVal.ts +0 -33
- package/src/val/ConstraintVal.ts +2 -537
- package/src/val/ContainerKindVal.ts +0 -18
- package/src/val/CopyFuncVal.ts +0 -5
- package/src/val/Decimal.ts +1 -185
- package/src/val/DeprecateFuncVal.ts +0 -10
- package/src/val/DisjunctVal.ts +0 -157
- package/src/val/EachFuncVal.ts +12 -53
- package/src/val/EmitFuncVal.ts +8 -208
- package/src/val/ExpectVal.ts +0 -62
- package/src/val/FilterFuncVal.ts +0 -55
- package/src/val/FuncBaseVal.ts +9 -130
- package/src/val/GraphAtomVal.ts +0 -42
- package/src/val/HideFuncVal.ts +0 -15
- package/src/val/IntegerVal.ts +0 -61
- package/src/val/JunctionVal.ts +0 -20
- package/src/val/KeyFuncVal.ts +0 -48
- package/src/val/ListVal.ts +0 -59
- package/src/val/LowerFuncVal.ts +12 -7
- package/src/val/MapVal.ts +0 -151
- package/src/val/MatchFuncVal.ts +0 -59
- package/src/val/MaybeFuncVal.ts +86 -0
- package/src/val/MoveFuncVal.ts +0 -20
- package/src/val/NilVal.ts +2 -36
- package/src/val/NomFuncVal.ts +200 -0
- package/src/val/NumberVal.ts +0 -16
- package/src/val/OpBaseVal.ts +4 -17
- package/src/val/PackFuncVal.ts +0 -63
- package/src/val/PathFuncVal.ts +0 -32
- package/src/val/PathVal.ts +0 -66
- package/src/val/PlaceVal.ts +0 -45
- package/src/val/PlusOpVal.ts +18 -75
- package/src/val/PrefFuncVal.ts +0 -1
- package/src/val/PrefVal.ts +0 -179
- package/src/val/RecurseVal.ts +0 -81
- package/src/val/RefVal.ts +1 -285
- package/src/val/ReferFuncVal.ts +0 -255
- package/src/val/ScalarKindVal.ts +0 -50
- package/src/val/ScalarVal.ts +0 -12
- package/src/val/StrFuncVal.ts +0 -44
- package/src/val/SuperFuncVal.ts +0 -42
- package/src/val/TopVal.ts +0 -1
- package/src/val/TranslateFuncVal.ts +132 -0
- package/src/val/UpperFuncVal.ts +12 -7
- package/src/val/Val.ts +3 -192
- package/src/val/VarVal.ts +0 -15
- package/src/val/arith.ts +0 -92
- package/src/val/caserange.ts +53 -0
- package/src/val/members.ts +0 -23
- package/src/val/numcmp.ts +1 -27
- package/src/val/numkind.ts +0 -149
- package/src/val/valutil.ts +0 -16
- package/src/vet.ts +209 -504
- package/src/view.ts +0 -507
- package/src/walk.ts +0 -41
- package/dist/std.d.ts +0 -3
- package/dist/std.js +0 -637
- package/dist/std.js.map +0 -1
- package/dist/val/FormFuncVal.js +0 -55
- package/dist/val/FormFuncVal.js.map +0 -1
- package/src/std.ts +0 -648
- package/src/val/FormFuncVal.ts +0 -119
package/src/val/MoveFuncVal.ts
CHANGED
|
@@ -18,12 +18,10 @@ import {
|
|
|
18
18
|
} from '../utility'
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
|
|
22
21
|
import { FuncBaseVal } from './FuncBaseVal'
|
|
23
22
|
import { PrefFuncVal } from './PrefFuncVal'
|
|
24
23
|
|
|
25
24
|
|
|
26
|
-
|
|
27
25
|
class MoveFuncVal extends FuncBaseVal {
|
|
28
26
|
isMoveFunc = true
|
|
29
27
|
|
|
@@ -55,23 +53,6 @@ class MoveFuncVal extends FuncBaseVal {
|
|
|
55
53
|
if (!orig.isNil) {
|
|
56
54
|
const src = orig.clone(ctx)
|
|
57
55
|
|
|
58
|
-
// THE HIDE-WALK ONLY RUNS WHEN THE CLONE IS A SEPARATE OBJECT.
|
|
59
|
-
//
|
|
60
|
-
// move() is the only function that marks the ORIGINAL rather than
|
|
61
|
-
// the clone -- that is how the value disappears from its old home
|
|
62
|
-
// and reappears at the destination. It relies on clone() returning
|
|
63
|
-
// something distinct to carry to the destination.
|
|
64
|
-
//
|
|
65
|
-
// TopVal.clone is the IDENTITY function, so for `move(top)` the
|
|
66
|
-
// clone and the original are the same object and the walk hid the
|
|
67
|
-
// very value being returned: the key vanished from generated output
|
|
68
|
-
// with no error, while canon still showed `x:top` -- the port
|
|
69
|
-
// disagreeing with itself.
|
|
70
|
-
//
|
|
71
|
-
// With the walk skipped, `move(top)` keeps `top` at the destination
|
|
72
|
-
// and then errors there because top is not generable, which is
|
|
73
|
-
// already what `x:top`, `x:copy(top)` and `x:pref(top)` do in both
|
|
74
|
-
// ports, and what `move(number)` does for the same reason.
|
|
75
56
|
if (src !== orig) {
|
|
76
57
|
if (src.isRef) {
|
|
77
58
|
src.mark._hide_found = true
|
|
@@ -86,7 +67,6 @@ class MoveFuncVal extends FuncBaseVal {
|
|
|
86
67
|
out = new PrefFuncVal({ peg: [src] }, ctx)
|
|
87
68
|
}
|
|
88
69
|
|
|
89
|
-
// console.log('MOVE-resolve', orig, out)
|
|
90
70
|
|
|
91
71
|
return out
|
|
92
72
|
}
|
package/src/val/NilVal.ts
CHANGED
|
@@ -33,7 +33,6 @@ class NilVal extends Val {
|
|
|
33
33
|
attempt?: string
|
|
34
34
|
details?: Record<string, any>
|
|
35
35
|
|
|
36
|
-
// TODO: include Val generating nil, thus capture type
|
|
37
36
|
|
|
38
37
|
// A Nil is an error - should not happen - unify failed
|
|
39
38
|
// refactor ,make(spec,ctx)
|
|
@@ -79,28 +78,8 @@ class NilVal extends Val {
|
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// correctly and the path only by accident: a value that arrives by
|
|
85
|
-
// REFERENCE is re-pathed to the referring field, and its children
|
|
86
|
-
// are re-pathed to that same field rather than rebased under it, so
|
|
87
|
-
// every conflict inside `q: $.M` reported `$.q` — the enclosing
|
|
88
|
-
// record, not the key to edit, and the SAME path for every one of
|
|
89
|
-
// its fields. The context has descended to the child by the time
|
|
90
|
-
// the meet fails, and Go reads the path off the tree position for
|
|
91
|
-
// exactly this reason.
|
|
92
|
-
//
|
|
93
|
-
// Only EXTENDS, never redirects: the context path is taken when the
|
|
94
|
-
// operand's path is a PREFIX of it, so a nil minted away from the
|
|
95
|
-
// descent (a func resolving an argument, a generator's own probe,
|
|
96
|
-
// an anchored `--at` run whose operand is already correctly placed)
|
|
97
|
-
// keeps the path its operand carries. Taking the context path
|
|
98
|
-
// unconditionally was tried and reverted -- it moved the closed-key,
|
|
99
|
-
// spread-template and every `--at` finding to the driving location,
|
|
100
|
-
// which is not where those belong.
|
|
101
|
-
if (null != ctx?.path && null != nil.path &&
|
|
102
|
-
nil.path.length < ctx.path.length &&
|
|
103
|
-
nil.path.every((p, i) => p === ctx.path[i])) {
|
|
81
|
+
if (null != ctx?.path && 0 < ctx.path.length &&
|
|
82
|
+
(null != bv || null == nil.path || 0 === nil.path.length)) {
|
|
104
83
|
nil.path = [...ctx.path]
|
|
105
84
|
}
|
|
106
85
|
|
|
@@ -145,9 +124,6 @@ class NilVal extends Val {
|
|
|
145
124
|
let out = (super.clone(ctx, spec) as NilVal)
|
|
146
125
|
out.why = this.why
|
|
147
126
|
|
|
148
|
-
// Should these clone?
|
|
149
|
-
// out.primary = this.primary?.clone()
|
|
150
|
-
// out.secondary = this.secondary?.clone()
|
|
151
127
|
out.primary = this.primary
|
|
152
128
|
out.secondary = this.secondary
|
|
153
129
|
|
|
@@ -156,7 +132,6 @@ class NilVal extends Val {
|
|
|
156
132
|
}
|
|
157
133
|
|
|
158
134
|
|
|
159
|
-
// TODO: custom canon? useful for unknown function errors
|
|
160
135
|
get canon() {
|
|
161
136
|
return 'nil'
|
|
162
137
|
}
|
|
@@ -200,15 +175,6 @@ class NilVal extends Val {
|
|
|
200
175
|
}
|
|
201
176
|
|
|
202
177
|
|
|
203
|
-
// Shared sentinel for transient "this unification branch failed"
|
|
204
|
-
// markers. Used by DisjunctVal.unify to flag failed member trials
|
|
205
|
-
// (and to dedup results) without allocating a fresh NilVal per
|
|
206
|
-
// failure. The sentinel is filtered out before the disjunct result
|
|
207
|
-
// is constructed, so its .why / .site / .primary fields are never
|
|
208
|
-
// inspected by user-visible code.
|
|
209
|
-
//
|
|
210
|
-
// Do NOT use this sentinel for errors that may surface: those need
|
|
211
|
-
// real NilVals with proper site/path info for descErr formatting.
|
|
212
178
|
const TRIAL_NIL = new NilVal({ why: '|:trial-nil' }) /* node:coverage ignore next 7 */
|
|
213
179
|
|
|
214
180
|
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/* Copyright (c) 2026 Richard Rodger, MIT License */
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
Val,
|
|
6
|
+
ValSpec,
|
|
7
|
+
} from '../type'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
AontuContext,
|
|
11
|
+
} from '../ctx'
|
|
12
|
+
|
|
13
|
+
import { makeNilErr } from '../err'
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
splitWords,
|
|
17
|
+
caseName,
|
|
18
|
+
lowerASCII,
|
|
19
|
+
capitalise,
|
|
20
|
+
} from '../lower'
|
|
21
|
+
|
|
22
|
+
import { MapVal } from './MapVal'
|
|
23
|
+
import { StringVal } from './StringVal'
|
|
24
|
+
import { FuncBaseVal } from './FuncBaseVal'
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const NOM_STYLES = [
|
|
28
|
+
'camel', // userId
|
|
29
|
+
'dot',
|
|
30
|
+
'kebab',
|
|
31
|
+
'pascal', // UserId
|
|
32
|
+
'path',
|
|
33
|
+
'snake',
|
|
34
|
+
'text',
|
|
35
|
+
'title',
|
|
36
|
+
'upper', // USER_ID
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
// nom's style name -> the `%case` style `caseName` serves. `upper` and
|
|
40
|
+
// `text` are nom's spellings: `screaming` is what `aontu:render` calls
|
|
41
|
+
// SCREAMING_SNAKE and that name is pinned cross-port, so the mapping
|
|
42
|
+
// lives here rather than in the shared vocabulary.
|
|
43
|
+
const CASENAME_STYLES: Record<string, string> = {
|
|
44
|
+
camel: 'camel',
|
|
45
|
+
kebab: 'kebab',
|
|
46
|
+
pascal: 'pascal',
|
|
47
|
+
snake: 'snake',
|
|
48
|
+
upper: 'screaming',
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// One name in one style, or undefined when the style is not one, or
|
|
53
|
+
// when the name holds no words at all.
|
|
54
|
+
function styleName(name: string, style: string, acronyms: string[]):
|
|
55
|
+
string | undefined {
|
|
56
|
+
const src = name.replace(/[./]/g, '_')
|
|
57
|
+
|
|
58
|
+
const words = splitWords(src)
|
|
59
|
+
if (0 === words.length) {
|
|
60
|
+
return undefined
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const cased = CASENAME_STYLES[style]
|
|
64
|
+
if (undefined !== cased) {
|
|
65
|
+
return caseName(src, cased, acronyms)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if ('dot' === style) {
|
|
69
|
+
return words.map(lowerASCII).join('.')
|
|
70
|
+
}
|
|
71
|
+
if ('path' === style) {
|
|
72
|
+
return words.map(lowerASCII).join('/')
|
|
73
|
+
}
|
|
74
|
+
if ('title' === style) {
|
|
75
|
+
return words.map((w) => capitalise(w, acronyms)).join(' ')
|
|
76
|
+
}
|
|
77
|
+
if ('text' === style) {
|
|
78
|
+
const isAcronym = (w: string) =>
|
|
79
|
+
acronyms.some((a) => lowerASCII(a) === lowerASCII(w))
|
|
80
|
+
return [capitalise(words[0], acronyms)]
|
|
81
|
+
.concat(words.slice(1).map((w) =>
|
|
82
|
+
isAcronym(w) ? capitalise(w, acronyms) : lowerASCII(w)))
|
|
83
|
+
.join(' ')
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return undefined
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
// The text a value carries, when it is a concrete string. A path is a
|
|
91
|
+
// string too (ScalarKindVal's Path sits under String), so a spelled
|
|
92
|
+
// address may be renamed like any other text.
|
|
93
|
+
function textOf(v: Val | undefined): string | undefined {
|
|
94
|
+
const s: any = v
|
|
95
|
+
return (true === s?.isScalar && 'string' === typeof s.peg) ? s.peg : undefined
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// An acronym set: a list of concrete strings, or undefined when the
|
|
100
|
+
// value is not one.
|
|
101
|
+
function acronymsOf(v: Val | undefined): string[] | undefined {
|
|
102
|
+
const l: any = v
|
|
103
|
+
if (true !== l?.isList) {
|
|
104
|
+
return undefined
|
|
105
|
+
}
|
|
106
|
+
const out: string[] = []
|
|
107
|
+
for (const el of l.peg as Val[]) {
|
|
108
|
+
const t = textOf(el)
|
|
109
|
+
if (undefined === t || '' === t) {
|
|
110
|
+
return undefined
|
|
111
|
+
}
|
|
112
|
+
out.push(t)
|
|
113
|
+
}
|
|
114
|
+
return out
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class NomFuncVal extends FuncBaseVal {
|
|
119
|
+
isNamerFunc = true
|
|
120
|
+
|
|
121
|
+
constructor(spec: ValSpec, ctx?: AontuContext) {
|
|
122
|
+
super(spec, ctx)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
make(_ctx: AontuContext, spec: ValSpec): Val {
|
|
126
|
+
return new NomFuncVal(spec)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
funcname() {
|
|
130
|
+
return 'nom'
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
resolve(ctx: AontuContext, args: Val[]): Val {
|
|
135
|
+
// Arity is checked at parse (funcArity); see the translate twin.
|
|
136
|
+
const name = textOf(args[0])
|
|
137
|
+
if (undefined === name || '' === name) {
|
|
138
|
+
return makeNilErr(ctx, 'invalid-arg', this, args[0], 'name')
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
let style: string | undefined
|
|
142
|
+
let acronyms: string[] = []
|
|
143
|
+
|
|
144
|
+
if (2 <= args.length) {
|
|
145
|
+
const second: any = args[1]
|
|
146
|
+
if (true === second?.isList) {
|
|
147
|
+
if (3 === args.length) {
|
|
148
|
+
return makeNilErr(ctx, 'invalid-arg', this, args[2], 'arity')
|
|
149
|
+
}
|
|
150
|
+
const acr = acronymsOf(second)
|
|
151
|
+
if (undefined === acr) {
|
|
152
|
+
return makeNilErr(ctx, 'invalid-arg', this, second, 'acronyms')
|
|
153
|
+
}
|
|
154
|
+
acronyms = acr
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
style = textOf(second)
|
|
158
|
+
if (undefined === style) {
|
|
159
|
+
return makeNilErr(ctx, 'invalid-arg', this, second, 'style')
|
|
160
|
+
}
|
|
161
|
+
if (3 === args.length) {
|
|
162
|
+
const acr = acronymsOf(args[2])
|
|
163
|
+
if (undefined === acr) {
|
|
164
|
+
return makeNilErr(ctx, 'invalid-arg', this, args[2], 'acronyms')
|
|
165
|
+
}
|
|
166
|
+
acronyms = acr
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// One style: the string.
|
|
172
|
+
if (undefined !== style) {
|
|
173
|
+
const out = styleName(name, style, acronyms)
|
|
174
|
+
if (undefined === out) {
|
|
175
|
+
return makeNilErr(ctx, 'invalid-arg', this, args[1], 'style')
|
|
176
|
+
}
|
|
177
|
+
return this.place(new StringVal({ peg: out }, ctx))
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const peg: Record<string, Val> = {}
|
|
181
|
+
for (const s of NOM_STYLES) {
|
|
182
|
+
const out = styleName(name, s, acronyms)
|
|
183
|
+
if (undefined === out) {
|
|
184
|
+
return makeNilErr(ctx, 'invalid-arg', this, args[0], 'name')
|
|
185
|
+
}
|
|
186
|
+
peg[s] = new StringVal({ peg: out }, ctx)
|
|
187
|
+
}
|
|
188
|
+
const map = new MapVal({ peg }, ctx)
|
|
189
|
+
map.closed = true
|
|
190
|
+
|
|
191
|
+
return this.place(map)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
} /* node:coverage ignore next 6 */
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
export {
|
|
198
|
+
NOM_STYLES,
|
|
199
|
+
NomFuncVal,
|
|
200
|
+
}
|
package/src/val/NumberVal.ts
CHANGED
|
@@ -20,11 +20,6 @@ import {
|
|
|
20
20
|
} from '../utility'
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
// The IEEE-754 binary64 leaf of the number tower. Its KIND is Float (the
|
|
25
|
-
// keyword `float`), not the `number` supertype: `number` names the family
|
|
26
|
-
// of numeric leaves and never tags a concrete value. The class name is
|
|
27
|
-
// historical -- `number` used to name this leaf.
|
|
28
23
|
class NumberVal extends ScalarVal {
|
|
29
24
|
isNumber = true
|
|
30
25
|
|
|
@@ -35,7 +30,6 @@ class NumberVal extends ScalarVal {
|
|
|
35
30
|
// Number.isFinite (not the coercing global isNaN, which lets null/''
|
|
36
31
|
// through as "numbers") — only an actual finite number is valid.
|
|
37
32
|
if (!Number.isFinite(spec.peg)) {
|
|
38
|
-
// TODO: use Nil?
|
|
39
33
|
throw new AontuError('not-number: ' + spec.peg)
|
|
40
34
|
}
|
|
41
35
|
|
|
@@ -57,8 +51,6 @@ class NumberVal extends ScalarVal {
|
|
|
57
51
|
peer.kind === this.kind &&
|
|
58
52
|
peer.peg === this.peg
|
|
59
53
|
) {
|
|
60
|
-
// Same kind (both Float) and equal value: integer/float no
|
|
61
|
-
// longer cross-unify, so peer is necessarily a NumberVal here.
|
|
62
54
|
out = this
|
|
63
55
|
}
|
|
64
56
|
else if (peer.isTop) {
|
|
@@ -79,14 +71,6 @@ class NumberVal extends ScalarVal {
|
|
|
79
71
|
}
|
|
80
72
|
|
|
81
73
|
|
|
82
|
-
// Canon must round-trip kind: reparsing the canon of a float-kind
|
|
83
|
-
// value has to yield a float-kind value again. A rendering with no
|
|
84
|
-
// '.' and no exponent (1 -> "1") would reparse as an integer, so it
|
|
85
|
-
// gains a ".0" suffix. Renderings that already carry a fraction, an
|
|
86
|
-
// exponent, or are NaN/Infinity are left alone.
|
|
87
|
-
//
|
|
88
|
-
// This is the CANON path only. String coercion inside `+` keeps plain
|
|
89
|
-
// JS parity ("a"+1.0 is "a1"), so it must not pick up the suffix.
|
|
90
74
|
get canon() {
|
|
91
75
|
const s = super.canon
|
|
92
76
|
return (s.includes('.') ||
|
package/src/val/OpBaseVal.ts
CHANGED
|
@@ -34,9 +34,11 @@ import { FeatureVal } from './FeatureVal'
|
|
|
34
34
|
import { hasPlace, fillPlace } from './PlaceVal'
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
37
|
class OpBaseVal extends FeatureVal {
|
|
38
|
+
// An op sorts BEFORE the kinds in a conjunct: only it knows to wait
|
|
39
|
+
// for a staged operand, and a kind met first refuses it outright.
|
|
40
|
+
cjo = 48000
|
|
41
|
+
|
|
40
42
|
isOp = true
|
|
41
43
|
|
|
42
44
|
constructor(
|
|
@@ -79,10 +81,6 @@ class OpBaseVal extends FeatureVal {
|
|
|
79
81
|
return fillPlace(this, peer, ctx).unify(top(), ctx)
|
|
80
82
|
}
|
|
81
83
|
const te = ctx.explain && explainOpen(ctx, ctx.explain, 'Op:' + this.opname(), this, peer)
|
|
82
|
-
// Declared without an initial value: every arm below assigns it, and
|
|
83
|
-
// seeding it with `this` made the two arms that stand the op read as
|
|
84
|
-
// redundant self-assignments. The arms themselves stay as they are —
|
|
85
|
-
// they mirror the dispatch switch in go/op.go arm for arm (ADR-001).
|
|
86
84
|
let out: Val
|
|
87
85
|
|
|
88
86
|
if (this.id == peer.id) {
|
|
@@ -95,9 +93,6 @@ class OpBaseVal extends FeatureVal {
|
|
|
95
93
|
|
|
96
94
|
for (let arg of this.peg) {
|
|
97
95
|
if (!arg.done) {
|
|
98
|
-
// Charged to the depth budget: this recurses without going
|
|
99
|
-
// through `unite`, so the counter would otherwise stay flat
|
|
100
|
-
// while the stack grows (see withDepth in unify.ts).
|
|
101
96
|
const a = arg
|
|
102
97
|
arg = withDepth(ctx, a, top(), () => a.unify(top(), ctx, ec(te, 'ARG')))
|
|
103
98
|
}
|
|
@@ -112,12 +107,10 @@ class OpBaseVal extends FeatureVal {
|
|
|
112
107
|
// takes the OpBaseVal arm below rather than a separate null arm.
|
|
113
108
|
let result: Val = this.operate(ctx, newpeg) || this
|
|
114
109
|
|
|
115
|
-
// TODO: should be result.isOp
|
|
116
110
|
if (result instanceof OpBaseVal) {
|
|
117
111
|
if (peer.isTop) {
|
|
118
112
|
out = this
|
|
119
113
|
}
|
|
120
|
-
// TODO: should peer.isNil
|
|
121
114
|
else if (peer.isNil) {
|
|
122
115
|
out = makeNilErr(ctx, 'op[' + this.peg + ']', this, peer)
|
|
123
116
|
}
|
|
@@ -142,24 +135,20 @@ class OpBaseVal extends FeatureVal {
|
|
|
142
135
|
this.notdone()
|
|
143
136
|
out = this.make(ctx, { peg: newpeg })
|
|
144
137
|
|
|
145
|
-
// TODO: make should handle this using ctx?
|
|
146
138
|
out.site.row = this.site.row
|
|
147
139
|
out.site.col = this.site.col
|
|
148
140
|
out.site.url = this.site.url
|
|
149
141
|
out.path = this.path
|
|
150
142
|
|
|
151
|
-
// why += 'top'
|
|
152
143
|
}
|
|
153
144
|
else if (peer.isNil) {
|
|
154
145
|
this.notdone()
|
|
155
146
|
out = peer
|
|
156
|
-
//why += 'nil'
|
|
157
147
|
}
|
|
158
148
|
else {
|
|
159
149
|
this.notdone()
|
|
160
150
|
out = new ConjunctVal({ peg: [this, peer] }, ctx)
|
|
161
151
|
|
|
162
|
-
// TODO: make should handle this using ctx?
|
|
163
152
|
out.site.row = this.site.row
|
|
164
153
|
out.site.col = this.site.col
|
|
165
154
|
out.site.url = this.site.url
|
|
@@ -228,7 +217,6 @@ class OpBaseVal extends FeatureVal {
|
|
|
228
217
|
undefined
|
|
229
218
|
)
|
|
230
219
|
|
|
231
|
-
// TODO: refactor to use Site
|
|
232
220
|
nil.path = this.path
|
|
233
221
|
nil.site.url = this.site.url
|
|
234
222
|
nil.site.row = this.site.row
|
|
@@ -237,7 +225,6 @@ class OpBaseVal extends FeatureVal {
|
|
|
237
225
|
descErr(nil, ctx)
|
|
238
226
|
|
|
239
227
|
if (ctx) {
|
|
240
|
-
// ctx.err.push(nil)
|
|
241
228
|
ctx.adderr(nil)
|
|
242
229
|
}
|
|
243
230
|
else {
|
package/src/val/PackFuncVal.ts
CHANGED
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
/* Copyright (c) 2025 Richard Rodger, MIT License */
|
|
2
2
|
|
|
3
|
-
// GENERATION: `pack(data, tmpl)` (G8 phase 1,
|
|
4
|
-
// docs/capability-review/g8-generation.md). One child of the result map
|
|
5
|
-
// per child of `data`, each of them `tmpl` cloned at the destination.
|
|
6
|
-
//
|
|
7
|
-
// names: [web, auth, billing]
|
|
8
|
-
// deploy: pack($.names, {
|
|
9
|
-
// image: "acme/" + key() + ":1.4.2"
|
|
10
|
-
// replicas: *2 | integer
|
|
11
|
-
// })
|
|
12
|
-
//
|
|
13
|
-
// WHY A FUNCTION AND NOT SYNTAX. A comprehension would need keywords,
|
|
14
|
-
// a scoping rule, and string interpolation for the computed name; the
|
|
15
|
-
// language already has functions, spread templates, and `key()`, and
|
|
16
|
-
// `pack` is those three composed. A call is also DATA -- a named node
|
|
17
|
-
// in the tree -- so a document that generates stays as analysable as
|
|
18
|
-
// one that does not.
|
|
19
|
-
//
|
|
20
|
-
// KEYS ARE DATA, NOT POSITION. For a list, the strings themselves are
|
|
21
|
-
// the keys (a non-string element is refused: `pack_key`); for a map,
|
|
22
|
-
// its keys. Terraform's `count` keyed by index is the counter-example
|
|
23
|
-
// the review names: reordering the data churns every downstream child.
|
|
24
|
-
// Duplicate keys are not an error -- the colliding children unify,
|
|
25
|
-
// exactly as duplicate source keys already merge.
|
|
26
|
-
//
|
|
27
|
-
// TOTALITY. `pack` iterates a finite, settled bag and cannot call
|
|
28
|
-
// itself: the number of children it can produce is fixed by data that
|
|
29
|
-
// already exists. Nothing here can recurse, which is the guarantee the
|
|
30
|
-
// combinators exist to keep.
|
|
31
3
|
|
|
32
4
|
import type {
|
|
33
5
|
Val,
|
|
@@ -47,14 +19,7 @@ import { fillPlace } from './PlaceVal'
|
|
|
47
19
|
import { bagMembers } from './members'
|
|
48
20
|
|
|
49
21
|
|
|
50
|
-
// The keys a data bag names, in the order the result must carry them,
|
|
51
|
-
// or a code naming what is wrong with it. Shared with `each`, which
|
|
52
|
-
// asks the same question of the same argument and answers it with the
|
|
53
|
-
// values rather than the keys.
|
|
54
22
|
function dataKeys(data: Val | undefined, ctx: AontuContext): string[] | string {
|
|
55
|
-
// The candidates are the bag's MEMBERS -- what generation would
|
|
56
|
-
// emit (./members.ts, BUGS.md §79) -- so a hidden key, or a hidden
|
|
57
|
-
// name in a list of names, packs nothing.
|
|
58
23
|
const members = bagMembers(data, ctx)
|
|
59
24
|
|
|
60
25
|
if (undefined === members) {
|
|
@@ -83,11 +48,6 @@ function dataKeys(data: Val | undefined, ctx: AontuContext): string[] | string {
|
|
|
83
48
|
class PackFuncVal extends FuncBaseVal {
|
|
84
49
|
isPackFunc = true
|
|
85
50
|
|
|
86
|
-
// THE STAGING RULE (G8 phase 0, see AontuContext.settle). A
|
|
87
|
-
// generator's data argument is not settled merely by being `done`
|
|
88
|
-
// once: a sibling conjunct, an include or a spread can still merge
|
|
89
|
-
// keys into it, and children generated from the half-merged bag
|
|
90
|
-
// would be missing. It fires on the settle pass and only then.
|
|
91
51
|
staged = true
|
|
92
52
|
|
|
93
53
|
constructor(
|
|
@@ -98,17 +58,11 @@ class PackFuncVal extends FuncBaseVal {
|
|
|
98
58
|
}
|
|
99
59
|
|
|
100
60
|
|
|
101
|
-
|
|
102
61
|
funcname() {
|
|
103
62
|
return 'pack'
|
|
104
63
|
}
|
|
105
64
|
|
|
106
65
|
|
|
107
|
-
// The TEMPLATE IS NOT AN ARGUMENT TO DRIVE. Driving it would resolve
|
|
108
|
-
// its `key()` at the CALL SITE -- the one position the template is
|
|
109
|
-
// never used at -- and freeze whatever else in it is path-dependent
|
|
110
|
-
// there too. The data argument is driven by `unify` below instead,
|
|
111
|
-
// one argument by hand rather than all of them by the base.
|
|
112
66
|
prepare(_ctx: AontuContext, _args: Val[]) {
|
|
113
67
|
return null
|
|
114
68
|
}
|
|
@@ -140,24 +94,7 @@ class PackFuncVal extends FuncBaseVal {
|
|
|
140
94
|
|
|
141
95
|
for (const key of keys) {
|
|
142
96
|
const keyctx = ctx.descend(key)
|
|
143
|
-
// THE PLACEHOLDER BINDS THE SOURCE CHILD (G8 phase 3): inside a
|
|
144
|
-
// generator's template `_` is the datum this child is being made
|
|
145
|
-
// FROM. For a map that is the child's value; for a list of names
|
|
146
|
-
// it is the name, which is also the key -- so `_` and `key()`
|
|
147
|
-
// agree there, and differ the moment the data is a map.
|
|
148
97
|
const source: Val = true === src?.isMap ? src.peg[key] : src.peg[keys.indexOf(key)]
|
|
149
|
-
// CLONED, never shared. A spread may share a template that holds
|
|
150
|
-
// nothing path-dependent (MapVal.spreadClone), because a spread
|
|
151
|
-
// CONSTRAINS a child that exists; a generator's template IS the
|
|
152
|
-
// child, and a child is a position. Sharing left every generated
|
|
153
|
-
// child pointing at the template's own parse-time location, which
|
|
154
|
-
// is the position the template is never used at -- visible as the
|
|
155
|
-
// site an error inside a generated child reports.
|
|
156
|
-
//
|
|
157
|
-
// A FULL INSTANCE, to the leaves (`dup`, ADR-005): a bare clone
|
|
158
|
-
// shares the inner structure of any call, preference or
|
|
159
|
-
// operation in the template, so the first child's resolution of
|
|
160
|
-
// a shared key()/ref answered for every child (BUGS.md §8, §9).
|
|
161
98
|
const inst = tmpl.clone(keyctx, { dup: true })
|
|
162
99
|
repathInstance(inst, inst.path)
|
|
163
100
|
const child = fillPlace(inst, source, keyctx)
|
package/src/val/PathFuncVal.ts
CHANGED
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
/* Copyright (c) 2021-2025 Richard Rodger, MIT License */
|
|
2
2
|
|
|
3
|
-
// THE PATH CONSTRUCTOR (docs/design/PATHS.0.md). `path(p)` CAPTURES
|
|
4
|
-
// `p` -- the one non-strict argument position in the language: every
|
|
5
|
-
// other call reads its argument's value, this one reads its spelling.
|
|
6
|
-
// `path($.a.b)` is the address `$.a.b` as a first-class value, not
|
|
7
|
-
// the value found there; a plain reference (`$.a.b` alone) stays the
|
|
8
|
-
// embedding it has always been.
|
|
9
|
-
//
|
|
10
|
-
// The capture happens in prepare(), which receives the argument
|
|
11
|
-
// BEFORE the driving loop resolves it -- the same interception this
|
|
12
|
-
// function always used, now kept instead of released: the RefVal's
|
|
13
|
-
// spelling is read off its segments and the RefVal itself is never
|
|
14
|
-
// driven, so no pass ever holds a resolvable reference here.
|
|
15
|
-
//
|
|
16
|
-
// `path()` with no argument is the path KIND (PathKindVal): the
|
|
17
|
-
// vacuous constructor call is the kind, as `{}`-the-unit is to maps
|
|
18
|
-
// -- see ContainerKindVal for the other half of that convention.
|
|
19
|
-
//
|
|
20
|
-
// A string argument is read by the ADDRESS grammar, not resolved as a
|
|
21
|
-
// segment: `path("$.a")` is the same capture `path($.a)` is, and text
|
|
22
|
-
// with no anchor is RELATIVE (`path("a.b")` is `path(.a.b)`, the
|
|
23
|
-
// address the raw spelling captures). A COMPUTED argument -- an
|
|
24
|
-
// expression, a reference to a string -- is the one shape that does
|
|
25
|
-
// evaluate: the driven result converts by the same grammar at
|
|
26
|
-
// resolve, which is what makes an address buildable (`refer() &
|
|
27
|
-
// path("$.customers." + key())`) while a bare string still never IS
|
|
28
|
-
// one (ADR-016): the conversion happens only inside this call.
|
|
29
3
|
|
|
30
4
|
import type {
|
|
31
5
|
Val,
|
|
@@ -110,12 +84,6 @@ class PathFuncVal extends FuncBaseVal {
|
|
|
110
84
|
return []
|
|
111
85
|
}
|
|
112
86
|
|
|
113
|
-
// The captured spelling, from a reference's segments or from a
|
|
114
|
-
// string literal read as address text. Both go through
|
|
115
|
-
// parseAddress, so what capture admits and what refer reads
|
|
116
|
-
// cannot drift. Anything else -- an expression, a reference to
|
|
117
|
-
// a string -- is left for the driving loop, and resolve
|
|
118
|
-
// converts the driven result below.
|
|
119
87
|
let spelling: string | undefined
|
|
120
88
|
if (true === arg.isRef) {
|
|
121
89
|
spelling = captureSpelling(arg)
|