aontu 0.62.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 +1 -1
- package/dist/agentsmd.js +0 -27
- package/dist/agentsmd.js.map +1 -1
- package/dist/alias.js.map +1 -1
- package/dist/allow.js +0 -92
- package/dist/allow.js.map +1 -1
- package/dist/aontu.d.ts +1 -1
- package/dist/aontu.js +1 -79
- 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.js +101 -620
- 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 +13 -203
- 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.js +1 -1
- package/dist/helpdoc.js.map +1 -1
- package/dist/hints.d.ts +0 -6
- package/dist/hints.js +54 -55
- 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 +17 -915
- package/dist/lang.js.map +1 -1
- package/dist/lower.js +11 -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.js +0 -61
- package/dist/relation.js.map +1 -1
- package/dist/render.js +20 -135
- 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.js +2 -59
- package/dist/val/CmpFuncVal.js.map +1 -1
- 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.js +0 -3
- 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 +0 -11
- 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 +0 -60
- package/dist/val/NilVal.js.map +1 -1
- package/dist/val/NomFuncVal.js +8 -42
- package/dist/val/NomFuncVal.js.map +1 -1
- 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.js +1 -3
- package/dist/val/TranslateFuncVal.js.map +1 -1
- package/dist/val/UpperFuncVal.js +0 -11
- 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.js +0 -61
- package/dist/val/caserange.js.map +1 -1
- 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.js +0 -461
- 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 +8 -6
- package/grammar/aontu.gbnf +4 -4
- package/grammar/aontu.lark +4 -4
- package/grammar/aontu.tmLanguage.json +1 -1
- package/package.json +4 -2
- package/src/agentsmd.ts +0 -35
- package/src/alias.ts +0 -39
- package/src/allow.ts +1 -96
- package/src/aontu.ts +3 -110
- package/src/aontumodel.ts +32 -0
- package/src/cli.ts +113 -682
- 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 +14 -257
- package/src/grammar.ts +72 -0
- package/src/graph.ts +0 -61
- package/src/hcanon.ts +0 -82
- package/src/helpdoc.ts +1 -1
- package/src/hints.ts +66 -57
- package/src/jsonschema.ts +0 -123
- package/src/keyorder.ts +0 -42
- package/src/lang.ts +19 -931
- package/src/lower.ts +12 -62
- 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 +0 -84
- package/src/render.ts +20 -172
- 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 +4 -166
- 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 +0 -40
- 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 +0 -12
- 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 +0 -60
- package/src/val/NomFuncVal.ts +8 -95
- 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 +1 -51
- package/src/val/UpperFuncVal.ts +0 -12
- 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 +0 -62
- 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 +1 -582
- package/src/view.ts +0 -507
- package/src/walk.ts +0 -41
- package/dist/std.d.ts +0 -3
- package/dist/std.js +0 -672
- package/dist/std.js.map +0 -1
- package/dist/val/FormFuncVal.js +0 -55
- package/dist/val/FormFuncVal.js.map +0 -1
- package/dist/val/NamerFuncVal.d.ts +0 -12
- package/dist/val/NamerFuncVal.js +0 -176
- package/dist/val/NamerFuncVal.js.map +0 -1
- package/src/std.ts +0 -683
package/src/val/BigIntegerVal.ts
CHANGED
|
@@ -21,18 +21,6 @@ import {
|
|
|
21
21
|
} from '../utility'
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
// The unbounded exact integer leaf of the number tower, reached only by
|
|
25
|
-
// a `0d` literal with no fraction and no exponent (`0d5`, `-0d5`,
|
|
26
|
-
// `0d123456789012345678901234567890`) or by direct construction.
|
|
27
|
-
//
|
|
28
|
-
// Its peg is a native bigint: exact at any magnitude, immutable, and
|
|
29
|
-
// compared by VALUE with `===` (D2 -- two separately built bigints
|
|
30
|
-
// holding the same number are `===`, which is exactly the property the
|
|
31
|
-
// Go port has to reproduce by hand for `*big.Int`).
|
|
32
|
-
//
|
|
33
|
-
// `biginteger` is DISJOINT from `integer`: `5 & 0d5` is an error, since
|
|
34
|
-
// a successful meet would have to pick one of the two kinds and either
|
|
35
|
-
// choice makes `&` asymmetric in kind.
|
|
36
24
|
class BigIntegerVal extends ScalarVal {
|
|
37
25
|
isBigInteger = true
|
|
38
26
|
|
|
@@ -42,10 +30,6 @@ class BigIntegerVal extends ScalarVal {
|
|
|
42
30
|
spec: ValSpec,
|
|
43
31
|
ctx?: AontuContext
|
|
44
32
|
) {
|
|
45
|
-
// Exact-input construction (D8): a bigint, or the digits as text. A
|
|
46
|
-
// JS `number` is deliberately NOT accepted -- it has already been
|
|
47
|
-
// rounded before this library could inspect it, so an exact value
|
|
48
|
-
// above 2^53 could never arrive that way intact.
|
|
49
33
|
let peg = spec.peg
|
|
50
34
|
if ('string' === typeof peg) {
|
|
51
35
|
if (!/^[-+]?[0-9]+$/.test(peg)) {
|
package/src/val/CloseFuncVal.ts
CHANGED
|
@@ -46,16 +46,7 @@ class CloseFuncVal extends FuncBaseVal {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
if (argval.isMap || argval.isList) {
|
|
49
|
-
// The in-place write is safe BECAUSE of the per-destination
|
|
50
|
-
// instantiation rule (ADR-005): everywhere a close() call is
|
|
51
|
-
// multiplied — a pack/each template, a spread constraint — the
|
|
52
|
-
// clone now owns its argument (`dup`), so `closed` lands on that
|
|
53
|
-
// instance alone. Cloning the bag here instead was tried and
|
|
54
|
-
// rejected: the re-path it implies corrupts the source
|
|
55
|
-
// attribution of children inside nested spread templates (the
|
|
56
|
-
// 06-k8s use case's env findings named the wrong path).
|
|
57
49
|
(argval as BagVal).closed = true
|
|
58
|
-
// console.log('CLOSED', argval.canon)
|
|
59
50
|
}
|
|
60
51
|
|
|
61
52
|
return argval
|
package/src/val/CmpFuncVal.ts
CHANGED
|
@@ -1,97 +1,5 @@
|
|
|
1
1
|
/* Copyright (c) 2026 Richard Rodger, MIT License */
|
|
2
2
|
|
|
3
|
-
// THE COMPONENT PRIMITIVES -- SPIKE (docs/design/JOSTRACA.0.md).
|
|
4
|
-
//
|
|
5
|
-
// `Folder`, `File` and `Content` are the first three of jostraca's
|
|
6
|
-
// component set, spelled as aontu functions and keeping jostraca's
|
|
7
|
-
// own capitalisation. They are the authoring surface an aontu
|
|
8
|
-
// document uses to say what FILES it produces:
|
|
9
|
-
//
|
|
10
|
-
// out: folder("src", [
|
|
11
|
-
// file("main.ts", [
|
|
12
|
-
// content("export const x = 1")
|
|
13
|
-
// ])
|
|
14
|
-
// ])
|
|
15
|
-
//
|
|
16
|
-
// WHAT THIS REPLACES. `aontu:code` (ts/src/std.ts, test/spec/
|
|
17
|
-
// aontu-code.tsv) is a hand-written vocabulary an author fills in as
|
|
18
|
-
// DATA -- `aontu: Code: units: [{path, lang, decls}]` -- and `aontu
|
|
19
|
-
// render` folds that instance into bytes. The instance is checked by
|
|
20
|
-
// unification against the vocabulary, which is the good half; the bad
|
|
21
|
-
// half is that an author writes a schema instance rather than a
|
|
22
|
-
// generator, the vocabulary owns every construct the renderer will
|
|
23
|
-
// ever emit, and nothing in it corresponds to a component someone can
|
|
24
|
-
// already write in jostraca. These primitives take the other road:
|
|
25
|
-
// the CALL is the construct, the call's own resolve is where the
|
|
26
|
-
// shape is refused, and the value it lands is a jostraca component
|
|
27
|
-
// tree that jostraca's build phase already knows how to walk.
|
|
28
|
-
//
|
|
29
|
-
// THE VALUE IS AN ORDINARY MAP, which is the whole reason this can be
|
|
30
|
-
// a spike at all. A component call resolves to
|
|
31
|
-
//
|
|
32
|
-
// {cmp: "Folder", props: {name: "src"}, children: [...]}
|
|
33
|
-
//
|
|
34
|
-
// so nothing downstream needs new machinery: `generate()` emits the
|
|
35
|
-
// tree as JSON, `canon` renders the calls back, references and
|
|
36
|
-
// spreads reach into a tree as they reach into any map, and `each()`
|
|
37
|
-
// over model data drops straight into a `children` list -- which is
|
|
38
|
-
// the point, and is why the second argument must BE a list rather
|
|
39
|
-
// than accepting a bare node as a convenience. `each($.fields,
|
|
40
|
-
// content(...))` is already the list; a one-child special case would
|
|
41
|
-
// make `file(n, each(...))` and `file(n, [each(...)])` both legal and
|
|
42
|
-
// different.
|
|
43
|
-
//
|
|
44
|
-
// CHILDREN FLATTEN, for the same reason. A generator's output lands
|
|
45
|
-
// in the MIDDLE of a written list --
|
|
46
|
-
//
|
|
47
|
-
// file("planet.ts", [
|
|
48
|
-
// content("export interface Planet {"),
|
|
49
|
-
// each($.fields, content(" " + _ + ": string")),
|
|
50
|
-
// content("}")
|
|
51
|
-
// ])
|
|
52
|
-
//
|
|
53
|
-
// -- and that list therefore holds two nodes and a LIST OF NODES. A
|
|
54
|
-
// list is not a node and could only be an error otherwise, so
|
|
55
|
-
// splicing is the total rule and nesting is not: children are
|
|
56
|
-
// flattened to any depth before the containment grammar is checked.
|
|
57
|
-
// This is the finding the spike's worked example produced; every
|
|
58
|
-
// component system that takes children arrives at it.
|
|
59
|
-
//
|
|
60
|
-
// THE NODE MAP IS CLOSED and its `props` map is not. The three keys
|
|
61
|
-
// are the vocabulary and a fourth is a mistake, so a typo in
|
|
62
|
-
// `folder(...) & {childrn: []}` is refused where every other mistake
|
|
63
|
-
// in an aontu document is refused. Props are the COMPONENT's business
|
|
64
|
-
// -- jostraca's File already reads `mode` and `exclude`, and a
|
|
65
|
-
// component the spike does not implement will read its own -- so they
|
|
66
|
-
// pass through, and only the one prop each primitive cannot work
|
|
67
|
-
// without is checked here.
|
|
68
|
-
//
|
|
69
|
-
// THE CONTAINMENT GRAMMAR IS CHECKED AT THE CALL. A Folder holds
|
|
70
|
-
// folders and files, a File holds content, and Content holds nothing.
|
|
71
|
-
// Unification cannot state that on its own -- a node is a map, and
|
|
72
|
-
// every node map unifies with every other -- so the constructor
|
|
73
|
-
// states it, at the site the author wrote, which is the argument for
|
|
74
|
-
// making these functions rather than another vocabulary.
|
|
75
|
-
//
|
|
76
|
-
// NOT STAGED, deliberately. A component call answers from its
|
|
77
|
-
// arguments alone: it has no dependence on WHERE it sits (unlike
|
|
78
|
-
// `key()`) and it reads no bag that a sibling may still merge into
|
|
79
|
-
// (unlike `pack`/`each`). A children list BUILT by one of
|
|
80
|
-
// those combinators still waits, because the combinator residuates
|
|
81
|
-
// and the enclosing call is not `pegdone` until it fires -- so the
|
|
82
|
-
// ordinary args-done gate is the correct one and the staging rule
|
|
83
|
-
// costs nothing here.
|
|
84
|
-
//
|
|
85
|
-
// SPIKE SCOPE. TypeScript only; no Go port yet, and so:
|
|
86
|
-
// deliberately absent from `test/spec/signature.tsv`, from
|
|
87
|
-
// `BUILTIN_FUNCS` (ts/src/lsp.ts) and from the `grammar/` files, all
|
|
88
|
-
// three of which are pinned in cross-port parity and would go red on
|
|
89
|
-
// a TS-only change. Argument arity and shape are therefore refused
|
|
90
|
-
// HERE rather than by the parse-time arity table or the signature
|
|
91
|
-
// gate, both of which read the declaration this spike does not have.
|
|
92
|
-
// Failures are `invalid-arg` for the same reason -- a new code needs
|
|
93
|
-
// a row in test/spec/errcodes.tsv and an entry in BOTH ports' code
|
|
94
|
-
// tables (AGENTS.md, "The shared test suite").
|
|
95
3
|
|
|
96
4
|
import type {
|
|
97
5
|
Val,
|
|
@@ -110,43 +18,23 @@ import { StringVal } from './StringVal'
|
|
|
110
18
|
import { FuncBaseVal } from './FuncBaseVal'
|
|
111
19
|
|
|
112
20
|
|
|
113
|
-
// The component names this spike serves, each with the children it
|
|
114
|
-
// admits and the one prop it cannot work without. Adding a fourth
|
|
115
|
-
// primitive is an entry here plus the two-line subclass below.
|
|
116
21
|
type CmpDef = {
|
|
117
|
-
// The jostraca component this call builds. CAPITALISED, because it
|
|
118
|
-
// names a component in the other project's exported set and the
|
|
119
|
-
// bridge looks it up by that name -- while the aontu FUNCTION is
|
|
120
|
-
// lower case, like every other builtin in this language. The two
|
|
121
|
-
// spellings say what they are: `file(...)` is aontu, `"File"` is
|
|
122
|
-
// jostraca's.
|
|
123
22
|
cmp: string
|
|
124
23
|
// The children this component admits, by aontu function name. Empty
|
|
125
24
|
// means a leaf: any child at all is a mistake.
|
|
126
25
|
children: string[]
|
|
127
|
-
// The prop a bare string argument fills. ABSENT means the component
|
|
128
|
-
// has no one-string spelling and its spec must be a map: `listitems`
|
|
129
|
-
// is driven by a LIST, and there is no sensible string to promote.
|
|
130
26
|
text?: string
|
|
131
27
|
// Whether that prop is required. `project`'s folder is the one that
|
|
132
|
-
// is not:
|
|
28
|
+
// is not: Jostraca defaults it to `.`, and the data path must not be
|
|
133
29
|
// stricter than the component it drives.
|
|
134
30
|
req: boolean
|
|
135
31
|
// A prop that must be present and must be a list.
|
|
136
32
|
bag?: string
|
|
137
33
|
}
|
|
138
34
|
|
|
139
|
-
// EIGHT OF JOSTRACA'S TEN COMPONENTS. `Copy` and `List` are missing and
|
|
140
|
-
// cannot be added under these rules: `copy` and `list` are already
|
|
141
|
-
// aontu builtins with settled, unrelated meanings -- `copy(v)` copies a
|
|
142
|
-
// VALUE and `list()` is the list container kind, both declared in
|
|
143
|
-
// test/spec/signature.tsv and implemented in both ports. Lower-casing
|
|
144
|
-
// jostraca's names onto them would either shadow landed language
|
|
145
|
-
// surface or make one name mean two things by arity, and neither is a
|
|
146
|
-
// trade a spike gets to make. See docs/design/JOSTRACA.0.md.
|
|
147
35
|
const CMP_DEF: Record<string, CmpDef> = {
|
|
148
36
|
// The output root. Its `folder` is refused an absolute path or a
|
|
149
|
-
// `..` segment on the
|
|
37
|
+
// `..` segment on the Jostraca side, where the tree is data.
|
|
150
38
|
project: {
|
|
151
39
|
cmp: 'Project', text: 'folder', req: false,
|
|
152
40
|
children: ['project', 'folder', 'file', 'copyfiles'],
|
|
@@ -159,8 +47,6 @@ const CMP_DEF: Record<string, CmpDef> = {
|
|
|
159
47
|
cmp: 'File', text: 'name', req: true,
|
|
160
48
|
children: ['content', 'line', 'fragment', 'inject', 'listitems', 'copyfiles'],
|
|
161
49
|
},
|
|
162
|
-
// A span of text, exactly as written. `FileOp` joins a file's spans
|
|
163
|
-
// with the empty string, so a `content` carries its own terminator.
|
|
164
50
|
content: {
|
|
165
51
|
cmp: 'Content', text: 'src', req: true,
|
|
166
52
|
children: [],
|
|
@@ -190,30 +76,12 @@ const CMP_DEF: Record<string, CmpDef> = {
|
|
|
190
76
|
cmp: 'CopyFiles', text: 'from', req: true,
|
|
191
77
|
children: [],
|
|
192
78
|
},
|
|
193
|
-
// `List` under a name that says what it does: it renders its children
|
|
194
|
-
// ONCE PER ELEMENT of `item`, binding jostraca's `{item}` and
|
|
195
|
-
// `{item.path}` macros, and adds a trailing blank line unless
|
|
196
|
-
// `line: false`.
|
|
197
|
-
//
|
|
198
|
-
// IT IS THE ONE COMPONENT THE AONTU SIDE ALREADY SUBSUMES, and a
|
|
199
|
-
// generator should reach for `each()` first. `each($.rows, content(...))`
|
|
200
|
-
// repeats in the MODEL, so the repetition is finished before the tree
|
|
201
|
-
// exists and every produced node is data a document can reference,
|
|
202
|
-
// vet and diff. `listitems` defers it into jostraca's define phase behind
|
|
203
|
-
// a string macro aontu cannot see into -- which is the layer this
|
|
204
|
-
// spike exists to remove. It is here so the component set is
|
|
205
|
-
// complete, not because it is the better spelling.
|
|
206
79
|
listitems: {
|
|
207
80
|
cmp: 'ListItems', req: true, bag: 'item',
|
|
208
81
|
children: ['content', 'line', 'fragment'],
|
|
209
82
|
},
|
|
210
83
|
}
|
|
211
84
|
|
|
212
|
-
// The component name a value carries, when the value is a node this
|
|
213
|
-
// vocabulary built. Read structurally rather than by class, because a
|
|
214
|
-
// node reaches a children list as a MAP -- through a reference, a
|
|
215
|
-
// `each()` instance, a spread -- long after the call that made it has
|
|
216
|
-
// resolved away.
|
|
217
85
|
const BY_CMP: Record<string, string> = {}
|
|
218
86
|
for (const fname of Object.keys(CMP_DEF)) {
|
|
219
87
|
BY_CMP[CMP_DEF[fname].cmp] = fname
|
|
@@ -232,7 +100,6 @@ function nodeCmp(v: any): string | undefined {
|
|
|
232
100
|
}
|
|
233
101
|
|
|
234
102
|
|
|
235
|
-
// A prop's text, when the prop is a concrete string.
|
|
236
103
|
function propText(props: any, key: string): string | undefined {
|
|
237
104
|
const v: any = props?.peg?.[key]
|
|
238
105
|
return (true === v?.isScalar && 'string' === typeof v.peg) ? v.peg : undefined
|
|
@@ -243,7 +110,7 @@ class CmpFuncVal extends FuncBaseVal {
|
|
|
243
110
|
isCmpFunc = true
|
|
244
111
|
|
|
245
112
|
// The component this call builds: the function's own name, which is
|
|
246
|
-
// also the `cmp` key of the node and the
|
|
113
|
+
// also the `cmp` key of the node and the Jostraca component the
|
|
247
114
|
// bridge looks up.
|
|
248
115
|
cmp: string
|
|
249
116
|
|
|
@@ -264,24 +131,8 @@ class CmpFuncVal extends FuncBaseVal {
|
|
|
264
131
|
|
|
265
132
|
resolve(ctx: AontuContext, args: Val[]): Val {
|
|
266
133
|
const def: CmpDef = CMP_DEF[this.cmp]
|
|
267
|
-
const leaf = 0 === def.children.length
|
|
268
|
-
|
|
269
|
-
// ARITY, refused here (see the spike-scope note above): a leaf
|
|
270
|
-
// takes its spec alone, a container takes a spec and an optional
|
|
271
|
-
// children list.
|
|
272
|
-
// A component whose text prop is OPTIONAL may be called with
|
|
273
|
-
// nothing at all: `project()` is the defaulted root, as
|
|
274
|
-
// `project({})` is on the other side. Everything else needs its
|
|
275
|
-
// spec.
|
|
276
|
-
if (args.length < (def.req ? 1 : 0) || args.length > (leaf ? 1 : 2)) {
|
|
277
|
-
return makeNilErr(ctx, 'invalid-arg', this, undefined, 'arity')
|
|
278
|
-
}
|
|
279
134
|
|
|
280
|
-
//
|
|
281
|
-
// the one prop the component cannot work without, so the common
|
|
282
|
-
// case reads as the component does -- `file("main.ts", ...)` --
|
|
283
|
-
// and the map spelling is there the moment a second prop is
|
|
284
|
-
// wanted: `file({name: "run.sh", mode: 0o755}, ...)`.
|
|
135
|
+
// Arity is checked at parse (funcArity); args[0] can be undefined.
|
|
285
136
|
const spec: any = args[0]
|
|
286
137
|
let props: Val
|
|
287
138
|
if (undefined === spec) {
|
|
@@ -300,8 +151,6 @@ class CmpFuncVal extends FuncBaseVal {
|
|
|
300
151
|
return makeNilErr(ctx, 'invalid-arg', this, spec, 'spec')
|
|
301
152
|
}
|
|
302
153
|
|
|
303
|
-
// The one prop that is not the component's own business: without
|
|
304
|
-
// it there is no file to write and no content to write into one.
|
|
305
154
|
if (undefined !== def.text) {
|
|
306
155
|
const text = propText(props, def.text)
|
|
307
156
|
if (def.req && (undefined === text || '' === text)) {
|
|
@@ -323,10 +172,6 @@ class CmpFuncVal extends FuncBaseVal {
|
|
|
323
172
|
}
|
|
324
173
|
}
|
|
325
174
|
|
|
326
|
-
// THE CHILDREN, flattened, then the containment grammar. Absent
|
|
327
|
-
// is empty -- an empty folder and a file with no content are both
|
|
328
|
-
// things a model may legitimately say -- and every node that
|
|
329
|
-
// survives the flattening must be one this component admits.
|
|
330
175
|
const kids: any = args[1]
|
|
331
176
|
let children: Val
|
|
332
177
|
if (undefined === kids) {
|
|
@@ -369,8 +214,6 @@ class CmpFuncVal extends FuncBaseVal {
|
|
|
369
214
|
}
|
|
370
215
|
}, ctx)
|
|
371
216
|
|
|
372
|
-
// Closed: the three keys ARE the node vocabulary (see the note
|
|
373
|
-
// above). `props` is left open on purpose.
|
|
374
217
|
node.closed = true
|
|
375
218
|
|
|
376
219
|
return this.place(node)
|
|
@@ -379,11 +222,6 @@ class CmpFuncVal extends FuncBaseVal {
|
|
|
379
222
|
} /* node:coverage ignore next 3 */
|
|
380
223
|
|
|
381
224
|
|
|
382
|
-
// ONE CLASS PER COMPONENT, generated from the table, because the
|
|
383
|
-
// registry constructs by `new funcval({peg: args})` and so needs a
|
|
384
|
-
// constructor per name. Written as a factory rather than eight
|
|
385
|
-
// near-identical subclasses: the table is the single statement of what
|
|
386
|
-
// exists, and a ninth component is a row in it and nothing else.
|
|
387
225
|
function cmpFuncClass(fname: string): any {
|
|
388
226
|
class Cmp extends CmpFuncVal {
|
|
389
227
|
constructor(spec: ValSpec, ctx?: AontuContext) {
|
package/src/val/ConjunctVal.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* Copyright (c) 2021-2025 Richard Rodger, MIT License */
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
import type {
|
|
6
5
|
Val,
|
|
7
6
|
ValSpec,
|
|
@@ -32,14 +31,11 @@ import {
|
|
|
32
31
|
} from '../utility'
|
|
33
32
|
|
|
34
33
|
|
|
35
|
-
|
|
36
34
|
import {
|
|
37
35
|
top
|
|
38
36
|
} from './top'
|
|
39
37
|
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
// TODO: move main logic to op/conjunct
|
|
43
39
|
class ConjunctVal extends JunctionVal {
|
|
44
40
|
isConjunct = true
|
|
45
41
|
isGenable = true
|
|
@@ -78,7 +74,6 @@ class ConjunctVal extends JunctionVal {
|
|
|
78
74
|
|
|
79
75
|
this.peg = norm(this.peg)
|
|
80
76
|
|
|
81
|
-
// console.log('\nCONJUNCT', ctx.cc, this.id, this.canon, peer.id, peer.canon)
|
|
82
77
|
|
|
83
78
|
// Unify each term of conjunct against peer
|
|
84
79
|
let upeer: Val[] = []
|
|
@@ -87,7 +82,6 @@ class ConjunctVal extends JunctionVal {
|
|
|
87
82
|
let newhide = this.mark.hide || peer.mark.hide
|
|
88
83
|
|
|
89
84
|
for (let vI = 0; vI < this.peg.length; vI++) {
|
|
90
|
-
// console.log('CONJUNCT-peg', vI, this.peg[vI].canon, this.peg[vI].mark)
|
|
91
85
|
newtype = this.peg[vI].mark.type || newtype
|
|
92
86
|
newhide = this.peg[vI].mark.hide || newhide
|
|
93
87
|
}
|
|
@@ -95,7 +89,6 @@ class ConjunctVal extends JunctionVal {
|
|
|
95
89
|
for (let vI = 0; vI < this.peg.length; vI++) {
|
|
96
90
|
this.peg[vI].mark.type = newtype
|
|
97
91
|
this.peg[vI].mark.hide = newhide
|
|
98
|
-
// console.log('CONJUNCT-TERM', this.id, vI, this.peg[vI].canon)
|
|
99
92
|
|
|
100
93
|
upeer[vI] = (this.peg[vI].done && peer.isTop) ? this.peg[vI] :
|
|
101
94
|
unite(te ? ctx.clone({ explain: ec(te, 'OWN') }) : ctx, this.peg[vI], peer, 'cj-own')
|
|
@@ -103,17 +96,10 @@ class ConjunctVal extends JunctionVal {
|
|
|
103
96
|
upeer[vI].mark.type = newtype = newtype || upeer[vI].mark.type
|
|
104
97
|
upeer[vI].mark.hide = newhide = newhide || upeer[vI].mark.hide
|
|
105
98
|
|
|
106
|
-
// let prevdone = done
|
|
107
99
|
done = done && (DONE === upeer[vI].dc)
|
|
108
100
|
|
|
109
101
|
if (upeer[vI].isNil) {
|
|
110
102
|
return upeer[vI]
|
|
111
|
-
// return Nil.make(
|
|
112
|
-
// ctx,
|
|
113
|
-
// '&peer[' + upeer[vI].canon + ',' + peer.canon + ']',
|
|
114
|
-
// this.peg[vI],
|
|
115
|
-
// peer
|
|
116
|
-
// )
|
|
117
103
|
}
|
|
118
104
|
}
|
|
119
105
|
|
|
@@ -155,7 +141,6 @@ class ConjunctVal extends JunctionVal {
|
|
|
155
141
|
|
|
156
142
|
else {
|
|
157
143
|
val = unite(te ? ctx.clone({ explain: ec(te, 'DEF') }) : ctx, t0, t1, 'cj-peer-t0t1')
|
|
158
|
-
// console.log('CONJUNCT-T', t0.canon, t1?.canon, '->', val.canon)
|
|
159
144
|
done = done && DONE === val.dc
|
|
160
145
|
newtype = this.mark.type || val.mark.type
|
|
161
146
|
newhide = this.mark.hide || val.mark.hide
|
|
@@ -184,7 +169,6 @@ class ConjunctVal extends JunctionVal {
|
|
|
184
169
|
out = top()
|
|
185
170
|
}
|
|
186
171
|
|
|
187
|
-
// TODO: corrects CV[CV[1&/x]] issue above, but swaps term order!
|
|
188
172
|
else if (1 === outvals.length) {
|
|
189
173
|
out = outvals[0]
|
|
190
174
|
out.mark.type = newtype
|
|
@@ -196,7 +180,6 @@ class ConjunctVal extends JunctionVal {
|
|
|
196
180
|
|
|
197
181
|
out.dc = done ? DONE : this.dc + 1
|
|
198
182
|
|
|
199
|
-
// console.log('CONJUNCT-unify', this.id, sc, pc, '->', out.canon, 'D=' + out.dc, 'E=', this.err)
|
|
200
183
|
|
|
201
184
|
explainClose(te, out)
|
|
202
185
|
|
|
@@ -216,19 +199,6 @@ class ConjunctVal extends JunctionVal {
|
|
|
216
199
|
|
|
217
200
|
|
|
218
201
|
gen(ctx?: AontuContext) {
|
|
219
|
-
// A RESIDUATED SIZING ATOM DECIDES HERE (the review's finding C,
|
|
220
|
-
// use-cases/BUGS.md §16). `length`/`unique` over a container keep
|
|
221
|
-
// the readings that MORE MEMBERS COULD STILL CHANGE -- an upper
|
|
222
|
-
// bound satisfied, a lower bound violated, distinctness so far --
|
|
223
|
-
// rather than deciding against whatever the container held when it
|
|
224
|
-
// first settled (ConstraintVal.admitContainer). Generation is where
|
|
225
|
-
// no more members can arrive, so it is where the provisional
|
|
226
|
-
// reading becomes the verdict: the container generates if the atom
|
|
227
|
-
// is satisfied, and the atom's OWN refusal is raised if it is not.
|
|
228
|
-
//
|
|
229
|
-
// Without this the conjunct would report `conjunct` for a document
|
|
230
|
-
// whose only fault is a length -- the constraint's message is the
|
|
231
|
-
// one the author needs.
|
|
232
202
|
const residue = sizingResidue(this)
|
|
233
203
|
if (undefined !== residue) {
|
|
234
204
|
const settled: any = residue.con.settleContainer(residue.bag, ctx)
|
|
@@ -243,13 +213,11 @@ class ConjunctVal extends JunctionVal {
|
|
|
243
213
|
undefined
|
|
244
214
|
)
|
|
245
215
|
|
|
246
|
-
// TODO: refactor to use Site
|
|
247
216
|
nil.path = this.path
|
|
248
217
|
nil.site.url = this.site.url
|
|
249
218
|
nil.site.row = this.site.row
|
|
250
219
|
nil.site.col = this.site.col
|
|
251
220
|
|
|
252
|
-
// descErr(nil, ctx)
|
|
253
221
|
|
|
254
222
|
if (null == ctx) {
|
|
255
223
|
throw new AontuError(nil.msg)
|
|
@@ -260,7 +228,6 @@ class ConjunctVal extends JunctionVal {
|
|
|
260
228
|
}
|
|
261
229
|
|
|
262
230
|
|
|
263
|
-
|
|
264
231
|
// Normalize Conjunct:
|
|
265
232
|
// - flatten child conjuncts
|
|
266
233
|
// - consistent sorting of terms
|