aontu 0.29.0 → 0.30.2

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 (270) hide show
  1. package/dist/aontu.d.ts +17 -13
  2. package/dist/aontu.js +145 -60
  3. package/dist/aontu.js.map +1 -1
  4. package/dist/ctx.d.ts +51 -0
  5. package/dist/ctx.js +105 -0
  6. package/dist/ctx.js.map +1 -0
  7. package/dist/err.d.ts +12 -0
  8. package/dist/err.js +123 -0
  9. package/dist/err.js.map +1 -0
  10. package/dist/hints.d.ts +8 -0
  11. package/dist/hints.js +84 -0
  12. package/dist/hints.js.map +1 -0
  13. package/dist/lang.d.ts +11 -0
  14. package/dist/lang.js +569 -0
  15. package/dist/lang.js.map +1 -0
  16. package/dist/site.d.ts +12 -0
  17. package/dist/site.js +27 -0
  18. package/dist/site.js.map +1 -0
  19. package/dist/tsconfig.tsbuildinfo +1 -0
  20. package/dist/type.d.ts +32 -0
  21. package/dist/type.js +16 -0
  22. package/dist/type.js.map +1 -0
  23. package/dist/unify.d.ts +14 -0
  24. package/dist/unify.js +156 -0
  25. package/dist/unify.js.map +1 -0
  26. package/dist/utility.d.ts +14 -0
  27. package/dist/utility.js +122 -0
  28. package/dist/utility.js.map +1 -0
  29. package/dist/val/BagVal.d.ts +10 -0
  30. package/dist/val/BagVal.js +15 -0
  31. package/dist/val/BagVal.js.map +1 -0
  32. package/dist/val/BooleanVal.d.ts +9 -0
  33. package/dist/val/BooleanVal.js +16 -0
  34. package/dist/val/BooleanVal.js.map +1 -0
  35. package/dist/val/CloseFuncVal.d.ts +11 -0
  36. package/dist/val/CloseFuncVal.js +32 -0
  37. package/dist/val/CloseFuncVal.js.map +1 -0
  38. package/dist/val/ConjunctVal.d.ts +14 -0
  39. package/dist/val/ConjunctVal.js +187 -0
  40. package/dist/val/ConjunctVal.js.map +1 -0
  41. package/dist/val/CopyFuncVal.d.ts +13 -0
  42. package/dist/val/CopyFuncVal.js +35 -0
  43. package/dist/val/CopyFuncVal.js.map +1 -0
  44. package/dist/val/DisjunctVal.d.ts +19 -0
  45. package/dist/val/DisjunctVal.js +194 -0
  46. package/dist/val/DisjunctVal.js.map +1 -0
  47. package/dist/val/FeatureVal.d.ts +10 -0
  48. package/dist/val/FeatureVal.js +29 -0
  49. package/dist/val/FeatureVal.js.map +1 -0
  50. package/dist/val/FuncBaseVal.d.ts +15 -0
  51. package/dist/val/FuncBaseVal.js +127 -0
  52. package/dist/val/FuncBaseVal.js.map +1 -0
  53. package/dist/val/HideFuncVal.d.ts +12 -0
  54. package/dist/val/HideFuncVal.js +48 -0
  55. package/dist/val/HideFuncVal.js.map +1 -0
  56. package/dist/val/IntegerVal.d.ts +9 -0
  57. package/dist/val/IntegerVal.js +46 -0
  58. package/dist/val/IntegerVal.js.map +1 -0
  59. package/dist/val/JunctionVal.d.ts +12 -0
  60. package/dist/val/JunctionVal.js +31 -0
  61. package/dist/val/JunctionVal.js.map +1 -0
  62. package/dist/val/KeyFuncVal.d.ts +12 -0
  63. package/dist/val/KeyFuncVal.js +34 -0
  64. package/dist/val/KeyFuncVal.js.map +1 -0
  65. package/dist/val/ListVal.d.ts +17 -0
  66. package/dist/val/ListVal.js +186 -0
  67. package/dist/val/ListVal.js.map +1 -0
  68. package/dist/val/LowerFuncVal.d.ts +12 -0
  69. package/dist/val/LowerFuncVal.js +40 -0
  70. package/dist/val/LowerFuncVal.js.map +1 -0
  71. package/dist/val/MapVal.d.ts +16 -0
  72. package/dist/val/MapVal.js +211 -0
  73. package/dist/val/MapVal.js.map +1 -0
  74. package/dist/val/MoveFuncVal.d.ts +11 -0
  75. package/dist/val/MoveFuncVal.js +41 -0
  76. package/dist/val/MoveFuncVal.js.map +1 -0
  77. package/dist/val/NilVal.d.ts +25 -0
  78. package/dist/{lib/val/Nil.js → val/NilVal.js} +38 -30
  79. package/dist/val/NilVal.js.map +1 -0
  80. package/dist/val/NullVal.d.ts +9 -0
  81. package/dist/val/NullVal.js +18 -0
  82. package/dist/val/NullVal.js.map +1 -0
  83. package/dist/val/NumberVal.d.ts +9 -0
  84. package/dist/val/NumberVal.js +44 -0
  85. package/dist/val/NumberVal.js.map +1 -0
  86. package/dist/val/OpBaseVal.d.ts +18 -0
  87. package/dist/val/OpBaseVal.js +152 -0
  88. package/dist/val/OpBaseVal.js.map +1 -0
  89. package/dist/val/OpenFuncVal.d.ts +11 -0
  90. package/dist/val/OpenFuncVal.js +30 -0
  91. package/dist/val/OpenFuncVal.js.map +1 -0
  92. package/dist/val/PathFuncVal.d.ts +13 -0
  93. package/dist/val/PathFuncVal.js +42 -0
  94. package/dist/val/PathFuncVal.js.map +1 -0
  95. package/dist/val/PlusOpVal.d.ts +16 -0
  96. package/dist/val/PlusOpVal.js +59 -0
  97. package/dist/val/PlusOpVal.js.map +1 -0
  98. package/dist/val/PrefFuncVal.d.ts +11 -0
  99. package/dist/val/PrefFuncVal.js +39 -0
  100. package/dist/val/PrefFuncVal.js.map +1 -0
  101. package/dist/val/PrefVal.d.ts +15 -0
  102. package/dist/val/PrefVal.js +104 -0
  103. package/dist/val/PrefVal.js.map +1 -0
  104. package/dist/val/RefVal.d.ts +22 -0
  105. package/dist/val/RefVal.js +276 -0
  106. package/dist/val/RefVal.js.map +1 -0
  107. package/dist/val/ScalarKindVal.d.ts +16 -0
  108. package/dist/val/ScalarKindVal.js +76 -0
  109. package/dist/val/ScalarKindVal.js.map +1 -0
  110. package/dist/val/ScalarVal.d.ts +16 -0
  111. package/dist/val/ScalarVal.js +61 -0
  112. package/dist/val/ScalarVal.js.map +1 -0
  113. package/dist/val/StringVal.d.ts +10 -0
  114. package/dist/val/StringVal.js +19 -0
  115. package/dist/val/StringVal.js.map +1 -0
  116. package/dist/val/SuperFuncVal.d.ts +11 -0
  117. package/dist/val/SuperFuncVal.js +22 -0
  118. package/dist/val/SuperFuncVal.js.map +1 -0
  119. package/dist/val/TopVal.d.ts +16 -0
  120. package/dist/val/TopVal.js +38 -0
  121. package/dist/val/TopVal.js.map +1 -0
  122. package/dist/val/TypeFuncVal.d.ts +12 -0
  123. package/dist/val/TypeFuncVal.js +35 -0
  124. package/dist/val/TypeFuncVal.js.map +1 -0
  125. package/dist/val/UpperFuncVal.d.ts +12 -0
  126. package/dist/val/UpperFuncVal.js +40 -0
  127. package/dist/val/UpperFuncVal.js.map +1 -0
  128. package/dist/val/Val.d.ts +89 -0
  129. package/dist/val/Val.js +186 -0
  130. package/dist/val/Val.js.map +1 -0
  131. package/dist/val/VarVal.d.ts +13 -0
  132. package/dist/val/VarVal.js +109 -0
  133. package/dist/val/VarVal.js.map +1 -0
  134. package/dist/val/top.d.ts +2 -0
  135. package/dist/val/top.js +10 -0
  136. package/dist/val/top.js.map +1 -0
  137. package/dist/val/valutil.d.ts +2 -0
  138. package/dist/val/valutil.js +30 -0
  139. package/dist/val/valutil.js.map +1 -0
  140. package/package.json +20 -38
  141. package/src/aontu.ts +218 -0
  142. package/src/ctx.ts +201 -0
  143. package/src/err.ts +172 -0
  144. package/src/hints.ts +119 -0
  145. package/src/lang.ts +782 -0
  146. package/src/site.ts +34 -0
  147. package/src/tsconfig.json +16 -0
  148. package/src/type.ts +72 -0
  149. package/src/unify.ts +225 -0
  150. package/src/utility.ts +179 -0
  151. package/src/val/BagVal.ts +33 -0
  152. package/src/val/BooleanVal.ts +32 -0
  153. package/src/val/CloseFuncVal.ts +61 -0
  154. package/src/val/ConjunctVal.ts +285 -0
  155. package/src/val/CopyFuncVal.ts +69 -0
  156. package/src/val/DisjunctVal.ts +288 -0
  157. package/src/val/FeatureVal.ts +56 -0
  158. package/src/val/FuncBaseVal.ts +198 -0
  159. package/src/val/HideFuncVal.ts +85 -0
  160. package/src/val/IntegerVal.ts +75 -0
  161. package/src/val/JunctionVal.ts +54 -0
  162. package/src/val/KeyFuncVal.ts +67 -0
  163. package/src/val/ListVal.ts +286 -0
  164. package/src/val/LowerFuncVal.ts +73 -0
  165. package/src/val/MapVal.ts +316 -0
  166. package/src/val/MoveFuncVal.ts +79 -0
  167. package/{lib/val/Nil.ts → src/val/NilVal.ts} +49 -37
  168. package/src/val/NullVal.ts +38 -0
  169. package/src/val/NumberVal.ts +75 -0
  170. package/src/val/OpBaseVal.ts +231 -0
  171. package/src/val/OpenFuncVal.ts +60 -0
  172. package/src/val/PathFuncVal.ts +75 -0
  173. package/src/val/PlusOpVal.ts +92 -0
  174. package/src/val/PrefFuncVal.ts +73 -0
  175. package/src/val/PrefVal.ts +159 -0
  176. package/src/val/RefVal.ts +384 -0
  177. package/src/val/ScalarKindVal.ts +125 -0
  178. package/src/val/ScalarVal.ts +105 -0
  179. package/src/val/StringVal.ts +37 -0
  180. package/src/val/SuperFuncVal.ts +46 -0
  181. package/src/val/TopVal.ts +69 -0
  182. package/src/val/TypeFuncVal.ts +69 -0
  183. package/src/val/UpperFuncVal.ts +72 -0
  184. package/src/val/Val.ts +294 -0
  185. package/src/val/VarVal.ts +171 -0
  186. package/src/val/top.ts +12 -0
  187. package/src/val/valutil.ts +31 -0
  188. package/aontu.ts +0 -92
  189. package/dist/lib/err.d.ts +0 -4
  190. package/dist/lib/err.js +0 -61
  191. package/dist/lib/err.js.map +0 -1
  192. package/dist/lib/lang.d.ts +0 -15
  193. package/dist/lib/lang.js +0 -409
  194. package/dist/lib/lang.js.map +0 -1
  195. package/dist/lib/op/disjunct.d.ts +0 -3
  196. package/dist/lib/op/disjunct.js +0 -28
  197. package/dist/lib/op/disjunct.js.map +0 -1
  198. package/dist/lib/op/op.d.ts +0 -6
  199. package/dist/lib/op/op.js +0 -9
  200. package/dist/lib/op/op.js.map +0 -1
  201. package/dist/lib/op/unite.d.ts +0 -3
  202. package/dist/lib/op/unite.js +0 -100
  203. package/dist/lib/op/unite.js.map +0 -1
  204. package/dist/lib/type.d.ts +0 -49
  205. package/dist/lib/type.js +0 -7
  206. package/dist/lib/type.js.map +0 -1
  207. package/dist/lib/unify.d.ts +0 -38
  208. package/dist/lib/unify.js +0 -67
  209. package/dist/lib/unify.js.map +0 -1
  210. package/dist/lib/utility.d.ts +0 -3
  211. package/dist/lib/utility.js +0 -16
  212. package/dist/lib/utility.js.map +0 -1
  213. package/dist/lib/val/ConjunctVal.d.ts +0 -17
  214. package/dist/lib/val/ConjunctVal.js +0 -171
  215. package/dist/lib/val/ConjunctVal.js.map +0 -1
  216. package/dist/lib/val/DisjunctVal.d.ts +0 -17
  217. package/dist/lib/val/DisjunctVal.js +0 -95
  218. package/dist/lib/val/DisjunctVal.js.map +0 -1
  219. package/dist/lib/val/ListVal.d.ts +0 -18
  220. package/dist/lib/val/ListVal.js +0 -120
  221. package/dist/lib/val/ListVal.js.map +0 -1
  222. package/dist/lib/val/MapVal.d.ts +0 -18
  223. package/dist/lib/val/MapVal.js +0 -117
  224. package/dist/lib/val/MapVal.js.map +0 -1
  225. package/dist/lib/val/Nil.d.ts +0 -22
  226. package/dist/lib/val/Nil.js.map +0 -1
  227. package/dist/lib/val/NullVal.d.ts +0 -15
  228. package/dist/lib/val/NullVal.js +0 -38
  229. package/dist/lib/val/NullVal.js.map +0 -1
  230. package/dist/lib/val/OpVal.d.ts +0 -17
  231. package/dist/lib/val/OpVal.js +0 -89
  232. package/dist/lib/val/OpVal.js.map +0 -1
  233. package/dist/lib/val/PlusVal.d.ts +0 -12
  234. package/dist/lib/val/PlusVal.js +0 -32
  235. package/dist/lib/val/PlusVal.js.map +0 -1
  236. package/dist/lib/val/PrefVal.d.ts +0 -17
  237. package/dist/lib/val/PrefVal.js +0 -87
  238. package/dist/lib/val/PrefVal.js.map +0 -1
  239. package/dist/lib/val/RefVal.d.ts +0 -22
  240. package/dist/lib/val/RefVal.js +0 -247
  241. package/dist/lib/val/RefVal.js.map +0 -1
  242. package/dist/lib/val/ValBase.d.ts +0 -26
  243. package/dist/lib/val/ValBase.js +0 -77
  244. package/dist/lib/val/ValBase.js.map +0 -1
  245. package/dist/lib/val/VarVal.d.ts +0 -15
  246. package/dist/lib/val/VarVal.js +0 -84
  247. package/dist/lib/val/VarVal.js.map +0 -1
  248. package/dist/lib/val.d.ts +0 -81
  249. package/dist/lib/val.js +0 -191
  250. package/dist/lib/val.js.map +0 -1
  251. package/lib/err.ts +0 -83
  252. package/lib/lang.ts +0 -585
  253. package/lib/op/disjunct.ts +0 -51
  254. package/lib/op/op.ts +0 -18
  255. package/lib/op/unite.ts +0 -143
  256. package/lib/type.ts +0 -95
  257. package/lib/unify.ts +0 -128
  258. package/lib/utility.ts +0 -24
  259. package/lib/val/ConjunctVal.ts +0 -265
  260. package/lib/val/DisjunctVal.ts +0 -160
  261. package/lib/val/ListVal.ts +0 -196
  262. package/lib/val/MapVal.ts +0 -181
  263. package/lib/val/NullVal.ts +0 -72
  264. package/lib/val/OpVal.ts +0 -159
  265. package/lib/val/PlusVal.ts +0 -76
  266. package/lib/val/PrefVal.ts +0 -154
  267. package/lib/val/RefVal.ts +0 -362
  268. package/lib/val/ValBase.ts +0 -109
  269. package/lib/val/VarVal.ts +0 -157
  270. package/lib/val.ts +0 -327
package/dist/hints.js ADDED
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ /* Copyright (c) 2025 Richard Rodger, MIT License */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.hints = void 0;
5
+ /**
6
+ * Error code hints for Aontu unification errors.
7
+ *
8
+ * Each key is an error code that can be passed to makeNilErr.
9
+ * Each value is a human-readable explanation of what the error means.
10
+ */
11
+ const hints = {
12
+ scalar_value: 'Literal scalar values of the same kind can only unify if they are\n' +
13
+ 'exactly equal.' +
14
+ '\n \nExamples:\n' +
15
+ ' 1 & 1 -> 1 # Does unify (equal Integers);\n' +
16
+ ' a & a -> a # Does unify (equal Strings);\n' +
17
+ ' 1 & 2 -> nil # Does not unify (unequal Integers);\n' +
18
+ ' 1 & 1.0 -> nil # Does not unify (kinds: Integer & Number).',
19
+ scalar_kind: 'Literal scalar values of different kinds cannot unify.' +
20
+ '\n \nExamples:\n' +
21
+ ' 1 & 1 -> 1 # Does unify (equal Integers);\n' +
22
+ ' 1 & a -> nil # Does not unify (Kinds: Integer & String);\n' +
23
+ ' 1 & 1.0 -> nil # Does not unify (kinds: Integer & Number).',
24
+ nil_gen: 'The nil value was present after unification, and nil cannot be\n' +
25
+ 'generated because nil is not a literal value.',
26
+ no_gen: 'This value was present after unification, and cannot be generated\n' +
27
+ 'because it is not a literal value.',
28
+ // TODO: extend errors to have details so we can name the key
29
+ mapval_required: 'This map value is required.',
30
+ mapval_no_gen: 'This value was present after unification, and cannot be generated\n' +
31
+ 'because it is not a literal value.',
32
+ listval_required: 'This list element is required.',
33
+ listval_no_gen: 'This list element was present after unification, and cannot be generated\n' +
34
+ 'because it is not a literal value.',
35
+ unknown_function: 'This function name is not recognized.',
36
+ literal_nil: 'A literal nil cannot unify with any other value.',
37
+ // Parsing errors
38
+ 'parse_bad_src': 'Invalid source provided for parsing. The source must be a non-empty string.',
39
+ // Unification errors
40
+ 'unify_no_src': 'No source provided for unification. Cannot unify without source values.',
41
+ 'unify_no_res': 'Unification produced no result. The values could not be unified.',
42
+ 'unite': 'Failed to unite two values. The values are incompatible and cannot be unified.',
43
+ 'cycle': 'Circular reference detected during unification. The unification process encountered a cycle.',
44
+ 'internal': 'Internal error during unification. This indicates an unexpected error in the unification process.',
45
+ // Type mismatch errors
46
+ 'scalar-type': 'Scalar type mismatch. The scalar types are incompatible.',
47
+ 'no-scalar-unify': 'Cannot unify scalar values. The scalar values have incompatible types.',
48
+ 'not-scalar-type': 'Expected a scalar type but got a non-scalar type.',
49
+ 'map': 'Type mismatch: expected a map value but got a different type.',
50
+ 'list': 'Type mismatch: expected a list value but got a different type.',
51
+ // Argument errors
52
+ 'arg': 'Missing required argument. A function requires an argument but none was provided.',
53
+ 'invalid-arg': 'Invalid argument provided. The argument does not match the expected type or format.',
54
+ 'no_first_arg': 'Missing first argument. The function requires a first argument but none was provided.',
55
+ // Variable errors
56
+ 'unknown_var': 'Unknown variable reference. The variable has not been defined.',
57
+ 'invalid_var_kind': 'Invalid variable kind. The variable type does not match the expected kind.',
58
+ // Path and reference errors
59
+ path_cycle: 'Path cycle detected. The path contains a circular reference.',
60
+ 'ref': 'Reference resolution failed. Unable to resolve the reference to a value.',
61
+ // Closure and state errors
62
+ 'closed': 'Cannot add to closed structure. The map or list is closed and does not accept new keys/elements.',
63
+ 'required_listelem': 'Required list element is missing. A non-optional list element has no value.',
64
+ // Junction errors (disjunction/conjection)
65
+ '|:empty': 'Empty disjunction. The disjunction has no valid alternatives.',
66
+ '|:empty-dist': 'Empty disjunction distribution. All alternatives in the disjunction are invalid.',
67
+ // Function errors (dynamic patterns)
68
+ 'func': 'Function operation failed. See the specific function name for details.',
69
+ 'make': 'Failed to create a new value. The make operation could not construct the value.',
70
+ 'resolve': 'Failed to resolve a value. The resolution process could not find or compute the value.',
71
+ 'operate': 'Operation failed. The operation could not be performed on the given values.',
72
+ // Operator errors (dynamic patterns)
73
+ 'op': 'Operator operation failed. See the specific operator name for details.',
74
+ // Close operation
75
+ 'close': 'Failed to close structure. The structure could not be closed.',
76
+ // Dynamic patterns (these serve as prefixes)
77
+ 'func:': 'Function error: ',
78
+ 'op:': 'Operator error: ',
79
+ 'var[': 'Variable type error: ',
80
+ 'ref[': 'Reference error: ',
81
+ 'op[': 'Operator value error: ',
82
+ };
83
+ exports.hints = hints;
84
+ //# sourceMappingURL=hints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hints.js","sourceRoot":"","sources":["../src/hints.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAEpD;;;;;GAKG;AAEH,MAAM,KAAK,GAA2B;IAEpC,YAAY,EACV,qEAAqE;QACrE,gBAAgB;QAChB,kBAAkB;QAClB,oDAAoD;QACpD,mDAAmD;QACnD,0DAA0D;QAC1D,+DAA+D;IAEjE,WAAW,EACT,wDAAwD;QACxD,kBAAkB;QAClB,oDAAoD;QACpD,iEAAiE;QACjE,+DAA+D;IAEjE,OAAO,EACL,kEAAkE;QAClE,+CAA+C;IAEjD,MAAM,EACJ,qEAAqE;QACrE,oCAAoC;IAGtC,6DAA6D;IAC7D,eAAe,EAAE,6BAA6B;IAE9C,aAAa,EACX,qEAAqE;QACrE,oCAAoC;IAEtC,gBAAgB,EAAE,gCAAgC;IAElD,cAAc,EACZ,4EAA4E;QAC5E,oCAAoC;IAEtC,gBAAgB,EACd,uCAAuC;IAEzC,WAAW,EACT,kDAAkD;IAGpD,iBAAiB;IACjB,eAAe,EAAE,6EAA6E;IAE9F,qBAAqB;IACrB,cAAc,EAAE,yEAAyE;IACzF,cAAc,EAAE,kEAAkE;IAClF,OAAO,EAAE,gFAAgF;IACzF,OAAO,EAAE,8FAA8F;IACvG,UAAU,EAAE,mGAAmG;IAE/G,uBAAuB;IAEvB,aAAa,EAAE,0DAA0D;IACzE,iBAAiB,EAAE,wEAAwE;IAC3F,iBAAiB,EAAE,mDAAmD;IACtE,KAAK,EAAE,+DAA+D;IACtE,MAAM,EAAE,gEAAgE;IAExE,kBAAkB;IAClB,KAAK,EAAE,mFAAmF;IAC1F,aAAa,EAAE,qFAAqF;IACpG,cAAc,EAAE,uFAAuF;IAEvG,kBAAkB;IAClB,aAAa,EAAE,gEAAgE;IAC/E,kBAAkB,EAAE,4EAA4E;IAEhG,4BAA4B;IAC5B,UAAU,EAAE,8DAA8D;IAC1E,KAAK,EAAE,0EAA0E;IAEjF,2BAA2B;IAC3B,QAAQ,EAAE,kGAAkG;IAC5G,mBAAmB,EAAE,6EAA6E;IAElG,2CAA2C;IAC3C,SAAS,EAAE,+DAA+D;IAC1E,cAAc,EAAE,kFAAkF;IAElG,qCAAqC;IACrC,MAAM,EAAE,wEAAwE;IAChF,MAAM,EAAE,iFAAiF;IACzF,SAAS,EAAE,wFAAwF;IACnG,SAAS,EAAE,6EAA6E;IAExF,qCAAqC;IACrC,IAAI,EAAE,wEAAwE;IAE9E,kBAAkB;IAClB,OAAO,EAAE,+DAA+D;IAExE,6CAA6C;IAC7C,OAAO,EAAE,kBAAkB;IAC3B,KAAK,EAAE,kBAAkB;IACzB,MAAM,EAAE,uBAAuB;IAC/B,MAAM,EAAE,mBAAmB;IAC3B,KAAK,EAAE,wBAAwB;CAChC,CAAA;AAIC,sBAAK"}
package/dist/lang.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { Jsonic } from 'jsonic';
2
+ import type { Val, AontuOptions } from './type';
3
+ import { Site } from './site';
4
+ declare class Lang {
5
+ jsonic: Jsonic;
6
+ opts: AontuOptions;
7
+ idcount: number | undefined;
8
+ constructor(options?: Partial<AontuOptions>);
9
+ parse(src: string, opts?: Partial<AontuOptions>): Val;
10
+ }
11
+ export { Lang, Site, };
package/dist/lang.js ADDED
@@ -0,0 +1,569 @@
1
+ "use strict";
2
+ /* Copyright (c) 2021-2025 Richard Rodger, MIT License */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Site = exports.Lang = void 0;
5
+ // import { performance } from 'node:perf_hooks'
6
+ const jsonic_1 = require("jsonic");
7
+ const debug_1 = require("jsonic/debug");
8
+ const multisource_1 = require("@jsonic/multisource");
9
+ const file_1 = require("@jsonic/multisource/resolver/file");
10
+ const pkg_1 = require("@jsonic/multisource/resolver/pkg");
11
+ const mem_1 = require("@jsonic/multisource/resolver/mem");
12
+ const expr_1 = require("@jsonic/expr");
13
+ const path_1 = require("@jsonic/path");
14
+ const type_1 = require("./type");
15
+ const site_1 = require("./site");
16
+ Object.defineProperty(exports, "Site", { enumerable: true, get: function () { return site_1.Site; } });
17
+ const top_1 = require("./val/top");
18
+ const ScalarKindVal_1 = require("./val/ScalarKindVal");
19
+ const BooleanVal_1 = require("./val/BooleanVal");
20
+ const ConjunctVal_1 = require("./val/ConjunctVal");
21
+ const DisjunctVal_1 = require("./val/DisjunctVal");
22
+ const IntegerVal_1 = require("./val/IntegerVal");
23
+ const ListVal_1 = require("./val/ListVal");
24
+ const MapVal_1 = require("./val/MapVal");
25
+ const NilVal_1 = require("./val/NilVal");
26
+ const NullVal_1 = require("./val/NullVal");
27
+ const NumberVal_1 = require("./val/NumberVal");
28
+ const PrefVal_1 = require("./val/PrefVal");
29
+ const RefVal_1 = require("./val/RefVal");
30
+ const StringVal_1 = require("./val/StringVal");
31
+ const VarVal_1 = require("./val/VarVal");
32
+ const PlusOpVal_1 = require("./val/PlusOpVal");
33
+ const UpperFuncVal_1 = require("./val/UpperFuncVal");
34
+ const LowerFuncVal_1 = require("./val/LowerFuncVal");
35
+ const CopyFuncVal_1 = require("./val/CopyFuncVal");
36
+ const KeyFuncVal_1 = require("./val/KeyFuncVal");
37
+ const TypeFuncVal_1 = require("./val/TypeFuncVal");
38
+ const HideFuncVal_1 = require("./val/HideFuncVal");
39
+ const MoveFuncVal_1 = require("./val/MoveFuncVal");
40
+ const PathFuncVal_1 = require("./val/PathFuncVal");
41
+ const PrefFuncVal_1 = require("./val/PrefFuncVal");
42
+ const CloseFuncVal_1 = require("./val/CloseFuncVal");
43
+ const OpenFuncVal_1 = require("./val/OpenFuncVal");
44
+ const SuperFuncVal_1 = require("./val/SuperFuncVal");
45
+ let AontuJsonic = function AontuLang(jsonic) {
46
+ jsonic.use(path_1.Path);
47
+ // TODO: refactor Val constructor
48
+ // let addsite = (v: Val, p: string[]) => (v.path = [...(p || [])], v)
49
+ let addsite = (v, r, ctx) => {
50
+ v.site.row = null == r.o0 ? -1 : r.o0.rI;
51
+ v.site.col = null == r.o0 ? -1 : r.o0.cI;
52
+ v.site.url = ctx.meta.multisource ? ctx.meta.multisource.path : '';
53
+ v.path = r.k ? [...(r.k.path || [])] : [];
54
+ return v;
55
+ };
56
+ jsonic.options({
57
+ hint: {
58
+ unknown: `
59
+ Since the error is unknown, this is probably a bug. Please consider
60
+ posting a github issue - thanks!
61
+
62
+ Code: {code}, Details:
63
+ {details}`,
64
+ unexpected: `
65
+ The character(s) {src} were not expected at this point as they do not
66
+ match the expected syntax. Use the # character to comment out lines to
67
+ help isolate the syntax error.`,
68
+ },
69
+ errmsg: {
70
+ name: 'aontu',
71
+ suffix: false,
72
+ },
73
+ fixed: {
74
+ token: {
75
+ '#QM': '?'
76
+ },
77
+ },
78
+ value: {
79
+ def: {
80
+ // NOTE: specify with functions as jsonic/deep will
81
+ // remove class prototype as options are assumed plain
82
+ // (except for functions).
83
+ // TODO: jsonic should be able to pass context into these
84
+ 'string': {
85
+ val: (r, ctx) => addsite(new ScalarKindVal_1.ScalarKindVal({ peg: String }), r, ctx)
86
+ },
87
+ 'number': {
88
+ val: (r, ctx) => addsite(new ScalarKindVal_1.ScalarKindVal({ peg: Number }), r, ctx)
89
+ },
90
+ 'integer': {
91
+ val: (r, ctx) => addsite(new ScalarKindVal_1.ScalarKindVal({ peg: ScalarKindVal_1.Integer }), r, ctx)
92
+ },
93
+ 'boolean': {
94
+ val: (r, ctx) => addsite(new ScalarKindVal_1.ScalarKindVal({ peg: Boolean }), r, ctx)
95
+ },
96
+ 'nil': {
97
+ val: (r, ctx) => addsite(new NilVal_1.NilVal({ why: 'literal_nil' }), r, ctx)
98
+ },
99
+ // TODO: FIX: need a TOP instance to hold path
100
+ 'top': { val: () => (0, top_1.top)() },
101
+ }
102
+ },
103
+ map: {
104
+ merge: (prev, curr, _r, ctx) => {
105
+ let pval = prev;
106
+ let cval = curr;
107
+ if (pval?.isVal && cval?.isVal) {
108
+ // TODO: test multi element conjuncts work
109
+ if (pval.isConjunct && cval.isConjunct) {
110
+ pval.append(cval);
111
+ return pval;
112
+ }
113
+ else if (pval.isConjunct) {
114
+ pval.append(cval);
115
+ return pval;
116
+ }
117
+ else {
118
+ return addsite(new ConjunctVal_1.ConjunctVal({ peg: [pval, cval] }), prev, ctx);
119
+ }
120
+ }
121
+ // Handle defered conjuncts, where MapVal does not yet
122
+ // exist, by creating ConjunctVal later.
123
+ else {
124
+ prev.___merge = (prev.___merge || []);
125
+ prev.___merge.push(curr);
126
+ return prev;
127
+ }
128
+ }
129
+ }
130
+ });
131
+ const funcMap = {
132
+ upper: UpperFuncVal_1.UpperFuncVal,
133
+ lower: LowerFuncVal_1.LowerFuncVal,
134
+ copy: CopyFuncVal_1.CopyFuncVal,
135
+ key: KeyFuncVal_1.KeyFuncVal,
136
+ type: TypeFuncVal_1.TypeFuncVal,
137
+ hide: HideFuncVal_1.HideFuncVal,
138
+ move: MoveFuncVal_1.MoveFuncVal,
139
+ path: PathFuncVal_1.PathFuncVal,
140
+ pref: PrefFuncVal_1.PrefFuncVal,
141
+ close: CloseFuncVal_1.CloseFuncVal,
142
+ open: OpenFuncVal_1.OpenFuncVal,
143
+ super: SuperFuncVal_1.SuperFuncVal,
144
+ };
145
+ let opmap = {
146
+ 'conjunct-infix': (r, ctx, _op, terms) => addsite(new ConjunctVal_1.ConjunctVal({ peg: terms }), r, ctx),
147
+ 'disjunct-infix': (r, ctx, _op, terms) => addsite(new DisjunctVal_1.DisjunctVal({ peg: terms }), r, ctx),
148
+ 'dot-prefix': (r, ctx, _op, terms) => {
149
+ return addsite(new RefVal_1.RefVal({ peg: terms, prefix: true }), r, ctx);
150
+ },
151
+ 'dot-infix': (r, ctx, _op, terms) => {
152
+ // // console.log('DOT-INFIX-OP', terms)
153
+ return addsite(new RefVal_1.RefVal({ peg: terms }), r, ctx);
154
+ },
155
+ 'star-prefix': (r, ctx, _op, terms) => addsite(new PrefVal_1.PrefVal({ peg: terms[0] }), r, ctx),
156
+ 'dollar-prefix': (r, ctx, _op, terms) => {
157
+ // $.a.b absolute path
158
+ if (terms[0] instanceof RefVal_1.RefVal) {
159
+ terms[0].absolute = true;
160
+ return terms[0];
161
+ }
162
+ return addsite(new VarVal_1.VarVal({ peg: terms[0] }), r, ctx);
163
+ },
164
+ 'plus-infix': (r, ctx, _op, terms) => {
165
+ return addsite(new PlusOpVal_1.PlusOpVal({ peg: [terms[0], terms[1]] }), r, ctx);
166
+ },
167
+ 'negative-prefix': (r, ctx, _op, terms) => {
168
+ let val = terms[0];
169
+ val.peg = -1 * val.peg;
170
+ return addsite(val, r, ctx);
171
+ },
172
+ 'positive-prefix': (r, ctx, _op, terms) => {
173
+ let val = terms[0];
174
+ return addsite(val, r, ctx);
175
+ },
176
+ 'func-paren': (r, ctx, _op, terms) => {
177
+ let val = terms[1];
178
+ const fname = terms[0];
179
+ if ('' !== fname) {
180
+ const funcval = funcMap[fname];
181
+ const args = terms.slice(1);
182
+ val = null == funcval ?
183
+ new NilVal_1.NilVal({ why: 'unknown_function' }) :
184
+ new funcval({
185
+ peg: args
186
+ });
187
+ }
188
+ const out = addsite(val, r, ctx);
189
+ return out;
190
+ },
191
+ };
192
+ jsonic
193
+ .use(expr_1.Expr, {
194
+ op: {
195
+ // disjunct < conjunct: c & b | a -> (c & b) | a
196
+ 'conjunct': {
197
+ infix: true, src: '&', left: 16_000_000, right: 17_000_000
198
+ },
199
+ 'disjunct': {
200
+ infix: true, src: '|', left: 14_000_000, right: 15_000_000
201
+ },
202
+ 'plus-infix': {
203
+ src: '+',
204
+ infix: true,
205
+ left: 20_000_000,
206
+ right: 21_000_000,
207
+ },
208
+ 'dollar-prefix': {
209
+ src: '$',
210
+ prefix: true,
211
+ right: 31_000_000,
212
+ },
213
+ 'dot-infix': {
214
+ src: '.',
215
+ infix: true,
216
+ left: 25_000_000,
217
+ right: 24_000_000,
218
+ },
219
+ 'dot-prefix': {
220
+ src: '.',
221
+ prefix: true,
222
+ right: 24_000_000,
223
+ },
224
+ 'star': {
225
+ src: '*',
226
+ prefix: true,
227
+ right: 24_000_000,
228
+ },
229
+ 'func': {
230
+ paren: true,
231
+ preval: {
232
+ active: true,
233
+ // allow: ['floor'], //Object.keys(funcMap)
234
+ },
235
+ osrc: '(',
236
+ csrc: ')',
237
+ },
238
+ plain: null,
239
+ addition: null,
240
+ subtraction: null,
241
+ multiplication: null,
242
+ division: null,
243
+ remainder: null,
244
+ },
245
+ evaluate: (r, ctx, op, terms) => {
246
+ // // console.log('EVAL-START', r.u)
247
+ if ('func-paren' === op.name
248
+ // && !r.parent.prev?.u?.paren_preval
249
+ && !r.u?.paren_preval) {
250
+ // terms = [new StringVal({ peg: '' }), ...terms]
251
+ terms = ['', ...terms];
252
+ }
253
+ let val = opmap[op.name](r, ctx, op, terms);
254
+ // // console.log('EVAL', terms, '->', val)
255
+ return val;
256
+ }
257
+ });
258
+ const CJ = jsonic.token['#E&'];
259
+ const CL = jsonic.token.CL;
260
+ const ST = jsonic.token.ST;
261
+ const TX = jsonic.token.TX;
262
+ const NR = jsonic.token.NR;
263
+ const QM = jsonic.token.QM;
264
+ const OPTKEY = [TX, ST, NR];
265
+ jsonic.rule('val', (rs) => {
266
+ rs
267
+ .open([
268
+ { s: [CJ, CL], p: 'map', b: 2, n: { pk: 1 }, g: 'spread' },
269
+ {
270
+ s: [OPTKEY, QM],
271
+ c: (r) => 0 == r.d,
272
+ p: 'map',
273
+ b: 2,
274
+ g: 'pair,jsonic,top,aontu-optional',
275
+ },
276
+ {
277
+ s: [OPTKEY, QM],
278
+ p: 'map',
279
+ b: 2,
280
+ n: { pk: 1 },
281
+ g: 'pair,jsonic,top,dive,aontu-optional',
282
+ },
283
+ ])
284
+ .bc((r, ctx) => {
285
+ let valnode = r.node;
286
+ let valtype = typeof valnode;
287
+ if ('string' === valtype) {
288
+ valnode = addsite(new StringVal_1.StringVal({ peg: r.node }), r, ctx);
289
+ }
290
+ else if ('number' === valtype) {
291
+ // 1.0 in source is *not* an integer
292
+ if (Number.isInteger(r.node) && !r.o0.src.includes('.')) {
293
+ valnode = addsite(new IntegerVal_1.IntegerVal({ peg: r.node, src: r.o0.src }), r, ctx);
294
+ }
295
+ else {
296
+ valnode = addsite(new NumberVal_1.NumberVal({ peg: r.node, src: r.o0.src }), r, ctx);
297
+ }
298
+ }
299
+ else if ('boolean' === valtype) {
300
+ valnode = addsite(new BooleanVal_1.BooleanVal({ peg: r.node }), r, ctx);
301
+ }
302
+ else if (null === valnode) {
303
+ valnode = addsite(new NullVal_1.NullVal({ peg: r.node }), r, ctx);
304
+ }
305
+ if (null != valnode && 'object' === typeof valnode && valnode.site) {
306
+ let st = r.o0;
307
+ valnode.site.row = st.rI;
308
+ valnode.site.col = st.cI;
309
+ valnode.site.url = ctx.meta.multisource && ctx.meta.multisource.path;
310
+ }
311
+ // else { ERROR? }
312
+ r.node = valnode;
313
+ return undefined;
314
+ })
315
+ .close([{ s: [CJ, CL], b: 2, g: 'spread,json,more' }]);
316
+ return rs;
317
+ });
318
+ jsonic.rule('map', (rs) => {
319
+ rs
320
+ .open([
321
+ { s: [CJ, CL], p: 'pair', b: 2, g: 'spread' },
322
+ { s: [OPTKEY, QM], p: 'pair', b: 2, g: 'pair,list,val,imp,jsonic,aontu-optional' },
323
+ ])
324
+ .bc((r, ctx) => {
325
+ const optionalKeys = r.u.aontu_optional_keys ?? [];
326
+ let mo = r.node;
327
+ // Handle defered conjuncts, e.g. `{x:1 @"foo"}`
328
+ if (mo.___merge) {
329
+ let mop = { ...mo };
330
+ delete mop.___merge;
331
+ // TODO: needs addpath?
332
+ let mopv = new MapVal_1.MapVal({ peg: mop });
333
+ mopv.optionalKeys = optionalKeys;
334
+ r.node =
335
+ addsite(new ConjunctVal_1.ConjunctVal({ peg: [mopv, ...mo.___merge] }), r, ctx);
336
+ }
337
+ else {
338
+ r.node = addsite(new MapVal_1.MapVal({ peg: mo }), r, ctx);
339
+ r.node.optionalKeys = optionalKeys;
340
+ }
341
+ return undefined;
342
+ })
343
+ .close([{ s: [CJ, CL], b: 2, g: 'spread,json,more' }]);
344
+ return rs;
345
+ });
346
+ jsonic.rule('list', (rs) => {
347
+ rs
348
+ // .open([{ s: [CJ, CL], p: 'pair', b: 2, g: 'spread' }])
349
+ .bc((r, ctx) => {
350
+ const optionalKeys = r.u.aontu_optional_keys ?? [];
351
+ let ao = r.node;
352
+ if (ao.___merge) {
353
+ let aop = [...ao];
354
+ delete aop.___merge;
355
+ // TODO: needs addpath?
356
+ let aopv = new ListVal_1.ListVal({ peg: aop });
357
+ aopv.optionalKeys = optionalKeys;
358
+ r.node =
359
+ addsite(new ConjunctVal_1.ConjunctVal({ peg: [aopv, ...ao.___merge] }), r, ctx);
360
+ }
361
+ else {
362
+ r.node = addsite(new ListVal_1.ListVal({ peg: ao }), r, ctx);
363
+ r.node.optionalKeys = optionalKeys;
364
+ }
365
+ return undefined;
366
+ });
367
+ // .close([{ s: [CJ, CL], b: 2, g: 'spread,json,more' }])
368
+ return rs;
369
+ });
370
+ // TODO: copied from jsonic grammar
371
+ // jsonic should provide a way to export this
372
+ const pairkey = (r) => {
373
+ // Get key string value from first matching token of `Open` state.
374
+ const key_token = r.o0;
375
+ const key = ST === key_token.tin || TX === key_token.tin
376
+ ? key_token.val // Was text
377
+ : key_token.src; // Was number, use original text
378
+ r.u.key = key;
379
+ };
380
+ jsonic.rule('pair', (rs) => {
381
+ rs
382
+ .open([
383
+ {
384
+ s: [CJ, CL], p: 'val',
385
+ u: { spread: true },
386
+ g: 'spread'
387
+ },
388
+ {
389
+ s: [OPTKEY, QM], b: 1, r: 'pair', u: { aontu_optional: true },
390
+ g: 'aontu-optional-key'
391
+ },
392
+ {
393
+ s: [QM, CL],
394
+ c: (r) => r.prev.u.aontu_optional,
395
+ p: 'val',
396
+ u: { pair: true },
397
+ a: (r) => {
398
+ pairkey(r.prev);
399
+ r.u.key = r.prev.u.key;
400
+ r.parent.u.aontu_optional_keys = (r.parent.u.aontu_optional_keys || []);
401
+ r.parent.u.aontu_optional_keys.push('' + r.u.key);
402
+ },
403
+ g: 'aontu-optional-pair'
404
+ }
405
+ ])
406
+ // NOTE: manually adjust path - @jsonic/path ignores as not pair:true
407
+ .ao((r) => {
408
+ if (0 < r.d && r.u.spread) {
409
+ r.child.k.path = [...r.k.path, '&'];
410
+ r.child.k.key = '&';
411
+ }
412
+ })
413
+ .bc((rule) => {
414
+ // TRAVERSE PARENTS TO GET PATH
415
+ if (rule.u.spread) {
416
+ rule.node[type_1.SPREAD] =
417
+ (rule.node[type_1.SPREAD] || { o: rule.o0.src, v: [] });
418
+ rule.node[type_1.SPREAD].v.push(rule.child.node);
419
+ }
420
+ return undefined;
421
+ })
422
+ .close([
423
+ { s: [CJ, CL], c: (r) => r.lte('dmap', 1), r: 'pair', b: 2, g: 'spread,json,pair' },
424
+ { s: [CJ, CL], b: 2, g: 'spread,json,more' }
425
+ ]);
426
+ return rs;
427
+ });
428
+ jsonic.rule('elem', (rs) => {
429
+ rs
430
+ .open([
431
+ {
432
+ s: [CJ, CL],
433
+ p: 'val',
434
+ n: { pk: 1, dmap: 1 },
435
+ u: { spread: true, done: true, list: true },
436
+ g: 'spread'
437
+ },
438
+ {
439
+ s: [OPTKEY, QM], b: 1, r: 'elem', u: { aontu_optional: true },
440
+ g: 'aontu-optional-key-elem'
441
+ },
442
+ {
443
+ s: [QM, CL],
444
+ c: (r) => r.prev.u.aontu_optional,
445
+ p: 'val',
446
+ u: { spread: true, done: true, list: true, pair: true },
447
+ a: (r) => {
448
+ pairkey(r.prev);
449
+ r.u.key = r.prev.u.key;
450
+ r.parent.u.aontu_optional_keys = (r.parent.u.aontu_optional_keys || []);
451
+ r.parent.u.aontu_optional_keys.push('' + r.u.key);
452
+ },
453
+ g: 'aontu-optional-elem'
454
+ }
455
+ ])
456
+ .bc((rule) => {
457
+ // TRAVERSE PARENTS TO GET PATH
458
+ if (rule.u.spread) {
459
+ rule.node[type_1.SPREAD] =
460
+ (rule.node[type_1.SPREAD] || { o: rule.o0.src, v: [] });
461
+ rule.node[type_1.SPREAD].v.push(rule.child.node);
462
+ }
463
+ return undefined;
464
+ })
465
+ .close([{ s: [CJ, CL], r: 'elem', b: 2, g: 'spread,json,more' }]);
466
+ return rs;
467
+ });
468
+ };
469
+ function makeModelResolver(options) {
470
+ const useRequire = options.require || require;
471
+ let memResolver = (0, mem_1.makeMemResolver)({
472
+ ...(options.resolver?.mem || {})
473
+ });
474
+ // TODO: make this consistent with other resolvers
475
+ let fileResolver = (0, file_1.makeFileResolver)((spec) => {
476
+ return 'string' === typeof spec ? spec : spec?.peg;
477
+ });
478
+ let pkgResolver = (0, pkg_1.makePkgResolver)({
479
+ require: useRequire,
480
+ ...(options.resolver?.pkg || {})
481
+ });
482
+ return function ModelResolver(spec, popts, rule, ctx, jsonic) {
483
+ let path = 'string' === typeof spec ? spec : spec?.peg;
484
+ let search = [];
485
+ let res = memResolver(path, popts, rule, ctx, jsonic);
486
+ res.path = path;
487
+ if (res.found) {
488
+ return res;
489
+ }
490
+ search = search.concat(res.search);
491
+ res = fileResolver(path, popts, rule, ctx, jsonic);
492
+ res.path = path;
493
+ if (res.found) {
494
+ return res;
495
+ }
496
+ search = search.concat(res.search);
497
+ res = pkgResolver(path, popts, rule, ctx, jsonic);
498
+ res.path = path;
499
+ if (res.found) {
500
+ return res;
501
+ }
502
+ res.search = search.concat(res.search);
503
+ return res;
504
+ };
505
+ }
506
+ class Lang {
507
+ constructor(options) {
508
+ // const start = performance.now()
509
+ this.opts = Object.assign((0, type_1.DEFAULT_OPTS)(), options);
510
+ const modelResolver = makeModelResolver(this.opts);
511
+ this.jsonic = jsonic_1.Jsonic.make();
512
+ if (this.opts.debug) {
513
+ this.jsonic.use(debug_1.Debug, {
514
+ trace: this.opts.trace
515
+ });
516
+ }
517
+ this.jsonic
518
+ .use(AontuJsonic)
519
+ .use(multisource_1.MultiSource, {
520
+ // resolver: options?.resolver || includeFileResolver
521
+ resolver: options?.resolver || modelResolver
522
+ });
523
+ // if (false === (global as any).aontu_warm) {
524
+ // (global as any).aontu.time.langctor.push(performance.now() - start)
525
+ // }
526
+ }
527
+ parse(src, opts) {
528
+ // const start = performance.now()
529
+ // JSONIC-UPDATE - check meta
530
+ let jm = {
531
+ fs: opts?.fs,
532
+ fileName: opts?.path ?? this.opts.path,
533
+ multisource: {
534
+ path: opts?.path ?? this.opts.path,
535
+ deps: (opts && opts.deps) || undefined
536
+ }
537
+ };
538
+ if (null != opts?.idcount) {
539
+ this.idcount = opts.idcount;
540
+ }
541
+ // Pass through Jsonic debug log value
542
+ if (opts && null != opts.log && Number.isInteger(opts.log)) {
543
+ jm.log = opts.log;
544
+ }
545
+ // jm.log = -1
546
+ let val;
547
+ try {
548
+ val = this.jsonic(src, jm);
549
+ }
550
+ catch (e) {
551
+ if (e instanceof jsonic_1.JsonicError || 'JsonicError' === e.constructor.name) {
552
+ val = new NilVal_1.NilVal({
553
+ why: 'parse',
554
+ err: new NilVal_1.NilVal({
555
+ why: 'syntax',
556
+ msg: e.message,
557
+ err: e,
558
+ })
559
+ });
560
+ }
561
+ else {
562
+ throw e;
563
+ }
564
+ }
565
+ return val;
566
+ }
567
+ }
568
+ exports.Lang = Lang;
569
+ //# sourceMappingURL=lang.js.map