aontu 0.60.0 → 0.62.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.
Files changed (113) hide show
  1. package/README.md +3 -3
  2. package/dist/agentsmd.d.ts +1 -0
  3. package/dist/agentsmd.js +7 -1
  4. package/dist/agentsmd.js.map +1 -1
  5. package/dist/allow.d.ts +23 -0
  6. package/dist/allow.js +230 -0
  7. package/dist/allow.js.map +1 -0
  8. package/dist/aontu.d.ts +4 -2
  9. package/dist/aontu.js +4 -2
  10. package/dist/aontu.js.map +1 -1
  11. package/dist/cli.d.ts +10 -1
  12. package/dist/cli.js +1000 -47
  13. package/dist/cli.js.map +1 -1
  14. package/dist/format.d.ts +1 -0
  15. package/dist/format.js +154 -12
  16. package/dist/format.js.map +1 -1
  17. package/dist/helpdoc.d.ts +16 -0
  18. package/dist/helpdoc.js +59 -0
  19. package/dist/helpdoc.js.map +1 -0
  20. package/dist/hints.js +15 -2
  21. package/dist/hints.js.map +1 -1
  22. package/dist/lang.js +93 -40
  23. package/dist/lang.js.map +1 -1
  24. package/dist/lower.d.ts +3 -0
  25. package/dist/lower.js +3 -0
  26. package/dist/lower.js.map +1 -1
  27. package/dist/lsp.d.ts +1 -1
  28. package/dist/lsp.js +1 -1
  29. package/dist/lsp.js.map +1 -1
  30. package/dist/relation.d.ts +2 -0
  31. package/dist/relation.js +7 -1
  32. package/dist/relation.js.map +1 -1
  33. package/dist/render.js +26 -21
  34. package/dist/render.js.map +1 -1
  35. package/dist/sigdecl.js +1 -1
  36. package/dist/sigdecl.js.map +1 -1
  37. package/dist/std.js +112 -69
  38. package/dist/std.js.map +1 -1
  39. package/dist/template.d.ts +2 -1
  40. package/dist/template.js +51 -15
  41. package/dist/template.js.map +1 -1
  42. package/dist/tsconfig.tsbuildinfo +1 -1
  43. package/dist/val/AggFuncVal.js +2 -2
  44. package/dist/val/AggFuncVal.js.map +1 -1
  45. package/dist/val/CmpFuncVal.d.ts +20 -0
  46. package/dist/val/CmpFuncVal.js +245 -0
  47. package/dist/val/CmpFuncVal.js.map +1 -0
  48. package/dist/val/EachFuncVal.d.ts +1 -2
  49. package/dist/val/EachFuncVal.js +15 -29
  50. package/dist/val/EachFuncVal.js.map +1 -1
  51. package/dist/val/FormFuncVal.js.map +1 -1
  52. package/dist/val/LowerFuncVal.js +17 -1
  53. package/dist/val/LowerFuncVal.js.map +1 -1
  54. package/dist/val/NamerFuncVal.d.ts +12 -0
  55. package/dist/val/NamerFuncVal.js +176 -0
  56. package/dist/val/NamerFuncVal.js.map +1 -0
  57. package/dist/val/NilVal.js +29 -3
  58. package/dist/val/NilVal.js.map +1 -1
  59. package/dist/val/NomFuncVal.d.ts +12 -0
  60. package/dist/val/NomFuncVal.js +187 -0
  61. package/dist/val/NomFuncVal.js.map +1 -0
  62. package/dist/val/PackFuncVal.js +3 -3
  63. package/dist/val/PackFuncVal.js.map +1 -1
  64. package/dist/val/RefVal.js +1 -1
  65. package/dist/val/TranslateFuncVal.d.ts +12 -0
  66. package/dist/val/TranslateFuncVal.js +101 -0
  67. package/dist/val/TranslateFuncVal.js.map +1 -0
  68. package/dist/val/UpperFuncVal.js +17 -1
  69. package/dist/val/UpperFuncVal.js.map +1 -1
  70. package/dist/val/caserange.d.ts +3 -0
  71. package/dist/val/caserange.js +110 -0
  72. package/dist/val/caserange.js.map +1 -0
  73. package/dist/vet.d.ts +12 -0
  74. package/dist/vet.js +209 -1
  75. package/dist/vet.js.map +1 -1
  76. package/grammar/aontu.abnf +1 -1
  77. package/grammar/aontu.gbnf +1 -1
  78. package/grammar/aontu.lark +1 -1
  79. package/grammar/aontu.tmLanguage.json +1 -1
  80. package/package.json +1 -1
  81. package/skill/SKILL.md +8 -0
  82. package/skill/init/check.sh +28 -0
  83. package/skill/init/data.aon +12 -0
  84. package/skill/init/model.aon +19 -0
  85. package/skill/tasks.md +151 -0
  86. package/src/agentsmd.ts +13 -2
  87. package/src/allow.ts +316 -0
  88. package/src/aontu.ts +10 -1
  89. package/src/cli.ts +1131 -53
  90. package/src/format.ts +191 -14
  91. package/src/helpdoc.ts +77 -0
  92. package/src/hints.ts +16 -2
  93. package/src/lang.ts +98 -42
  94. package/src/lower.ts +3 -3
  95. package/src/lsp.ts +1 -1
  96. package/src/relation.ts +21 -1
  97. package/src/render.ts +26 -21
  98. package/src/sigdecl.ts +1 -1
  99. package/src/std.ts +112 -69
  100. package/src/template.ts +55 -15
  101. package/src/val/AggFuncVal.ts +2 -2
  102. package/src/val/CmpFuncVal.ts +411 -0
  103. package/src/val/EachFuncVal.ts +49 -50
  104. package/src/val/LowerFuncVal.ts +18 -1
  105. package/src/val/NilVal.ts +29 -3
  106. package/src/val/NomFuncVal.ts +287 -0
  107. package/src/val/PackFuncVal.ts +3 -3
  108. package/src/val/RefVal.ts +1 -1
  109. package/src/val/TranslateFuncVal.ts +182 -0
  110. package/src/val/UpperFuncVal.ts +18 -1
  111. package/src/val/caserange.ts +115 -0
  112. package/src/vet.ts +287 -1
  113. package/src/val/FormFuncVal.ts +0 -119
package/src/lang.ts CHANGED
@@ -142,8 +142,10 @@ import { DeprecateFuncVal } from './val/DeprecateFuncVal'
142
142
  import { ReferFuncVal, RelFuncVal } from './val/ReferFuncVal'
143
143
  import { AcyclicFuncVal, InverseFuncVal } from './val/GraphAtomVal'
144
144
  import { PackFuncVal } from './val/PackFuncVal'
145
+ import { CMP_FUNCS } from './val/CmpFuncVal'
146
+ import { NomFuncVal } from './val/NomFuncVal'
147
+ import { TranslateFuncVal } from './val/TranslateFuncVal'
145
148
  import { EachFuncVal } from './val/EachFuncVal'
146
- import { FormFuncVal } from './val/FormFuncVal'
147
149
  import { FilterFuncVal } from './val/FilterFuncVal'
148
150
  import { MatchFuncVal } from './val/MatchFuncVal'
149
151
  import { EmitFuncVal } from './val/EmitFuncVal'
@@ -915,21 +917,24 @@ help isolate the syntax error.`,
915
917
  acyclic: AcyclicFuncVal,
916
918
  inverse: InverseFuncVal,
917
919
 
918
- // G8 phase 1: the generation combinators. `pack` makes one keyed
919
- // child per child of its data, `each` one list element; both clone
920
- // their template per destination exactly as a spread does, and both
921
- // wait for the model to settle before they fire (the staging rule,
922
- // G8 phase 0).
920
+ // G8 phase 1: generation to KEYED CHILDREN. `pack` makes one keyed
921
+ // child per child of its data, cloning its template per
922
+ // destination exactly as a spread does, and waits for the model to
923
+ // settle before it fires (the staging rule, G8 phase 0).
923
924
  pack: PackFuncVal,
924
- each: EachFuncVal,
925
925
 
926
- // RENDER P6: the order-preserving map. `form` makes one list
927
- // element per child of its data, being the template with `_`
928
- // bound to the source child -- a construction, where `each` is a
929
- // bound (G9 §4). It exists because `pick(pack(...))` re-sorts to
930
- // code-point order, and a struct's fields or a file's imports
931
- // are the model's order or they are wrong.
932
- form: FormFuncVal,
926
+ // RENDER P6: the order-preserving map, and generation to a LIST.
927
+ // `each` makes one list element per child of its data, being the
928
+ // template with `_` bound to the source child. It exists because
929
+ // `pick(pack(...))` re-sorts to code-point order, and a struct's
930
+ // fields or a file's imports are the model's order or they are
931
+ // wrong.
932
+ //
933
+ // Mentioning the hole makes it a BOUND instead: `each(d, _ & t)`
934
+ // meets each child with `t`, and `each(d, _)` is a bag's members
935
+ // as a list. That is what the retired meet-only `each` spelled
936
+ // (ADR-026), and why this one could take the name (ADR-027).
937
+ each: EachFuncVal,
933
938
 
934
939
  // G8 phase 2: selection. `filter` keeps the children of a bag that
935
940
  // unify with a condition; `match` picks the first arm whose
@@ -962,7 +967,8 @@ help isolate the syntax error.`,
962
967
 
963
968
  // Projection, which is what lets the aggregates reach a bag of
964
969
  // RECORDS: `sum(pick($.lines, amountCents))`. Not a clever `each`
965
- // template -- `each` MEETS each child, and a meet cannot select.
970
+ // template -- `each(d, _ & t)` MEETS each child, and a meet cannot
971
+ // select.
966
972
  pick: PickFuncVal,
967
973
 
968
974
  // G9 phase 2: the fold to a STRING. `sum` folds with `add`; this
@@ -989,6 +995,39 @@ help isolate the syntax error.`,
989
995
  usc: UscFuncVal,
990
996
  rep: RepFuncVal,
991
997
  split: SplitFuncVal,
998
+
999
+ // THE COMPONENT PRIMITIVES -- SPIKE (ts/src/val/CmpFuncVal.ts,
1000
+ // docs/design/JOSTRACA.0.md). jostraca's component set, spelled
1001
+ // as functions -- LOWER CASE, like every other builtin in this
1002
+ // language, while the node each one builds names the jostraca
1003
+ // component it drives (`file(...)` is aontu, `"File"` is
1004
+ // jostraca's). A document then says what FILES it produces
1005
+ // instead of filling in the `aontu:code` vocabulary as data.
1006
+ // Eight of jostraca's ten: `copy` and `list` are already builtins
1007
+ // here with unrelated meanings, so those two have no lower-case
1008
+ // spelling to take (see ts/src/val/CmpFuncVal.ts).
1009
+ //
1010
+ // TypeScript only, and so deliberately NOT in
1011
+ // test/spec/signature.tsv, BUILTIN_FUNCS (ts/src/lsp.ts) or the
1012
+ // grammar/ files -- each is asserted in cross-port parity and a
1013
+ // TS-only entry turns the Go suite red. Arity and argument shape
1014
+ // are refused in CmpFuncVal.resolve for the same reason.
1015
+ ...CMP_FUNCS,
1016
+
1017
+ // NAME TRANSFORMATION -- SPIKE (ts/src/val/NamerFuncVal.ts).
1018
+ // Generated code is mostly names, and no two targets spell them
1019
+ // the same way. Splits a name into words whatever format it is
1020
+ // written in, then renders it in the target's. TypeScript only,
1021
+ // and out of the parity-pinned registries for the reason the
1022
+ // component primitives are.
1023
+ nom: NomFuncVal,
1024
+
1025
+ // PER-CHARACTER SUBSTITUTION AND DELETION -- SPIKE
1026
+ // (ts/src/val/TranslateFuncVal.ts), after `tr`. Reads the source
1027
+ // once and consults a table, which is what `rep` cannot do: a
1028
+ // per-character map spelled as N `rep` calls composes wrongly,
1029
+ // since each pass sees the previous one's output.
1030
+ translate: TranslateFuncVal,
992
1031
  }
993
1032
 
994
1033
 
@@ -2250,13 +2289,13 @@ function makeModelResolver(options: any) {
2250
2289
  // remain available under every capability but 'none' — they are
2251
2290
  // host-provided, not document-requested, so confining them would
2252
2291
  // confine the host against itself.
2253
- // THE BUNDLED VOCABULARY (G4 phase 4, ts/src/std.ts) rides the
2254
- // memory leg: served from the engine itself, so it needs neither the
2255
- // filesystem nor package resolution and is available under every
2256
- // capability but `none` — which denies every include outright, that
2257
- // being what `none` means. Host entries and the capability's own set
2258
- // WIN over it: a caller that supplies its own `std/system` gets the
2259
- // one it supplied.
2292
+ // A LANGUAGE-SUPPLIED MODEL DOES NOT RIDE THIS LEG (ADR-028). Every
2293
+ // bundled schema is named under `aontu:` and answered by the scheme
2294
+ // leg above, which returns before the memory resolver is built, so
2295
+ // neither a host entry nor a capability's own file set can stand in
2296
+ // front of one: `aontu:system` is the engine's, always. That is what
2297
+ // the prefix buys, and it is why the bare-name leg that once let a
2298
+ // caller shadow `std/system` is gone.
2260
2299
  let memResolver = makeMemResolver(memCapability
2261
2300
  ? { ...(capability as any).mem }
2262
2301
  : { ...(options.resolver?.mem || {}) })
@@ -2426,10 +2465,14 @@ function makeModelResolver(options: any) {
2426
2465
  // else -- the memory, module, file and package legs are never
2427
2466
  // asked, so nothing on disk can shadow one and a typo is refused
2428
2467
  // here, naming the set, rather than searched for. Available under
2429
- // every capability but `none`, checked just above, like the std
2430
- // names below. A path that is not a string (`a: @1`) is not a name
2431
- // at all: it falls through to the legs below and is not found there,
2432
- // as it always was.
2468
+ // every capability but `none`, checked just above. A path that is
2469
+ // not a string (`a: @1`) is not a name at all: it falls through to
2470
+ // the legs below and is not found there, as it always was.
2471
+ //
2472
+ // This is the ONLY leg that serves a bundled model (ADR-028). The
2473
+ // vocabularies once had bare names (`std/system`) and a second leg
2474
+ // below to match them; the prefix is now the whole spelling, so one
2475
+ // leg answers for every language-supplied schema.
2433
2476
  if ('string' === typeof path && path.startsWith(AONTU_SCHEME)) {
2434
2477
  const model = STD_SOURCES[path]
2435
2478
  if (null == model) {
@@ -2439,19 +2482,6 @@ function makeModelResolver(options: any) {
2439
2482
  return { found: true, path, full: path, kind: 'aon', src: model, search: [] }
2440
2483
  }
2441
2484
 
2442
- // THE BUNDLED VOCABULARY (G4 phase 4, ts/src/std.ts): served from
2443
- // the engine itself, so it needs neither the filesystem nor package
2444
- // resolution and is available under every capability but `none` —
2445
- // checked just above, that being what `none` means. Matched against
2446
- // the name the author WROTE, before the memory leg, so the kind is
2447
- // stated rather than guessed from an extension the bare name does
2448
- // not have.
2449
- const std = STD_SOURCES[path]
2450
- if (null != std) {
2451
- record(ctx, path, 'std')
2452
- return { found: true, path, full: path, kind: 'aon', src: std, search: [] }
2453
- }
2454
-
2455
2485
  let search: any = []
2456
2486
  let res = memResolver(path, popts, rule, ctx, jsonic)
2457
2487
  res.path = path
@@ -2581,10 +2611,27 @@ for (const name in funcSig) {
2581
2611
  }
2582
2612
  }
2583
2613
 
2614
+ // THE COMPONENT PRIMITIVES, listed by hand (the spike, see funcMap
2615
+ // above and ts/src/val/CmpFuncVal.ts). They carry no signature
2616
+ // declaration, so the derivation above cannot see them -- and
2617
+ // `file("main.ts", [...])` without an entry arrives as ONE raw array
2618
+ // term, which the call then reads as its spec. The leaves are here
2619
+ // too, so that a written second argument is COUNTED and refused as
2620
+ // the arity mistake it is rather than arriving as a one-element list
2621
+ // that is merely the wrong shape.
2622
+ for (const name of Object.keys(CMP_FUNCS)) {
2623
+ POSITIONAL_ARG_FUNCS[name] = true
2624
+ }
2625
+ POSITIONAL_ARG_FUNCS['nom'] = true
2626
+ POSITIONAL_ARG_FUNCS['translate'] = true
2627
+
2584
2628
 
2585
- // [min, max]; a max of -1 is unbounded. Every name in funcMap has an
2629
+ // [min, max]; a max of -1 is unbounded. Every DECLARED name has an
2586
2630
  // entry, and the arity is a property of the language rather than of
2587
- // either port -- go/func.go derives the same table. A required slot
2631
+ // either port -- go/func.go derives the same table. The spike's
2632
+ // component primitives are the one exception: they carry no
2633
+ // declaration, so they have no entry here and refuse a bad count in
2634
+ // their own resolve (ts/src/val/CmpFuncVal.ts). A required slot
2588
2635
  // counts toward the minimum; a rest slot makes the maximum unbounded
2589
2636
  // and counts its group size (one, for a plain rest type) toward the
2590
2637
  // minimum, which is what gives `match` its floor of three and `neq`
@@ -2646,7 +2693,16 @@ function arityText(lo: number, hi: number): string {
2646
2693
  return 'one or more arguments'
2647
2694
  }
2648
2695
  if (lo !== hi) {
2649
- return 0 === lo ? 'no arguments or one' : 'one argument or two'
2696
+ if (0 === lo) {
2697
+ return 'no arguments or one'
2698
+ }
2699
+ // The case range gave `upper` and `lower` a span rather than a
2700
+ // pair, and a two-arm phrasing cannot say it: [1,3] read as "one
2701
+ // argument or two", which is a wrong count rather than an
2702
+ // imprecise one. Each arm here is a shape the table actually
2703
+ // carries, and each is pinned by a row -- a phrasing for a count no
2704
+ // entry has would be untested prose pretending to be tested.
2705
+ return 3 === hi ? 'one to three arguments' : 'one argument or two'
2650
2706
  }
2651
2707
  // The {0,0} arm returned with the container kinds and acyclic()
2652
2708
  // (ADR-015): `map(1)` must not claim map takes exactly one.
package/src/lower.ts CHANGED
@@ -103,19 +103,19 @@ export function splitWords(name: string): string[] {
103
103
  return words
104
104
  }
105
105
 
106
- function lowerASCII(s: string): string {
106
+ export function lowerASCII(s: string): string {
107
107
  return Array.from(s).map((c) =>
108
108
  isUpper(c) ? String.fromCharCode(c.charCodeAt(0) + 32) : c).join('')
109
109
  }
110
110
 
111
- function upperASCII(s: string): string {
111
+ export function upperASCII(s: string): string {
112
112
  return Array.from(s).map((c) =>
113
113
  isLower(c) ? String.fromCharCode(c.charCodeAt(0) - 32) : c).join('')
114
114
  }
115
115
 
116
116
  // A word capitalised: the acronym set wins, so `id` is `ID` under a
117
117
  // profile that lists it and `Id` under one that does not.
118
- function capitalise(word: string, acronyms: string[]): string {
118
+ export function capitalise(word: string, acronyms: string[]): string {
119
119
  const low = lowerASCII(word)
120
120
  for (const a of acronyms) {
121
121
  if (lowerASCII(a) === low) {
package/src/lsp.ts CHANGED
@@ -528,7 +528,7 @@ const COMPLETION_KEYWORD = 14
528
528
  const BUILTIN_FUNCS = [
529
529
  'above', 'acyclic', 'add', 'below', 'close', 'copy', 'deprecate', 'div',
530
530
  'each', 'emit', 'esc',
531
- 'filter', 'form', 'greatest',
531
+ 'filter', 'greatest',
532
532
  'hide', 'inverse', 'join', 'key', 'least', 'length', 'list', 'lower',
533
533
  'map', 'match', 'max', 'min', 'mod', 'move', 'mul', 'must', 'neq', 'open',
534
534
  'pack', 'path', 'pick',
package/src/relation.ts CHANGED
@@ -61,6 +61,12 @@ export type RelationReport = {
61
61
  // arrive with an empty list -- something is wrong, and nothing about
62
62
  // what. Present ONLY on an `error` verdict.
63
63
  errors?: VetFinding[]
64
+
65
+ // How many relation declarations the document makes (G11 phase 4).
66
+ // ZERO is the answer that matters: `pass` over no declarations means
67
+ // nothing was checked, and without this the two are one word.
68
+ // Absent unless the run asked for it (`RelationOptions.count`).
69
+ declared?: number
64
70
  }
65
71
 
66
72
  export type RelationOptions = {
@@ -76,6 +82,14 @@ export type RelationOptions = {
76
82
  // Rides beside `trust` because it is the other half of what an
77
83
  // include may read.
78
84
  textExt?: string[]
85
+
86
+ // Count the relation declarations the document makes (G11 phase 4),
87
+ // so a caller can tell a graph that CHECKED CLEAN from one there was
88
+ // nothing to check. `pass` is the same word for both, which is the
89
+ // whole reason this exists. Absent from the report unless asked for,
90
+ // so no existing caller's report changes shape -- `vet --coverage`
91
+ // sets the precedent.
92
+ count?: boolean
79
93
  }
80
94
 
81
95
 
@@ -271,8 +285,13 @@ export function relationCheck(
271
285
  }
272
286
 
273
287
  const decls: Map<string, RelDecl> = (ctx as any)._reldecls
288
+ // The count rides every report from here down: the engine knows it
289
+ // at exactly this point, and a caller asking "was there anything to
290
+ // check?" should not have to evaluate the document a second time to
291
+ // find out.
292
+ const counted = true === options.count ? { declared: decls.size } : {}
274
293
  if (0 === decls.size) {
275
- return { verdict: 'pass', findings: [] }
294
+ return { verdict: 'pass', findings: [], ...counted }
276
295
  }
277
296
 
278
297
  // NOR IS A DOCUMENT THAT CANNOT BE GENERATED. Unification can
@@ -299,5 +318,6 @@ export function relationCheck(
299
318
  return {
300
319
  verdict: 0 === findings.length ? 'pass' : 'fail',
301
320
  findings,
321
+ ...counted,
302
322
  }
303
323
  }
package/src/render.ts CHANGED
@@ -209,12 +209,13 @@ export function render(src: string, options?: RenderOptions): RenderReport {
209
209
  return errorReport(report.findings)
210
210
  }
211
211
 
212
- // The meet, keyed: the vocabulary's root holds `code`, and so does
213
- // the instance's (a value the vet admitted is a map), and a document
214
- // with no `code` at all is the vocabulary's own empty instance.
215
- const codeVal: any = node.peg.code
212
+ // The meet, keyed: the vocabulary's root holds `aontu.Code`, and so
213
+ // does the instance's (a value the vet admitted is a map), and a
214
+ // document with no `code` at all is the vocabulary's own empty
215
+ // instance. The key is namespaced (ADR-029), so the reach is two deep.
216
+ const codeVal: any = node.peg.aontu?.peg?.Code
216
217
  const instance = new Aontu().generate(
217
- VOCABULARY + (undefined === codeVal ? '' : '\ncode: ' + hcanon(codeVal)))
218
+ VOCABULARY + (undefined === codeVal ? '' : '\naontu: Code: ' + hcanon(codeVal)))
218
219
  const folded = renderValue(instance, opts)
219
220
 
220
221
  // THE TWO REPORTS ARE JOINED TO THE FOLD BY PATH (P7), which is what
@@ -314,7 +315,7 @@ function traceOf(marks: { path: string, mark: any }[], instance: any,
314
315
  const pre: { at: string, path: string }[] = []
315
316
  unitList(instance).forEach((u: any, i: number) => {
316
317
  if (units.some((r) => r.path === u.path)) {
317
- pre.push({ at: '$.code.units.' + i, path: u.path })
318
+ pre.push({ at: '$.aontu.Code.units.' + i, path: u.path })
318
319
  }
319
320
  })
320
321
  const out: RenderTrace[] = []
@@ -361,16 +362,18 @@ function covered(set: Set<string>, a: string): boolean {
361
362
  // ROOT, or under `coverageAt` when a document keeps its model under one
362
363
  // key (X-3, decided here): the read set is absolute, so a narrower
363
364
  // measure is a narrower walk, not a different origin. The render's own
364
- // output -- `code` under the anchor -- is not model and is never
365
- // walked into: nothing reads it, so every document would otherwise
366
- // report it dead.
365
+ // output -- the `aontu` namespace under the anchor -- is not model and
366
+ // is never walked into: nothing reads it, so every document would
367
+ // otherwise report it dead. The whole NAMESPACE is excluded, not just
368
+ // `aontu.Code` (ADR-029): everything under it is language-supplied, so
369
+ // an included vocabulary is not dead model either.
367
370
  function coverOf(root: any, node: any, reads: Set<string>,
368
371
  opts: RenderOptions, marks: { path: string, mark: any }[], instance: any,
369
372
  units: RenderUnit[]): RenderCoverage | undefined {
370
- // THE ANCHOR IS THE ONE render() ALREADY FOUND, so `code` under it is
371
- // named without asking a second time: `--at` is resolved before the
372
- // vet, and an anchor that named nothing never reached here.
373
- const codeAddr = addr(node.path.concat('code'))
373
+ // THE ANCHOR IS THE ONE render() ALREADY FOUND, so the namespace
374
+ // under it is named without asking a second time: `--at` is resolved
375
+ // before the vet, and an anchor that named nothing never reached here.
376
+ const codeAddr = addr(node.path.concat('aontu'))
374
377
 
375
378
  let from: any = root
376
379
  let base: string[] = []
@@ -428,7 +431,7 @@ function coverOf(root: any, node: any, reads: Set<string>,
428
431
  }
429
432
  const decls: any[] = unit.decls
430
433
  decls.forEach((_d: any, j: number) => {
431
- const a = '$.code.units.' + i + '.decls.' + j
434
+ const a = '$.aontu.Code.units.' + i + '.decls.' + j
432
435
  if (!covered(stamped, a) && !inside.has(a)) {
433
436
  unruled.push({ unit: unit.path, path: a })
434
437
  }
@@ -450,7 +453,7 @@ function bundledProfile(lang: string): any {
450
453
  return undefined
451
454
  }
452
455
  if (undefined === bundled[lang]) {
453
- bundled[lang] = new Aontu().generate('@"aontu:lang/' + lang + '"').profile
456
+ bundled[lang] = new Aontu().generate('@"aontu:lang/' + lang + '"').aontu.Profile
454
457
  }
455
458
  return bundled[lang]
456
459
  }
@@ -571,8 +574,9 @@ export function renderProfile(src: string, options?: RenderOptions):
571
574
  // The meet, keyed as render's is: the vocabulary requires `profile`,
572
575
  // so a value the vet admitted has one.
573
576
  const instance = new Aontu().generate(
574
- PROFILE_VOCABULARY + '\nprofile: ' + hcanon(root.peg.profile))
575
- return { profile: instance.profile }
577
+ PROFILE_VOCABULARY + '\naontu: Profile: ' +
578
+ hcanon(root.peg.aontu.peg.Profile))
579
+ return { profile: instance.aontu.Profile }
576
580
  }
577
581
 
578
582
 
@@ -580,7 +584,8 @@ export function renderProfile(src: string, options?: RenderOptions):
580
584
  // key and is always there, `units` is not. One reader, so the fold,
581
585
  // the trace and the coverage report all see the same list.
582
586
  function unitList(instance: any): any[] {
583
- return Array.isArray(instance?.code?.units) ? instance.code.units : []
587
+ return Array.isArray(instance?.aontu?.Code?.units) ?
588
+ instance.aontu.Code.units : []
584
589
  }
585
590
 
586
591
 
@@ -598,7 +603,7 @@ export function renderValue(instance: any, options?: RenderOptions): RenderRepor
598
603
  const seen: string[] = []
599
604
  let selected = 0
600
605
  list.forEach((unit: any, i: number) => {
601
- const upath = '$.code.units.' + i
606
+ const upath = '$.aontu.Code.units.' + i
602
607
  const path: string = unit.path
603
608
  const lang: string = unit.lang
604
609
 
@@ -648,7 +653,7 @@ export function renderValue(instance: any, options?: RenderOptions): RenderRepor
648
653
 
649
654
  let text = ''
650
655
  if (undefined !== ctx) {
651
- const header = lowerHeader(unit, instance?.code?.source, ctx)
656
+ const header = lowerHeader(unit, instance?.aontu?.Code?.source, ctx)
652
657
  for (const piece of header) {
653
658
  text += foldPiece(piece, profile, path, upath, lossy, ctx)
654
659
  }
@@ -702,7 +707,7 @@ export function renderValue(instance: any, options?: RenderOptions): RenderRepor
702
707
  })
703
708
 
704
709
  if (undefined !== opts.unit && 0 === selected) {
705
- errors.push(finding('render_unit', 'reference', '$.code.units',
710
+ errors.push(finding('render_unit', 'reference', '$.aontu.Code.units',
706
711
  'no unit has the path ' + opts.unit + '.'))
707
712
  }
708
713
 
package/src/sigdecl.ts CHANGED
@@ -6,6 +6,6 @@
6
6
  // this copy is identical with the shared file.
7
7
 
8
8
  const SIGDECL: string =
9
- "# The call surface: one declaration line per built-in function\n# (docs/design/SIGNATURES.0.md). THIS FILE IS THE SOURCE — both ports\n# carry a build-time-inlined copy (ts/src/sigdecl.ts, go/sigdecl.txt;\n# `make sig` regenerates both, and each port's suite asserts its copy\n# is byte-identical with this file) and parse it at initialisation\n# with the signature grammar, a tabnas grammar (ts/src/sig.ts,\n# go/sig.go). The suites also round-trip every line:\n# render(parse(line)) must be the line exactly, in both ports.\n#\n# The syntax (rendered TypeScript-ish, honest about argument MODES):\n# line = name '(' [ arg {',' arg} ] ')' ':' type\n# arg = [mode] name ['?'] ':' type\n# | '...' name ':' '(' [mode] type {',' [mode] type} ')'\n# type = word {'|' word}\n# mode = 'capture' | 'template' | 'trial' | 'projector' | 'text'\n# `value` mode is unmarked. `constraint` is the result word for\n# residuals whose meet depends on the peer; `any` is the honest type\n# where a function is a wrapper.\nupper(s: string|number) : string\nlower(s: string|number) : string\ncopy(v: any) : any\npref(v: any) : any\nsuper(t: any) : any\ntype(t: any) : any\nhide(v: any) : any\nclose(m: any) : any\nopen(m: any) : any\nmove(v: any) : any\npath(capture p?: path) : path\nmap() : map\nlist() : list\nmin(n: number|string) : constraint\nmax(n: number|string) : constraint\nabove(n: number|string) : constraint\nbelow(n: number|string) : constraint\nre(text p: string) : constraint\nlength(n: number|constraint) : constraint\nkey(up?: integer|biginteger) : string\nunique(projector k?: string) : constraint\nneq(...vals: number|string) : constraint\nmust(trial c: any, text msg: string) : constraint\ndeprecate(v: any, r?: map) : any\nacyclic() : constraint\ninverse(projector k: string) : constraint\nrefer(template t?: any) : constraint\nrel(template t?: any) : constraint\npack(d: map|list, template t: any) : map\neach(d: map|list, template t?: any) : list\nform(d: map|list, template t: any) : list\nfilter(d: map|list, trial c: any) : map|list\nmatch(s: any, ...pr: (trial any, any), dflt?: any) : any\nadd(a: number, b: number) : number\nsub(a: number, b: number) : number\nmul(a: number, b: number) : number\ndiv(a: number, b: number) : number\nmod(a: number, b: number) : number\nrem(a: number, b: number) : number\nsum(d: map|list) : number\nleast(d: map|list) : number\ngreatest(d: map|list) : number\npick(d: map|list, projector k: string|integer) : any\njoin(d: map|list, sep?: string) : string\nesc(s: string, variant?: string) : string\nusc(s: string, variant?: string) : string\nrep(s: string, text p: string, text sub: string) : string\nsplit(s: string, sep: string|constraint) : list\nemit(s: map|list, template t: map|list) : list\n"
9
+ "# The call surface: one declaration line per built-in function\n# (docs/design/SIGNATURES.0.md). THIS FILE IS THE SOURCE — both ports\n# carry a build-time-inlined copy (ts/src/sigdecl.ts, go/sigdecl.txt;\n# `make sig` regenerates both, and each port's suite asserts its copy\n# is byte-identical with this file) and parse it at initialisation\n# with the signature grammar, a tabnas grammar (ts/src/sig.ts,\n# go/sig.go). The suites also round-trip every line:\n# render(parse(line)) must be the line exactly, in both ports.\n#\n# The syntax (rendered TypeScript-ish, honest about argument MODES):\n# line = name '(' [ arg {',' arg} ] ')' ':' type\n# arg = [mode] name ['?'] ':' type\n# | '...' name ':' '(' [mode] type {',' [mode] type} ')'\n# type = word {'|' word}\n# mode = 'capture' | 'template' | 'trial' | 'projector' | 'text'\n# `value` mode is unmarked. `constraint` is the result word for\n# residuals whose meet depends on the peer; `any` is the honest type\n# where a function is a wrapper.\nupper(s: string|number, start?: integer|biginteger, len?: integer|biginteger) : string\nlower(s: string|number, start?: integer|biginteger, len?: integer|biginteger) : string\ncopy(v: any) : any\npref(v: any) : any\nsuper(t: any) : any\ntype(t: any) : any\nhide(v: any) : any\nclose(m: any) : any\nopen(m: any) : any\nmove(v: any) : any\npath(capture p?: path) : path\nmap() : map\nlist() : list\nmin(n: number|string) : constraint\nmax(n: number|string) : constraint\nabove(n: number|string) : constraint\nbelow(n: number|string) : constraint\nre(text p: string) : constraint\nlength(n: number|constraint) : constraint\nkey(up?: integer|biginteger) : string\nunique(projector k?: string) : constraint\nneq(...vals: number|string) : constraint\nmust(trial c: any, text msg: string) : constraint\ndeprecate(v: any, r?: map) : any\nacyclic() : constraint\ninverse(projector k: string) : constraint\nrefer(template t?: any) : constraint\nrel(template t?: any) : constraint\npack(d: map|list, template t: any) : map\neach(d: map|list, template t: any) : list\nfilter(d: map|list, trial c: any) : map|list\nmatch(s: any, ...pr: (trial any, any), dflt?: any) : any\nadd(a: number, b: number) : number\nsub(a: number, b: number) : number\nmul(a: number, b: number) : number\ndiv(a: number, b: number) : number\nmod(a: number, b: number) : number\nrem(a: number, b: number) : number\nsum(d: map|list) : number\nleast(d: map|list) : number\ngreatest(d: map|list) : number\npick(d: map|list, projector k: string|integer) : any\njoin(d: map|list, sep?: string) : string\nesc(s: string, variant?: string) : string\nusc(s: string, variant?: string) : string\nrep(s: string, text p: string, text sub: string) : string\nsplit(s: string, sep: string|constraint) : list\nemit(s: map|list, template t: map|list) : list\n"
10
10
 
11
11
  export { SIGDECL }