eliscript 0.1.0 → 0.1.1

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 (185) hide show
  1. package/README.md +9 -8
  2. package/bootstrap/compiler/emitter.eli +161 -63
  3. package/bootstrap/host/check-cli.mjs +0 -1
  4. package/bootstrap/host/check-cli.mjs.map +1 -1
  5. package/bootstrap/host/compiler-session.eli +2 -1
  6. package/bootstrap/host/eliscript-cli.mjs +2 -9
  7. package/bootstrap/host/eliscript-cli.mjs.map +1 -1
  8. package/bootstrap/host/project-cli.mjs +1 -11
  9. package/bootstrap/host/project-cli.mjs.map +1 -1
  10. package/bootstrap/host/project.mjs +2 -8
  11. package/bootstrap/host/project.mjs.map +1 -1
  12. package/browser/README.md +1 -1
  13. package/compiler/README.md +2 -2
  14. package/compiler/eliscript-emitter.el +229 -85
  15. package/compiler/eliscript-ir-emitter.el +64 -34
  16. package/compiler/eliscript-project.el +20 -5
  17. package/dist/backends/async.mjs +1 -90
  18. package/dist/backends/async.mjs.map +1 -1
  19. package/dist/backends/binary.mjs +1 -91
  20. package/dist/backends/binary.mjs.map +1 -1
  21. package/dist/backends/capabilities.mjs +1 -90
  22. package/dist/backends/capabilities.mjs.map +1 -1
  23. package/dist/backends/elf.mjs +1 -90
  24. package/dist/backends/elf.mjs.map +1 -1
  25. package/dist/backends/managed.mjs +1 -94
  26. package/dist/backends/managed.mjs.map +1 -1
  27. package/dist/backends/memory.mjs +1 -90
  28. package/dist/backends/memory.mjs.map +1 -1
  29. package/dist/backends/native.mjs +1 -91
  30. package/dist/backends/native.mjs.map +1 -1
  31. package/dist/backends/numeric.mjs +1 -90
  32. package/dist/backends/numeric.mjs.map +1 -1
  33. package/dist/backends/optimize.mjs +1 -90
  34. package/dist/backends/optimize.mjs.map +1 -1
  35. package/dist/backends/regexp.mjs +1 -91
  36. package/dist/backends/regexp.mjs.map +1 -1
  37. package/dist/backends/sha256.mjs +2 -96
  38. package/dist/backends/sha256.mjs.map +1 -1
  39. package/dist/backends/wasm.mjs +1 -90
  40. package/dist/backends/wasm.mjs.map +1 -1
  41. package/dist/bootstrap/analyzer.mjs +1 -95
  42. package/dist/bootstrap/analyzer.mjs.map +1 -1
  43. package/dist/bootstrap/compiler.mjs +1 -105
  44. package/dist/bootstrap/compiler.mjs.map +1 -1
  45. package/dist/bootstrap/emitter.mjs +848 -807
  46. package/dist/bootstrap/emitter.mjs.map +1 -1
  47. package/dist/bootstrap/expander.mjs +1 -96
  48. package/dist/bootstrap/expander.mjs.map +1 -1
  49. package/dist/bootstrap/formatter.mjs +1 -104
  50. package/dist/bootstrap/formatter.mjs.map +1 -1
  51. package/dist/bootstrap/ir.mjs +18 -172
  52. package/dist/bootstrap/ir.mjs.map +1 -1
  53. package/dist/bootstrap/lower.mjs +1 -92
  54. package/dist/bootstrap/lower.mjs.map +1 -1
  55. package/dist/bootstrap/project.mjs +23 -209
  56. package/dist/bootstrap/project.mjs.map +1 -1
  57. package/dist/bootstrap/reader.mjs +1 -96
  58. package/dist/bootstrap/reader.mjs.map +1 -1
  59. package/dist/bootstrap/source-map.mjs +7 -112
  60. package/dist/bootstrap/source-map.mjs.map +1 -1
  61. package/dist/bootstrap/symbol.mjs +7 -114
  62. package/dist/bootstrap/symbol.mjs.map +1 -1
  63. package/dist/bootstrap/syntax.mjs +10 -176
  64. package/dist/bootstrap/syntax.mjs.map +1 -1
  65. package/dist/bootstrap/transient-analysis.mjs +1 -93
  66. package/dist/bootstrap/transient-analysis.mjs.map +1 -1
  67. package/dist/browser/compiler.js +105 -104
  68. package/dist/browser/loader.js +1 -1
  69. package/dist/browser/loader.mjs +5 -124
  70. package/dist/compiler-artifact.json +1 -1
  71. package/dist/host/compiler-session.mjs +205 -297
  72. package/dist/host/compiler-session.mjs.map +1 -1
  73. package/dist/host/compiler-tools.mjs +1 -91
  74. package/dist/host/compiler-tools.mjs.map +1 -1
  75. package/dist/literal-sources/runtime/core/order.eli +32 -10
  76. package/dist/literal-sources/runtime/core/sequence.eli +69 -28
  77. package/dist/literal-sources/runtime/core/vector.eli +2 -4
  78. package/dist/literal-sources/stdlib/managed-literal-protocols.eli +5 -5
  79. package/dist/literal-sources/stdlib/managed-literals.eli +1 -1
  80. package/dist/package.json +1 -0
  81. package/dist/runtime/math.mjs +62 -252
  82. package/dist/runtime/math.mjs.map +1 -1
  83. package/dist/runtime/prelude.mjs +95 -0
  84. package/dist/runtime/prelude.mjs.macro-origins.json +1 -0
  85. package/dist/runtime/prelude.mjs.map +1 -0
  86. package/dist/runtime/unicode-case-data.mjs +1 -95
  87. package/dist/runtime/unicode-case-data.mjs.map +1 -1
  88. package/dist/runtime/unicode-case.mjs +3 -97
  89. package/dist/runtime/unicode-case.mjs.map +1 -1
  90. package/dist/stage3-release.json +1 -1
  91. package/editor/README.md +9 -4
  92. package/editor/eliscript-compat.el +164 -2
  93. package/editor/eliscript-mode.el +1 -1
  94. package/editor/eliscript-repl.el +1 -1
  95. package/package.json +2 -1
  96. package/runtime/README.md +21 -1
  97. package/runtime/core/protocol-impl.mjs +1 -115
  98. package/runtime/core/protocol-impl.mjs.map +1 -1
  99. package/runtime/core/text-impl.mjs +1 -90
  100. package/runtime/core/text-impl.mjs.map +1 -1
  101. package/runtime/core/vector.eli +1 -1
  102. package/runtime/core/vector.mjs +0 -9
  103. package/runtime/emacs-compat.eli +5957 -2
  104. package/runtime/emacs-compat.mjs +13522 -2295
  105. package/runtime/emacs-compat.mjs.map +1 -0
  106. package/runtime/math.mjs +62 -252
  107. package/runtime/math.mjs.map +1 -1
  108. package/runtime/prelude.eli +4 -0
  109. package/runtime/prelude.mjs +95 -0
  110. package/runtime/prelude.mjs.map +1 -0
  111. package/runtime/unicode-case-data.mjs +1 -95
  112. package/runtime/unicode-case-data.mjs.map +1 -1
  113. package/runtime/unicode-case.mjs +3 -97
  114. package/runtime/unicode-case.mjs.map +1 -1
  115. package/stdlib/managed-literals.eli +1 -1
  116. package/stdlib/managed-runtime-vector.eli +2 -4
  117. package/tools/backends/compiler-build.mjs +3 -93
  118. package/tools/backends/compiler-cli.mjs +2 -15
  119. package/tools/backends/compiler-corpus-bit.mjs +2 -95
  120. package/tools/backends/compiler-corpus-cli-adapters.mjs +1 -97
  121. package/tools/backends/compiler-corpus-debugging.mjs +2 -95
  122. package/tools/backends/compiler-corpus-emitter.mjs +1 -97
  123. package/tools/backends/compiler-corpus-execution.mjs +2 -108
  124. package/tools/backends/compiler-corpus-fuzz.mjs +2 -95
  125. package/tools/backends/compiler-corpus-host-context.mjs +2 -99
  126. package/tools/backends/compiler-corpus-identity-host.mjs +18 -123
  127. package/tools/backends/compiler-corpus-identity-value-adapters.mjs +0 -9
  128. package/tools/backends/compiler-corpus-literal-provider.mjs +1 -91
  129. package/tools/backends/compiler-corpus-managed-adapters.mjs +1 -99
  130. package/tools/backends/compiler-corpus-managed-fixtures.mjs +2 -113
  131. package/tools/backends/compiler-corpus-matchers.mjs +3 -106
  132. package/tools/backends/compiler-corpus-original-program.mjs +1 -91
  133. package/tools/backends/compiler-corpus-process.mjs +1 -92
  134. package/tools/backends/compiler-corpus-program-driver.mjs +1 -3
  135. package/tools/backends/compiler-corpus-project-adapters.mjs +1 -95
  136. package/tools/backends/compiler-corpus-project-entry-host.mjs +2 -92
  137. package/tools/backends/compiler-corpus-project-transport.mjs +1 -90
  138. package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1 -91
  139. package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1 -92
  140. package/tools/backends/compiler-corpus-raw-math-fixture.mjs +1 -91
  141. package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +1 -91
  142. package/tools/backends/compiler-corpus-reference.mjs +1 -90
  143. package/tools/backends/compiler-corpus-runtime-adapters.mjs +2 -110
  144. package/tools/backends/compiler-corpus-tools-cli.mjs +1 -95
  145. package/tools/backends/compiler-corpus-tools-reference.mjs +22 -163
  146. package/tools/backends/compiler-corpus.mjs +3 -125
  147. package/tools/backends/compiler-matrix.mjs +1 -92
  148. package/tools/backends/compiler-package-browser.mjs +1 -90
  149. package/tools/backends/compiler-package.mjs +3 -95
  150. package/tools/backends/compiler-unicode-profile-host.mjs +1 -91
  151. package/tools/backends/dist/bootstrap-js-stages.mjs +1 -91
  152. package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -1
  153. package/tools/backends/dist/managed-ir-inventory.mjs +1 -91
  154. package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -1
  155. package/tools/backends/dist/record-grid.mjs +1 -91
  156. package/tools/backends/dist/record-grid.mjs.map +1 -1
  157. package/tools/backends/dist/release-cli.mjs +4 -94
  158. package/tools/backends/dist/release-cli.mjs.map +1 -1
  159. package/tools/backends/dist/run-artifact.mjs +1 -91
  160. package/tools/backends/dist/run-artifact.mjs.map +1 -1
  161. package/tools/backends/eliscript/compiler-corpus-bit.eli +1 -0
  162. package/tools/backends/managed-foreign-binding.mjs +1 -95
  163. package/tools/backends/managed-host-lifecycle.mjs +1 -91
  164. package/tools/backends/managed-host-object-provider.mjs +18 -59
  165. package/tools/backends/managed-host-object-realm.mjs +1 -91
  166. package/tools/backends/managed-host-proxy.mjs +9 -18
  167. package/tools/backends/managed-host-runtime.mjs +3 -105
  168. package/tools/backends/managed-host.mjs +1 -104
  169. package/tools/backends/managed-module-graph.mjs +1 -97
  170. package/tools/backends/managed-runtime.mjs +1 -96
  171. package/tools/backends/managed-source-view.mjs +13 -108
  172. package/tools/backends/native-managed-runtime.mjs +1 -91
  173. package/tools/backends/native-memory.mjs +1 -91
  174. package/tools/backends/stage3-targets.mjs +1 -91
  175. package/tools/bootstrap-runtime.el +3 -2
  176. package/tools/project/project.eli +1 -1
  177. package/tools/testing/stdlib-bit-corpus-host.mjs +1 -90
  178. package/tools/testing/stdlib-bit.mjs +1 -90
  179. package/dist/bootstrap/package.json +0 -1
  180. package/dist/bootstrap/runtime/math.mjs +0 -1117
  181. package/dist/bootstrap/runtime/math.mjs.map +0 -1
  182. package/dist/bootstrap/runtime/unicode-case-data.mjs +0 -10125
  183. package/dist/bootstrap/runtime/unicode-case-data.mjs.map +0 -1
  184. package/dist/bootstrap/runtime/unicode-case.mjs +0 -281
  185. package/dist/bootstrap/runtime/unicode-case.mjs.map +0 -1
@@ -1,125 +1,22 @@
1
1
  // Generated by Eliscript. Do not edit.
2
2
  import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
3
- var __eliscript_tdz_ready_0;
4
- function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("formatter_format"); return formatter_format; }
5
- function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("formatter_format"); return __eliscript_const_error(); }
6
- var __eliscript_tdz_ready_1;
7
- function __eliscript_tdz_read_1() { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("formatter_version"); return formatter_version; }
8
- function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("formatter_version"); return __eliscript_const_error(); }
9
3
  var __eliscript_tdz_ready_2;
10
4
  function __eliscript_tdz_read_2() { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("formatter_width"); return formatter_width; }
11
- function __eliscript_tdz_write_2(__eliscript_tdz_value_2) { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("formatter_width"); return __eliscript_const_error(); }
12
5
  var __eliscript_tdz_ready_3;
13
6
  function __eliscript_tdz_read_3() { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("formatter_indent"); return formatter_indent; }
14
- function __eliscript_tdz_write_3(__eliscript_tdz_value_3) { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("formatter_indent"); return __eliscript_const_error(); }
15
7
  var __eliscript_tdz_ready_4;
16
8
  function __eliscript_tdz_read_4() { if (__eliscript_tdz_ready_4 !== true) __eliscript_tdz_error("formatter_fail"); return formatter_fail; }
17
- function __eliscript_tdz_write_4(__eliscript_tdz_value_4) { if (__eliscript_tdz_ready_4 !== true) __eliscript_tdz_error("formatter_fail"); return __eliscript_const_error(); }
18
9
  var __eliscript_tdz_ready_5;
19
10
  function __eliscript_tdz_read_5() { if (__eliscript_tdz_ready_5 !== true) __eliscript_tdz_error("declaration_heads"); return declaration_heads; }
20
- function __eliscript_tdz_write_5(__eliscript_tdz_value_5) { if (__eliscript_tdz_ready_5 !== true) __eliscript_tdz_error("declaration_heads"); return __eliscript_const_error(); }
21
11
  var __eliscript_tdz_ready_6;
22
12
  function __eliscript_tdz_read_6() { if (__eliscript_tdz_ready_6 !== true) __eliscript_tdz_error("operand_heads"); return operand_heads; }
23
- function __eliscript_tdz_write_6(__eliscript_tdz_value_6) { if (__eliscript_tdz_ready_6 !== true) __eliscript_tdz_error("operand_heads"); return __eliscript_const_error(); }
24
13
  import "eliscript/runtime/unicode-case.mjs";
25
- import { c as __eliscript_at, d as __eliscript_at_direct } from "data:text/javascript;base64,dmFyIG09UmVmbGVjdC5hcHBseSx0dD1OdW1iZXIucHJvdG90eXBlLnZhbHVlT2Ysaj1OdW1iZXIucHJvdG90eXBlLnRvU3RyaW5nLFU9TnVtYmVyLG50PU9iamVjdC5jcmVhdGUsaD1CaWdJbnQsZXQ9RGF0YVZpZXcsb3Q9QXJyYXlCdWZmZXIsaXQ9RGF0YVZpZXcucHJvdG90eXBlLnNldEZsb2F0NjQsSj1EYXRhVmlldy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HB0LHt2YWx1ZToodSk9PnUgaW5zdGFuY2VvZiBpLGNvbmZpZ3VyYWJsZTohMH0pO2xldCByPXMoRSxwLFt2b2lkIDBdKTt1dChyLGZ0KG8pKTtsZXQgbD1hdChvKTtmb3IobGV0IHU9MDt1PGwubGVuZ3RoO3UrKylUKHIsbFt1XSxsdChvLGxbdV0pKTtyZXR1cm4gcn1yZXR1cm4gcyh0LG4sZSl9fWZ1bmN0aW9uIFJ0KHQsbil7bGV0IGU9dFtuXTtyZXR1cm4oLi4ubyk9PkwoZSx0LG8pfWZ1bmN0aW9uIEF0KHQsbiwuLi5lKXtsZXQgbz10W25dO3JldHVybiBMKG8sdCxlKX1leHBvcnR7UnQgYXMgYyxBdCBhcyBkfTs=";
14
+ import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
26
15
  const __eliscript_truthy = (value) => value !== false && value != null;
27
- const __eliscript_number_intrinsic = globalThis.Number;
28
- const __eliscript_bigint_intrinsic = globalThis.BigInt;
29
- const __eliscript_numeric_apply = globalThis.Reflect.apply;
30
- const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
31
- const __eliscript_numeric_error = globalThis.TypeError;
32
- const __eliscript_numeric_trim = globalThis.String.prototype.trim;
33
- const __eliscript_numeric_slice = globalThis.String.prototype.slice;
34
- const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
35
- const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
36
- const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
37
- const __eliscript_numeric_primitive = (value) => {
38
- if (!__eliscript_numeric_object(value)) return value;
39
- const exotic = value[__eliscript_numeric_symbol];
40
- if (exotic !== void 0 && exotic !== null) {
41
- const result = __eliscript_numeric_apply(exotic, value, ["number"]);
42
- if (!__eliscript_numeric_object(result)) return result;
43
- throw new __eliscript_numeric_error("Cannot convert object to primitive value");
44
- }
45
- for (let index = 0; index < 2; index++) {
46
- const method = value[index === 0 ? "valueOf" : "toString"];
47
- if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
48
- const result = __eliscript_numeric_apply(method, value, []);
49
- if (!__eliscript_numeric_object(result)) return result;
50
- }
51
- }
52
- throw new __eliscript_numeric_error("Cannot convert object to primitive value");
53
- };
54
- const __eliscript_to_number = (value) => {
55
- const primitive = __eliscript_numeric_primitive(value);
56
- if (typeof primitive === "string") {
57
- const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
58
- if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
59
- let first = 2;
60
- while (first < text.length && text[first] === "0") first++;
61
- if (first === text.length) return 0;
62
- const prefix = text[1];
63
- const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
64
- if (text.length - first > limit) return 1 / 0;
65
- const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
66
- return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
67
- }
68
- }
69
- return __eliscript_number_intrinsic(primitive);
70
- };
71
- const __eliscript_numeric = (value) => {
72
- if (typeof value === "number" || typeof value === "bigint") return value;
73
- const primitive = __eliscript_numeric_primitive(value);
74
- if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
75
- return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
76
- };
77
- const __eliscript_implicit_number = (value) => {
78
- if (typeof value === "number") return value;
79
- const primitive = __eliscript_numeric_primitive(value);
80
- if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
81
- return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
82
- };
83
- const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
84
- const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
85
- const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
86
- const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
87
- const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
88
- const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
89
- const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
90
- const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
91
- const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
92
- const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
93
- const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
94
- const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
95
- const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
96
- const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
97
- const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
98
- const __eliscript_numeric_relation = (operator, left, right) => {
99
- if (typeof left === "number" && typeof right === "number") {
100
- if (operator === "<") return left < right;
101
- if (operator === "<=") return left <= right;
102
- if (operator === ">") return left > right;
103
- return left >= right;
104
- }
105
- let a = __eliscript_numeric_primitive(left);
106
- let b = __eliscript_numeric_primitive(right);
107
- const x = typeof a, y = typeof b;
108
- if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
109
- a = __eliscript_numeric(a);
110
- b = __eliscript_numeric(b);
111
- }
112
- if (operator === "<") return a < b;
113
- if (operator === "<=") return a <= b;
114
- if (operator === ">") return a > b;
115
- return a >= b;
116
- };
117
16
 
118
17
  import {read_string} from "./reader.mjs";
119
18
  const formatter_format = "eliscript-formatter";
120
- __eliscript_tdz_ready_0 = true;
121
19
  const formatter_version = 1;
122
- __eliscript_tdz_ready_1 = true;
123
20
  const formatter_width = 88;
124
21
  __eliscript_tdz_ready_2 = true;
125
22
  const formatter_indent = 2;
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap/formatter.mjs","sources":["bootstrap/compiler/formatter.eli"],"sourcesContent":["(module bootstrap.compiler.formatter\n (import \"./reader.mjs\" read-string)\n\n (defconst formatter-format \"eliscript-formatter\")\n (defconst formatter-version 1)\n (defconst formatter-width 88)\n (defconst formatter-indent 2)\n (defconst formatter-fail\n (lambda (message filename)\n (let* ((error (new (js* \"Error\") message))\n (diagnostic (js-object :format \"eliscript-diagnostic\" :version 1\n :code \"ELI-F0001\" :severity \"error\" :phase \"formatter\" :message message)))\n (when (js* \"!!filename\")\n (put diagnostic :location (js-object :file filename)))\n (put error :eliscriptDiagnostic diagnostic)\n (throw error))))\n (defconst declaration-heads\n (js-array\n \"module\" \"defasync\" \"defconst\" \"defmacro\" \"defmethod\" \"defmulti\"\n \"defn\" \"defportable\" \"defprotocol\" \"defun\" \"defvar\"\n \"extend-category\" \"extend-default\" \"extend-type\" \"export-default\"))\n (defconst operand-heads\n (js-array\n \"->\" \"->>\" \"as->\" \"case\" \"catch\" \"cond\" \"condp\" \"cond->\" \"cond->>\"\n \"if\" \"if-let\" \"if-some\"\n \"import\" \"import-portable\" \"let\" \"let*\" \"letfn\" \"loop\" \"unless\" \"when\"\n \"some->\" \"some->>\" \"when-let\" \"when-some\" \"while\"))\n\n (defun formatter-error (message filename)\n (formatter-fail message filename))\n\n (defun make-scan-state (source filename)\n (js-object :source source :filename filename :index 0))\n\n (defun peek-code (state)\n (js-call (get state :source) :charCodeAt (get state :index)))\n\n (defun peek-code-ahead (state count)\n (js-call\n (get state :source)\n :charCodeAt\n (+ (get state :index) count)))\n\n (defun at-end-p (state)\n (>= (get state :index) (get (get state :source) :length)))\n\n (defun advance (state)\n (unless (at-end-p state)\n (put state :index (1+ (get state :index)))))\n\n (defun whitespace-code-p (code)\n (or (= code 32) (= code 9) (= code 10) (= code 13) (= code 12)))\n\n (defun token-delimiter-code-p (code)\n (or (js-call globalThis.Number :isNaN code)\n (whitespace-code-p code)\n (= code 40) (= code 41)\n (= code 91) (= code 93)\n (= code 123) (= code 125)\n (= code 34) (= code 39)\n (= code 44) (= code 59) (= code 96)))\n\n (defun token (kind text)\n (js-object :kind kind :text text))\n\n (defun collection-token (text closing)\n (js-object :kind \"open\" :text text :closing closing))\n\n (defun read-string-token (state)\n (let ((start (get state :index))\n (escaped false)\n (done false))\n (advance state)\n (while (and (not done) (not (at-end-p state)))\n (let ((code (peek-code state)))\n (advance state)\n (cond\n (escaped (setq escaped false))\n ((= code 92) (setq escaped t))\n ((= code 34) (setq done t)))))\n (token\n \"string\"\n (js-call\n (get state :source)\n :slice\n start\n (get state :index)))))\n\n (defun read-comment-token (state)\n (let ((start (get state :index)))\n (while (and (not (at-end-p state))\n (not (= (peek-code state) 10))\n (not (= (peek-code state) 13)))\n (advance state))\n (token\n \"comment\"\n (js-call\n (js-call\n (get state :source)\n :slice\n start\n (get state :index))\n :replace\n (js* \"/[ \\\\t]+$/u\")\n \"\"))))\n\n (defun read-atom-token (state)\n (let ((start (get state :index)))\n (while (and (not (at-end-p state))\n (not (token-delimiter-code-p (peek-code state))))\n (advance state))\n (token\n \"atom\"\n (js-call\n (get state :source)\n :slice\n start\n (get state :index)))))\n\n (defun tokenize (source filename)\n (let ((state (make-scan-state source filename))\n (tokens (js-array)))\n (while (not (at-end-p state))\n (let ((code (peek-code state))\n next)\n (cond\n ((whitespace-code-p code)\n (advance state))\n ((= code 59)\n (js-call tokens :push (read-comment-token state)))\n ((= code 34)\n (js-call tokens :push (read-string-token state)))\n ((and (= code 35) (= (peek-code-ahead state 1) 123))\n (advance state)\n (advance state)\n (js-call tokens :push (collection-token \"#{\" \"}\")))\n ((and (= code 35) (= (peek-code-ahead state 1) 39))\n (advance state)\n (advance state)\n (js-call tokens :push (token \"prefix\" \"#'\")))\n ((= code 40)\n (advance state)\n (js-call tokens :push (collection-token \"(\" \")\")))\n ((= code 91)\n (advance state)\n (js-call tokens :push (collection-token \"[\" \"]\")))\n ((= code 123)\n (advance state)\n (js-call tokens :push (collection-token \"{\" \"}\")))\n ((or (= code 41) (= code 93) (= code 125))\n (setq next (js-call (get state :source) :charAt (get state :index)))\n (advance state)\n (js-call tokens :push (token \"close\" next)))\n ((or (= code 39) (= code 96))\n (setq next (js-call (get state :source) :charAt (get state :index)))\n (advance state)\n (js-call tokens :push (token \"prefix\" next)))\n ((= code 44)\n (advance state)\n (if (= (peek-code state) 64)\n (progn\n (advance state)\n (js-call tokens :push (token \"prefix\" \",@\")))\n (js-call tokens :push (token \"prefix\" \",\"))))\n (t\n (let ((atom (read-atom-token state)))\n (when (= (get (get atom :text) :length) 0)\n (formatter-error \"formatter tokenizer made no progress\" filename))\n (js-call tokens :push atom))))))\n tokens))\n\n (defun parse-node (tokens cursor filename)\n (when (>= (get cursor :index) (get tokens :length))\n (formatter-error \"unexpected end of formatter token stream\" filename))\n (let* ((current (js-nth (get cursor :index) tokens))\n (kind (get current :kind)))\n (put cursor :index (1+ (get cursor :index)))\n (cond\n ((or (= kind \"atom\") (= kind \"string\") (= kind \"comment\"))\n current)\n ((= kind \"prefix\")\n (let ((children (js-array)))\n (while (and (< (get cursor :index) (get tokens :length))\n (= (get (js-nth (get cursor :index) tokens) :kind)\n \"comment\"))\n (js-call children :push (js-nth (get cursor :index) tokens))\n (put cursor :index (1+ (get cursor :index))))\n (when (>= (get cursor :index) (get tokens :length))\n (formatter-error \"reader prefix has no target\" filename))\n (js-call children :push (parse-node tokens cursor filename))\n (js-object :kind \"prefix\" :text (get current :text)\n :children children)))\n ((= kind \"open\")\n (let ((children (js-array))\n (done false))\n (while (not done)\n (when (>= (get cursor :index) (get tokens :length))\n (formatter-error \"collection has no closing delimiter\" filename))\n (let ((next (js-nth (get cursor :index) tokens)))\n (if (= (get next :kind) \"close\")\n (progn\n (unless (= (get next :text) (get current :closing))\n (formatter-error \"mismatched collection delimiter\" filename))\n (put cursor :index (1+ (get cursor :index)))\n (setq done t))\n (js-call children :push (parse-node tokens cursor filename)))))\n (js-object :kind \"collection\" :text (get current :text)\n :closing (get current :closing) :children children)))\n (t\n (formatter-error \"unexpected closing delimiter\" filename)))))\n\n (defun concrete-tree (source filename)\n (let* ((tokens (tokenize source filename))\n (cursor (js-object :index 0))\n (children (js-array)))\n (while (< (get cursor :index) (get tokens :length))\n (js-call children :push (parse-node tokens cursor filename)))\n (js-object :kind \"root\" :children children)))\n\n (defun flat-node (node)\n (let ((kind (get node :kind)))\n (cond\n ((or (= kind \"atom\") (= kind \"string\"))\n (get node :text))\n ((= kind \"comment\") nil)\n ((= kind \"prefix\")\n (let ((children (get node :children)))\n (if (not (= (get children :length) 1))\n nil\n (let ((child (flat-node (js-nth 0 children))))\n (and child (str (get node :text) child))))))\n ((= kind \"collection\")\n (let ((pieces (js-array))\n (children (get node :children))\n (index 0)\n (possible t))\n (while (and possible (< index (get children :length)))\n (let ((piece (flat-node (js-nth index children))))\n (if piece\n (js-call pieces :push piece)\n (setq possible false)))\n (setq index (1+ index)))\n (and possible\n (str\n (get node :text)\n (js-call pieces :join \" \")\n (get node :closing)))))\n (t nil))))\n\n (defun spaces (count)\n (js-call \" \" :repeat count))\n\n (defun list-leading-count (node)\n (if (not (= (get node :text) \"(\"))\n 0\n (let ((children (get node :children)))\n (if (= (get children :length) 0)\n 0\n (let ((head (flat-node (js-nth 0 children))))\n (cond\n ((and head (js-call declaration-heads :includes head)) 2)\n ((and head (js-call operand-heads :includes head)) 2)\n (t 1)))))))\n\n (defun append-inline-child (output child indent)\n (let* ((piece (flat-node child))\n (separator (if (= (get output :length) 1) \"\" \" \"))\n (candidate (and piece (str output separator piece))))\n (and candidate\n (<= (+ indent (get candidate :length)) formatter-width)\n candidate)))\n\n (defun render-prefix (node indent)\n (let ((children (get node :children)))\n (if (= (get children :length) 1)\n (str\n (get node :text)\n (render-node\n (js-nth 0 children)\n (+ indent (get (get node :text) :length))))\n (let ((output (get node :text))\n (index 0))\n (while (< index (get children :length))\n (setq output\n (str output \"\\n\" (spaces (+ indent formatter-indent))\n (render-node\n (js-nth index children)\n (+ indent formatter-indent))))\n (setq index (1+ index)))\n output))))\n\n (defun render-collection (node indent)\n (let* ((flat (flat-node node))\n (children (get node :children)))\n (if (and flat (<= (+ indent (get flat :length)) formatter-width))\n flat\n (let ((output (get node :text))\n (index 0)\n (inline-left (list-leading-count node))\n (last-comment false))\n (while (and (> inline-left 0) (< index (get children :length)))\n (let ((candidate\n (append-inline-child\n output (js-nth index children) indent)))\n (if candidate\n (progn\n (setq output candidate)\n (setq index (1+ index))\n (setq inline-left (1- inline-left)))\n (setq inline-left 0))))\n (while (< index (get children :length))\n (let* ((child (js-nth index children))\n (comment (= (get child :kind) \"comment\")))\n (setq output\n (str output \"\\n\" (spaces (+ indent formatter-indent))\n (render-node child (+ indent formatter-indent))))\n (setq last-comment comment))\n (setq index (1+ index)))\n (when last-comment\n (setq output (str output \"\\n\" (spaces indent))))\n (str output (get node :closing))))))\n\n (defun render-node (node indent)\n (let ((kind (get node :kind)))\n (cond\n ((or (= kind \"atom\") (= kind \"string\") (= kind \"comment\"))\n (get node :text))\n ((= kind \"prefix\") (render-prefix node indent))\n ((= kind \"collection\") (render-collection node indent))\n (t (formatter-error \"unsupported concrete syntax node\" nil)))))\n\n (defun render-root (root)\n (let ((children (get root :children))\n (output \"\")\n (index 0)\n (seen-form false)\n (previous-comment false))\n (while (< index (get children :length))\n (let* ((child (js-nth index children))\n (comment (= (get child :kind) \"comment\")))\n (when (> (get output :length) 0)\n (setq output\n (str output\n (if (and seen-form (not previous-comment) (not comment))\n \"\\n\\n\"\n \"\\n\"))))\n (setq output (str output (render-node child 0)))\n (unless comment (setq seen-form t))\n (setq previous-comment comment))\n (setq index (1+ index)))\n (if (= (get output :length) 0) \"\" (str output \"\\n\"))))\n\n (defun format-source (source filename)\n (unless (= (js* \"typeof source\") \"string\")\n (formatter-error \"formatter source must be a string\" filename))\n (read-string source filename)\n (let ((formatted (render-root (concrete-tree source filename))))\n (read-string formatted filename)\n formatted))\n\n (export\n formatter-format\n formatter-version\n formatter-width\n formatter-indent\n format-source))\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACE,QAAuB;AAEvB,yBAA2B;;AAC3B,0BAA4B;;AAC5B,wBAA0B;;AAC1B,yBAA2B;;AAC3B,uBACE,EAAS,SAAQ;EACf;gCAAc,KAAK,OAAc;;UAA1B;;oCACY,EAAW,UAAQ,wBAAuB,WAAS,GAC7D,QAAM,aAAY,YAAU,SAAQ,SAAO,aAAY,WAAS;;cADlE;UAEL,IAAM;YACJ,EAAK,YAAW,cAAU,EAAW,QAAM;;UAC7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BAAsB,QAAO;EAC3B,MAAQ,CAAG,kBAAsB;IAC9B,gBAAgB,qCAAoC;;EACtD,YAAY,QAAO;EACpB;iCAAkB,YAAa,cAAc,QAAO;;UAA9C;MACH,YAAY,WAAU;MACvB,OAAA;;;;AAEJ,QACE,kBACA,mBACA,iBACA,kBACA"}
1
+ {"version":3,"file":"bootstrap/formatter.mjs","sources":["bootstrap/compiler/formatter.eli"],"sourcesContent":["(module bootstrap.compiler.formatter\n (import \"./reader.mjs\" read-string)\n\n (defconst formatter-format \"eliscript-formatter\")\n (defconst formatter-version 1)\n (defconst formatter-width 88)\n (defconst formatter-indent 2)\n (defconst formatter-fail\n (lambda (message filename)\n (let* ((error (new (js* \"Error\") message))\n (diagnostic (js-object :format \"eliscript-diagnostic\" :version 1\n :code \"ELI-F0001\" :severity \"error\" :phase \"formatter\" :message message)))\n (when (js* \"!!filename\")\n (put diagnostic :location (js-object :file filename)))\n (put error :eliscriptDiagnostic diagnostic)\n (throw error))))\n (defconst declaration-heads\n (js-array\n \"module\" \"defasync\" \"defconst\" \"defmacro\" \"defmethod\" \"defmulti\"\n \"defn\" \"defportable\" \"defprotocol\" \"defun\" \"defvar\"\n \"extend-category\" \"extend-default\" \"extend-type\" \"export-default\"))\n (defconst operand-heads\n (js-array\n \"->\" \"->>\" \"as->\" \"case\" \"catch\" \"cond\" \"condp\" \"cond->\" \"cond->>\"\n \"if\" \"if-let\" \"if-some\"\n \"import\" \"import-portable\" \"let\" \"let*\" \"letfn\" \"loop\" \"unless\" \"when\"\n \"some->\" \"some->>\" \"when-let\" \"when-some\" \"while\"))\n\n (defun formatter-error (message filename)\n (formatter-fail message filename))\n\n (defun make-scan-state (source filename)\n (js-object :source source :filename filename :index 0))\n\n (defun peek-code (state)\n (js-call (get state :source) :charCodeAt (get state :index)))\n\n (defun peek-code-ahead (state count)\n (js-call\n (get state :source)\n :charCodeAt\n (+ (get state :index) count)))\n\n (defun at-end-p (state)\n (>= (get state :index) (get (get state :source) :length)))\n\n (defun advance (state)\n (unless (at-end-p state)\n (put state :index (1+ (get state :index)))))\n\n (defun whitespace-code-p (code)\n (or (= code 32) (= code 9) (= code 10) (= code 13) (= code 12)))\n\n (defun token-delimiter-code-p (code)\n (or (js-call globalThis.Number :isNaN code)\n (whitespace-code-p code)\n (= code 40) (= code 41)\n (= code 91) (= code 93)\n (= code 123) (= code 125)\n (= code 34) (= code 39)\n (= code 44) (= code 59) (= code 96)))\n\n (defun token (kind text)\n (js-object :kind kind :text text))\n\n (defun collection-token (text closing)\n (js-object :kind \"open\" :text text :closing closing))\n\n (defun read-string-token (state)\n (let ((start (get state :index))\n (escaped false)\n (done false))\n (advance state)\n (while (and (not done) (not (at-end-p state)))\n (let ((code (peek-code state)))\n (advance state)\n (cond\n (escaped (setq escaped false))\n ((= code 92) (setq escaped t))\n ((= code 34) (setq done t)))))\n (token\n \"string\"\n (js-call\n (get state :source)\n :slice\n start\n (get state :index)))))\n\n (defun read-comment-token (state)\n (let ((start (get state :index)))\n (while (and (not (at-end-p state))\n (not (= (peek-code state) 10))\n (not (= (peek-code state) 13)))\n (advance state))\n (token\n \"comment\"\n (js-call\n (js-call\n (get state :source)\n :slice\n start\n (get state :index))\n :replace\n (js* \"/[ \\\\t]+$/u\")\n \"\"))))\n\n (defun read-atom-token (state)\n (let ((start (get state :index)))\n (while (and (not (at-end-p state))\n (not (token-delimiter-code-p (peek-code state))))\n (advance state))\n (token\n \"atom\"\n (js-call\n (get state :source)\n :slice\n start\n (get state :index)))))\n\n (defun tokenize (source filename)\n (let ((state (make-scan-state source filename))\n (tokens (js-array)))\n (while (not (at-end-p state))\n (let ((code (peek-code state))\n next)\n (cond\n ((whitespace-code-p code)\n (advance state))\n ((= code 59)\n (js-call tokens :push (read-comment-token state)))\n ((= code 34)\n (js-call tokens :push (read-string-token state)))\n ((and (= code 35) (= (peek-code-ahead state 1) 123))\n (advance state)\n (advance state)\n (js-call tokens :push (collection-token \"#{\" \"}\")))\n ((and (= code 35) (= (peek-code-ahead state 1) 39))\n (advance state)\n (advance state)\n (js-call tokens :push (token \"prefix\" \"#'\")))\n ((= code 40)\n (advance state)\n (js-call tokens :push (collection-token \"(\" \")\")))\n ((= code 91)\n (advance state)\n (js-call tokens :push (collection-token \"[\" \"]\")))\n ((= code 123)\n (advance state)\n (js-call tokens :push (collection-token \"{\" \"}\")))\n ((or (= code 41) (= code 93) (= code 125))\n (setq next (js-call (get state :source) :charAt (get state :index)))\n (advance state)\n (js-call tokens :push (token \"close\" next)))\n ((or (= code 39) (= code 96))\n (setq next (js-call (get state :source) :charAt (get state :index)))\n (advance state)\n (js-call tokens :push (token \"prefix\" next)))\n ((= code 44)\n (advance state)\n (if (= (peek-code state) 64)\n (progn\n (advance state)\n (js-call tokens :push (token \"prefix\" \",@\")))\n (js-call tokens :push (token \"prefix\" \",\"))))\n (t\n (let ((atom (read-atom-token state)))\n (when (= (get (get atom :text) :length) 0)\n (formatter-error \"formatter tokenizer made no progress\" filename))\n (js-call tokens :push atom))))))\n tokens))\n\n (defun parse-node (tokens cursor filename)\n (when (>= (get cursor :index) (get tokens :length))\n (formatter-error \"unexpected end of formatter token stream\" filename))\n (let* ((current (js-nth (get cursor :index) tokens))\n (kind (get current :kind)))\n (put cursor :index (1+ (get cursor :index)))\n (cond\n ((or (= kind \"atom\") (= kind \"string\") (= kind \"comment\"))\n current)\n ((= kind \"prefix\")\n (let ((children (js-array)))\n (while (and (< (get cursor :index) (get tokens :length))\n (= (get (js-nth (get cursor :index) tokens) :kind)\n \"comment\"))\n (js-call children :push (js-nth (get cursor :index) tokens))\n (put cursor :index (1+ (get cursor :index))))\n (when (>= (get cursor :index) (get tokens :length))\n (formatter-error \"reader prefix has no target\" filename))\n (js-call children :push (parse-node tokens cursor filename))\n (js-object :kind \"prefix\" :text (get current :text)\n :children children)))\n ((= kind \"open\")\n (let ((children (js-array))\n (done false))\n (while (not done)\n (when (>= (get cursor :index) (get tokens :length))\n (formatter-error \"collection has no closing delimiter\" filename))\n (let ((next (js-nth (get cursor :index) tokens)))\n (if (= (get next :kind) \"close\")\n (progn\n (unless (= (get next :text) (get current :closing))\n (formatter-error \"mismatched collection delimiter\" filename))\n (put cursor :index (1+ (get cursor :index)))\n (setq done t))\n (js-call children :push (parse-node tokens cursor filename)))))\n (js-object :kind \"collection\" :text (get current :text)\n :closing (get current :closing) :children children)))\n (t\n (formatter-error \"unexpected closing delimiter\" filename)))))\n\n (defun concrete-tree (source filename)\n (let* ((tokens (tokenize source filename))\n (cursor (js-object :index 0))\n (children (js-array)))\n (while (< (get cursor :index) (get tokens :length))\n (js-call children :push (parse-node tokens cursor filename)))\n (js-object :kind \"root\" :children children)))\n\n (defun flat-node (node)\n (let ((kind (get node :kind)))\n (cond\n ((or (= kind \"atom\") (= kind \"string\"))\n (get node :text))\n ((= kind \"comment\") nil)\n ((= kind \"prefix\")\n (let ((children (get node :children)))\n (if (not (= (get children :length) 1))\n nil\n (let ((child (flat-node (js-nth 0 children))))\n (and child (str (get node :text) child))))))\n ((= kind \"collection\")\n (let ((pieces (js-array))\n (children (get node :children))\n (index 0)\n (possible t))\n (while (and possible (< index (get children :length)))\n (let ((piece (flat-node (js-nth index children))))\n (if piece\n (js-call pieces :push piece)\n (setq possible false)))\n (setq index (1+ index)))\n (and possible\n (str\n (get node :text)\n (js-call pieces :join \" \")\n (get node :closing)))))\n (t nil))))\n\n (defun spaces (count)\n (js-call \" \" :repeat count))\n\n (defun list-leading-count (node)\n (if (not (= (get node :text) \"(\"))\n 0\n (let ((children (get node :children)))\n (if (= (get children :length) 0)\n 0\n (let ((head (flat-node (js-nth 0 children))))\n (cond\n ((and head (js-call declaration-heads :includes head)) 2)\n ((and head (js-call operand-heads :includes head)) 2)\n (t 1)))))))\n\n (defun append-inline-child (output child indent)\n (let* ((piece (flat-node child))\n (separator (if (= (get output :length) 1) \"\" \" \"))\n (candidate (and piece (str output separator piece))))\n (and candidate\n (<= (+ indent (get candidate :length)) formatter-width)\n candidate)))\n\n (defun render-prefix (node indent)\n (let ((children (get node :children)))\n (if (= (get children :length) 1)\n (str\n (get node :text)\n (render-node\n (js-nth 0 children)\n (+ indent (get (get node :text) :length))))\n (let ((output (get node :text))\n (index 0))\n (while (< index (get children :length))\n (setq output\n (str output \"\\n\" (spaces (+ indent formatter-indent))\n (render-node\n (js-nth index children)\n (+ indent formatter-indent))))\n (setq index (1+ index)))\n output))))\n\n (defun render-collection (node indent)\n (let* ((flat (flat-node node))\n (children (get node :children)))\n (if (and flat (<= (+ indent (get flat :length)) formatter-width))\n flat\n (let ((output (get node :text))\n (index 0)\n (inline-left (list-leading-count node))\n (last-comment false))\n (while (and (> inline-left 0) (< index (get children :length)))\n (let ((candidate\n (append-inline-child\n output (js-nth index children) indent)))\n (if candidate\n (progn\n (setq output candidate)\n (setq index (1+ index))\n (setq inline-left (1- inline-left)))\n (setq inline-left 0))))\n (while (< index (get children :length))\n (let* ((child (js-nth index children))\n (comment (= (get child :kind) \"comment\")))\n (setq output\n (str output \"\\n\" (spaces (+ indent formatter-indent))\n (render-node child (+ indent formatter-indent))))\n (setq last-comment comment))\n (setq index (1+ index)))\n (when last-comment\n (setq output (str output \"\\n\" (spaces indent))))\n (str output (get node :closing))))))\n\n (defun render-node (node indent)\n (let ((kind (get node :kind)))\n (cond\n ((or (= kind \"atom\") (= kind \"string\") (= kind \"comment\"))\n (get node :text))\n ((= kind \"prefix\") (render-prefix node indent))\n ((= kind \"collection\") (render-collection node indent))\n (t (formatter-error \"unsupported concrete syntax node\" nil)))))\n\n (defun render-root (root)\n (let ((children (get root :children))\n (output \"\")\n (index 0)\n (seen-form false)\n (previous-comment false))\n (while (< index (get children :length))\n (let* ((child (js-nth index children))\n (comment (= (get child :kind) \"comment\")))\n (when (> (get output :length) 0)\n (setq output\n (str output\n (if (and seen-form (not previous-comment) (not comment))\n \"\\n\\n\"\n \"\\n\"))))\n (setq output (str output (render-node child 0)))\n (unless comment (setq seen-form t))\n (setq previous-comment comment))\n (setq index (1+ index)))\n (if (= (get output :length) 0) \"\" (str output \"\\n\"))))\n\n (defun format-source (source filename)\n (unless (= (js* \"typeof source\") \"string\")\n (formatter-error \"formatter source must be a string\" filename))\n (read-string source filename)\n (let ((formatted (render-root (concrete-tree source filename))))\n (read-string formatted filename)\n formatted))\n\n (export\n formatter-format\n formatter-version\n formatter-width\n formatter-indent\n format-source))\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACE,QAAuB;AAEvB,yBAA2B;AAC3B,0BAA4B;AAC5B,wBAA0B;;AAC1B,yBAA2B;;AAC3B,uBACE,EAAS,SAAQ;EACf;gCAAc,KAAK,OAAc;;UAA1B;;oCACY,EAAW,UAAQ,wBAAuB,WAAS,GAC7D,QAAM,aAAY,YAAU,SAAQ,SAAO,aAAY,WAAS;;cADlE;UAEL,IAAM;YACJ,EAAK,YAAW,cAAU,EAAW,QAAM;;UAC7C,EAAK,OAAM,yBAAqB;UAChC,OAAA,0DAAO;;;;;;;AACb,0BACE,CACE,UAAS,YAAW,YAAW,YAAW,aAAY,YACtD,QAAO,eAAc,eAAc,SAAQ,UAC3C,mBAAkB,kBAAiB,eAAc;;AACrD,sBACE,CACE,MAAK,OAAM,QAAO,QAAO,SAAQ,QAAO,SAAQ,UAAS,WACzD,MAAK,UAAS,WACd,UAAS,mBAAkB,OAAM,QAAO,SAAQ,QAAO,UAAS,QAChE,UAAS,WAAU,YAAW,aAAY;;AAE9C,yBAAwB,SAAQ;EAC9B,OAAC,2BAAe,SAAQ;;AAE1B,yBAAwB,QAAO;EAC7B,OAAA,EAAW,UAAQ,QAAO,YAAU,UAAS,SAAO;;AAEtD,mBAAkB;EAChB,OAAA,CAAS,CAAK,OAAM,WAAS,cAAY,CAAK,OAAM;;AAEtD,yBAAwB,OAAM;EAC5B,OAAA,CACE,CAAK,OAAM,WACX,cACA,CAAG,CAAK,OAAM,WAAQ;;AAE1B,kBAAiB;EACf,OAAA,mCAAI,CAAK,OAAM,UAAQ,CAAK,CAAK,OAAM,WAAS;;AAElD,iBAAgB;EACd,yB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ACZ;iCACD;iCACI;iCACO;;UAJlB;UACA;UACA;UACA;UACA;MACJ,OAAO,kCAAG,OAAM,CAAK,UAAS;QAC5B;cAAO,QAAO,IAAc,iBAAN;cACf,UAAS,CAAG,CAAK,OAAM,YAAO;UACnC,IAAM,kCAAG,CAAK,QAAO,WAAS;YAC5B,CAAM,CAAA,SACJ,QAAK,iBACA,oBAAI,wEAAe,qBAAK,sBAAkB,qBAAK,oCAAtC,cACL,SACF;;UACX,CAAM,CAAA,SAAO,QAAK,iBAAQ,YAAY,OAAM;UAC5C,yBAAQ;YAAQ,CAAM,CAAA,YAAU;;UAChC,CAAM,CAAA,mBAAiB;;QACzB,CAAM,CAAA,QAAM,CAAI;;MAClB,IAAI,CAAG,CAAK,QAAO,cAAS;QAAG,OAAA;;QAAG,OAAA,QAAK,iBAAO;;;;;AAElD,uBAAsB,QAAO;EAC3B,MAAQ,CAAG,kBAAsB;IAC9B,gBAAgB,qCAAoC;;EACtD,YAAY,QAAO;EACpB;iCAAkB,YAAa,cAAc,QAAO;;UAA9C;MACH,YAAY,WAAU;MACvB,OAAA;;;;AAEJ,QACE,kBACA,mBACA,iBACA,kBACA"}
@@ -1,203 +1,50 @@
1
1
  // Generated by Eliscript. Do not edit.
2
2
  import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
3
- var __eliscript_tdz_ready_0;
4
- function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("ir_format"); return ir_format; }
5
- function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("ir_format"); return __eliscript_const_error(); }
6
- var __eliscript_tdz_ready_1;
7
- function __eliscript_tdz_read_1() { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("ir_version"); return ir_version; }
8
- function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("ir_version"); return __eliscript_const_error(); }
9
- var __eliscript_tdz_ready_2;
10
- function __eliscript_tdz_read_2() { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("ir_max_depth"); return ir_max_depth; }
11
- function __eliscript_tdz_write_2(__eliscript_tdz_value_2) { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("ir_max_depth"); return __eliscript_const_error(); }
12
- var __eliscript_tdz_ready_3;
13
- function __eliscript_tdz_read_3() { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("node_kinds"); return node_kinds; }
14
- function __eliscript_tdz_write_3(__eliscript_tdz_value_3) { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("node_kinds"); return __eliscript_const_error(); }
15
- var __eliscript_tdz_ready_4;
16
- function __eliscript_tdz_read_4() { if (__eliscript_tdz_ready_4 !== true) __eliscript_tdz_error("ir_filename_key"); return ir_filename_key; }
17
- function __eliscript_tdz_write_4(__eliscript_tdz_value_4) { if (__eliscript_tdz_ready_4 !== true) __eliscript_tdz_error("ir_filename_key"); return __eliscript_const_error(); }
18
- var __eliscript_tdz_ready_5;
19
- function __eliscript_tdz_read_5() { if (__eliscript_tdz_ready_5 !== true) __eliscript_tdz_error("ir_body_key"); return ir_body_key; }
20
- function __eliscript_tdz_write_5(__eliscript_tdz_value_5) { if (__eliscript_tdz_ready_5 !== true) __eliscript_tdz_error("ir_body_key"); return __eliscript_const_error(); }
21
- var __eliscript_tdz_ready_6;
22
- function __eliscript_tdz_read_6() { if (__eliscript_tdz_ready_6 !== true) __eliscript_tdz_error("ir_kind_key"); return ir_kind_key; }
23
- function __eliscript_tdz_write_6(__eliscript_tdz_value_6) { if (__eliscript_tdz_ready_6 !== true) __eliscript_tdz_error("ir_kind_key"); return __eliscript_const_error(); }
24
- var __eliscript_tdz_ready_7;
25
- function __eliscript_tdz_read_7() { if (__eliscript_tdz_ready_7 !== true) __eliscript_tdz_error("ir_span_key"); return ir_span_key; }
26
- function __eliscript_tdz_write_7(__eliscript_tdz_value_7) { if (__eliscript_tdz_ready_7 !== true) __eliscript_tdz_error("ir_span_key"); return __eliscript_const_error(); }
27
- var __eliscript_tdz_ready_8;
28
- function __eliscript_tdz_read_8() { if (__eliscript_tdz_ready_8 !== true) __eliscript_tdz_error("ir_value_key"); return ir_value_key; }
29
- function __eliscript_tdz_write_8(__eliscript_tdz_value_8) { if (__eliscript_tdz_ready_8 !== true) __eliscript_tdz_error("ir_value_key"); return __eliscript_const_error(); }
30
- var __eliscript_tdz_ready_9;
31
- function __eliscript_tdz_read_9() { if (__eliscript_tdz_ready_9 !== true) __eliscript_tdz_error("ir_children_key"); return ir_children_key; }
32
- function __eliscript_tdz_write_9(__eliscript_tdz_value_9) { if (__eliscript_tdz_ready_9 !== true) __eliscript_tdz_error("ir_children_key"); return __eliscript_const_error(); }
33
- var __eliscript_tdz_ready_10;
34
- function __eliscript_tdz_read_10() { if (__eliscript_tdz_ready_10 !== true) __eliscript_tdz_error("ir_properties_key"); return ir_properties_key; }
35
- function __eliscript_tdz_write_10(__eliscript_tdz_value_10) { if (__eliscript_tdz_ready_10 !== true) __eliscript_tdz_error("ir_properties_key"); return __eliscript_const_error(); }
36
- var __eliscript_tdz_ready_11;
37
- function __eliscript_tdz_read_11() { if (__eliscript_tdz_ready_11 !== true) __eliscript_tdz_error("canonical_node_kinds"); return canonical_node_kinds; }
38
- function __eliscript_tdz_write_11(__eliscript_tdz_value_11) { if (__eliscript_tdz_ready_11 !== true) __eliscript_tdz_error("canonical_node_kinds"); return __eliscript_const_error(); }
39
3
  var __eliscript_tdz_ready_12;
40
4
  function __eliscript_tdz_read_12() { if (__eliscript_tdz_ready_12 !== true) __eliscript_tdz_error("fail"); return fail; }
41
- function __eliscript_tdz_write_12(__eliscript_tdz_value_12) { if (__eliscript_tdz_ready_12 !== true) __eliscript_tdz_error("fail"); return __eliscript_const_error(); }
42
- var __eliscript_tdz_ready_13;
43
- function __eliscript_tdz_read_13() { if (__eliscript_tdz_ready_13 !== true) __eliscript_tdz_error("make_schema_error"); return make_schema_error; }
44
- function __eliscript_tdz_write_13(__eliscript_tdz_value_13) { if (__eliscript_tdz_ready_13 !== true) __eliscript_tdz_error("make_schema_error"); return __eliscript_const_error(); }
45
5
  var __eliscript_tdz_ready_14;
46
6
  function __eliscript_tdz_read_14() { if (__eliscript_tdz_ready_14 !== true) __eliscript_tdz_error("schema_fail"); return schema_fail; }
47
- function __eliscript_tdz_write_14(__eliscript_tdz_value_14) { if (__eliscript_tdz_ready_14 !== true) __eliscript_tdz_error("schema_fail"); return __eliscript_const_error(); }
48
7
  var __eliscript_tdz_ready_15;
49
8
  function __eliscript_tdz_read_15() { if (__eliscript_tdz_ready_15 !== true) __eliscript_tdz_error("array_p"); return array_p; }
50
- function __eliscript_tdz_write_15(__eliscript_tdz_value_15) { if (__eliscript_tdz_ready_15 !== true) __eliscript_tdz_error("array_p"); return __eliscript_const_error(); }
51
9
  var __eliscript_tdz_ready_16;
52
10
  function __eliscript_tdz_read_16() { if (__eliscript_tdz_ready_16 !== true) __eliscript_tdz_error("dense_json_array_p"); return dense_json_array_p; }
53
- function __eliscript_tdz_write_16(__eliscript_tdz_value_16) { if (__eliscript_tdz_ready_16 !== true) __eliscript_tdz_error("dense_json_array_p"); return __eliscript_const_error(); }
54
11
  var __eliscript_tdz_ready_17;
55
12
  function __eliscript_tdz_read_17() { if (__eliscript_tdz_ready_17 !== true) __eliscript_tdz_error("plain_record_keys"); return plain_record_keys; }
56
- function __eliscript_tdz_write_17(__eliscript_tdz_value_17) { if (__eliscript_tdz_ready_17 !== true) __eliscript_tdz_error("plain_record_keys"); return __eliscript_const_error(); }
57
13
  var __eliscript_tdz_ready_18;
58
14
  function __eliscript_tdz_read_18() { if (__eliscript_tdz_ready_18 !== true) __eliscript_tdz_error("has_own"); return has_own; }
59
- function __eliscript_tdz_write_18(__eliscript_tdz_value_18) { if (__eliscript_tdz_ready_18 !== true) __eliscript_tdz_error("has_own"); return __eliscript_const_error(); }
60
15
  var __eliscript_tdz_ready_19;
61
16
  function __eliscript_tdz_read_19() { if (__eliscript_tdz_ready_19 !== true) __eliscript_tdz_error("finite_number_p"); return finite_number_p; }
62
- function __eliscript_tdz_write_19(__eliscript_tdz_value_19) { if (__eliscript_tdz_ready_19 !== true) __eliscript_tdz_error("finite_number_p"); return __eliscript_const_error(); }
63
17
  var __eliscript_tdz_ready_20;
64
18
  function __eliscript_tdz_read_20() { if (__eliscript_tdz_ready_20 !== true) __eliscript_tdz_error("non_negative_integer_p"); return non_negative_integer_p; }
65
- function __eliscript_tdz_write_20(__eliscript_tdz_value_20) { if (__eliscript_tdz_ready_20 !== true) __eliscript_tdz_error("non_negative_integer_p"); return __eliscript_const_error(); }
66
19
  var __eliscript_tdz_ready_21;
67
20
  function __eliscript_tdz_read_21() { if (__eliscript_tdz_ready_21 !== true) __eliscript_tdz_error("positive_integer_p"); return positive_integer_p; }
68
- function __eliscript_tdz_write_21(__eliscript_tdz_value_21) { if (__eliscript_tdz_ready_21 !== true) __eliscript_tdz_error("positive_integer_p"); return __eliscript_const_error(); }
69
21
  var __eliscript_tdz_ready_22;
70
22
  function __eliscript_tdz_read_22() { if (__eliscript_tdz_ready_22 !== true) __eliscript_tdz_error("parse_json"); return parse_json; }
71
- function __eliscript_tdz_write_22(__eliscript_tdz_value_22) { if (__eliscript_tdz_ready_22 !== true) __eliscript_tdz_error("parse_json"); return __eliscript_const_error(); }
72
23
  var __eliscript_tdz_ready_23;
73
24
  function __eliscript_tdz_read_23() { if (__eliscript_tdz_ready_23 !== true) __eliscript_tdz_error("node_kind_set"); return node_kind_set; }
74
- function __eliscript_tdz_write_23(__eliscript_tdz_value_23) { if (__eliscript_tdz_ready_23 !== true) __eliscript_tdz_error("node_kind_set"); return __eliscript_const_error(); }
75
25
  var __eliscript_tdz_ready_24;
76
26
  function __eliscript_tdz_read_24() { if (__eliscript_tdz_ready_24 !== true) __eliscript_tdz_error("canonical_json_array_join"); return canonical_json_array_join; }
77
- function __eliscript_tdz_write_24(__eliscript_tdz_value_24) { if (__eliscript_tdz_ready_24 !== true) __eliscript_tdz_error("canonical_json_array_join"); return __eliscript_const_error(); }
78
27
  import "eliscript/runtime/unicode-case.mjs";
79
- import { c as __eliscript_at, d as __eliscript_at_direct } from "data:text/javascript;base64,dmFyIG09UmVmbGVjdC5hcHBseSx0dD1OdW1iZXIucHJvdG90eXBlLnZhbHVlT2Ysaj1OdW1iZXIucHJvdG90eXBlLnRvU3RyaW5nLFU9TnVtYmVyLG50PU9iamVjdC5jcmVhdGUsaD1CaWdJbnQsZXQ9RGF0YVZpZXcsb3Q9QXJyYXlCdWZmZXIsaXQ9RGF0YVZpZXcucHJvdG90eXBlLnNldEZsb2F0NjQsSj1EYXRhVmlldy5wcm90b3R5cGUuZ2V0VWludDMyLHJ0PVJhbmdlRXJyb3I7ZnVuY3Rpb24gY3QodCxuKXtsZXQgZT1oKG4pLG89aCh0KSxpPSIiO2lmKG88MG4pbz0tbztkb3tsZXQgZj1vJWU7aT0iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltVKGYpXStpLG8vPWV9d2hpbGUobyE9PTBuKTtyZXR1cm4gdDwwPyItIitpOml9ZnVuY3Rpb24gc3QodCxuKXtsZXQgZT1uZXcgZXQobmV3IG90KDgpKTttKGl0LGUsWzAsdCwhMV0pO2xldCBvPW0oSixlLFswLCExXSksaT1tKEosZSxbNCwhMV0pLGY9bz4+PjIwJ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dCBhcyBkfTs=";
28
+ import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
80
29
  const __eliscript_truthy = (value) => value !== false && value != null;
81
- const __eliscript_number_intrinsic = globalThis.Number;
82
- const __eliscript_bigint_intrinsic = globalThis.BigInt;
83
- const __eliscript_numeric_apply = globalThis.Reflect.apply;
84
- const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
85
- const __eliscript_numeric_error = globalThis.TypeError;
86
- const __eliscript_numeric_trim = globalThis.String.prototype.trim;
87
- const __eliscript_numeric_slice = globalThis.String.prototype.slice;
88
- const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
89
- const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
90
- const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
91
- const __eliscript_numeric_primitive = (value) => {
92
- if (!__eliscript_numeric_object(value)) return value;
93
- const exotic = value[__eliscript_numeric_symbol];
94
- if (exotic !== void 0 && exotic !== null) {
95
- const result = __eliscript_numeric_apply(exotic, value, ["number"]);
96
- if (!__eliscript_numeric_object(result)) return result;
97
- throw new __eliscript_numeric_error("Cannot convert object to primitive value");
98
- }
99
- for (let index = 0; index < 2; index++) {
100
- const method = value[index === 0 ? "valueOf" : "toString"];
101
- if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
102
- const result = __eliscript_numeric_apply(method, value, []);
103
- if (!__eliscript_numeric_object(result)) return result;
104
- }
105
- }
106
- throw new __eliscript_numeric_error("Cannot convert object to primitive value");
107
- };
108
- const __eliscript_to_number = (value) => {
109
- const primitive = __eliscript_numeric_primitive(value);
110
- if (typeof primitive === "string") {
111
- const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
112
- if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
113
- let first = 2;
114
- while (first < text.length && text[first] === "0") first++;
115
- if (first === text.length) return 0;
116
- const prefix = text[1];
117
- const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
118
- if (text.length - first > limit) return 1 / 0;
119
- const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
120
- return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
121
- }
122
- }
123
- return __eliscript_number_intrinsic(primitive);
124
- };
125
- const __eliscript_numeric = (value) => {
126
- if (typeof value === "number" || typeof value === "bigint") return value;
127
- const primitive = __eliscript_numeric_primitive(value);
128
- if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
129
- return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
130
- };
131
- const __eliscript_implicit_number = (value) => {
132
- if (typeof value === "number") return value;
133
- const primitive = __eliscript_numeric_primitive(value);
134
- if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
135
- return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
136
- };
137
- const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
138
- const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
139
- const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
140
- const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
141
- const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
142
- const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
143
- const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
144
- const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
145
- const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
146
- const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
147
- const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
148
- const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
149
- const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
150
- const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
151
- const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
152
- const __eliscript_numeric_relation = (operator, left, right) => {
153
- if (typeof left === "number" && typeof right === "number") {
154
- if (operator === "<") return left < right;
155
- if (operator === "<=") return left <= right;
156
- if (operator === ">") return left > right;
157
- return left >= right;
158
- }
159
- let a = __eliscript_numeric_primitive(left);
160
- let b = __eliscript_numeric_primitive(right);
161
- const x = typeof a, y = typeof b;
162
- if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
163
- a = __eliscript_numeric(a);
164
- b = __eliscript_numeric(b);
165
- }
166
- if (operator === "<") return a < b;
167
- if (operator === "<=") return a <= b;
168
- if (operator === ">") return a > b;
169
- return a >= b;
170
- };
171
30
 
172
31
  const ir_format = "eliscript-ir";
173
- __eliscript_tdz_ready_0 = true;
174
32
  const ir_version = 1;
175
- __eliscript_tdz_ready_1 = true;
176
33
  const ir_max_depth = 512;
177
- __eliscript_tdz_ready_2 = true;
178
34
  const node_kinds = (globalThis.Object)["freeze"](["module-declaration", "import-declaration", "import-default", "import-namespace", "import-named", "variable-declaration", "function-declaration", "export-declaration", "export-default", "expression-statement", "parameter-binding", "array-binding-pattern", "map-binding-pattern", "map-binding-entry", "binding-name", "binding-hole", "reference", "literal", "array-literal", "persistent-list-literal", "persistent-vector-literal", "persistent-map-literal", "persistent-set-literal", "persistent-queue-literal", "quoted-literal", "function-expression", "await-expression", "throw-expression", "try-expression", "catch-clause", "catch-binding", "finally-clause", "conditional", "conditional-sugar", "conditional-chain", "conditional-clause", "sequence", "lexical-bindings", "lexical-binding", "assignment", "assignment-pair", "loop", "binding-loop", "recur", "short-circuit", "intrinsic", "object-literal", "object-property", "property-read", "property-write", "method-call", "constructor-call", "raw-javascript", "print", "string-concat", "invoke", "apply-call", "call"]);
179
- __eliscript_tdz_ready_3 = true;
180
35
  const ir_filename_key = "filename";
181
- __eliscript_tdz_ready_4 = true;
182
36
  const ir_body_key = "body";
183
- __eliscript_tdz_ready_5 = true;
184
37
  const ir_kind_key = "kind";
185
- __eliscript_tdz_ready_6 = true;
186
38
  const ir_span_key = "span";
187
- __eliscript_tdz_ready_7 = true;
188
39
  const ir_value_key = "value";
189
- __eliscript_tdz_ready_8 = true;
190
40
  const ir_children_key = "children";
191
- __eliscript_tdz_ready_9 = true;
192
41
  const ir_properties_key = "properties";
193
- __eliscript_tdz_ready_10 = true;
194
42
  const canonical_node_kinds = ((kinds) => {
195
- ((__eliscript_tdz_read_3()))["forEach"](((kind) => {
43
+ (node_kinds)["forEach"](((kind) => {
196
44
  return (kinds)["set"](kind, kind);
197
45
  }));
198
46
  return kinds;
199
47
  })(new (globalThis.Map)());
200
- __eliscript_tdz_ready_11 = true;
201
48
  const fail = ((message) => {
202
49
  return ((__eliscript_value_1) => { throw __eliscript_value_1; })(new (Error)(message));
203
50
  });
@@ -212,9 +59,8 @@ const make_schema_error = ((message, options) => {
212
59
  }
213
60
  }
214
61
  });
215
- __eliscript_tdz_ready_13 = true;
216
62
  const schema_fail = ((message) => {
217
- return ((__eliscript_value_3) => { throw __eliscript_value_3; })((__eliscript_tdz_read_13())(message, undefined));
63
+ return ((__eliscript_value_3) => { throw __eliscript_value_3; })(make_schema_error(message, undefined));
218
64
  });
219
65
  __eliscript_tdz_ready_14 = true;
220
66
  const array_p = Array.isArray;
@@ -336,8 +182,8 @@ const parse_json = ((source, reject) => {
336
182
  const __eliscript_value_36 = "invalid canonical IR JSON";
337
183
  {
338
184
  let message = __eliscript_value_36;
339
- if (__eliscript_truthy(Object.is(reject, (__eliscript_tdz_read_14())))) {
340
- return ((__eliscript_value_37) => { throw __eliscript_value_37; })((__eliscript_tdz_read_13())(message, ({"cause": error})));
185
+ if (__eliscript_truthy(Object.is(reject, schema_fail))) {
186
+ return ((__eliscript_value_37) => { throw __eliscript_value_37; })(make_schema_error(message, ({"cause": error})));
341
187
  } else {
342
188
  return reject(message);
343
189
  }
@@ -347,7 +193,7 @@ const parse_json = ((source, reject) => {
347
193
  })();
348
194
  });
349
195
  __eliscript_tdz_ready_22 = true;
350
- const node_kind_set = new (globalThis.Set)((__eliscript_tdz_read_3()));
196
+ const node_kind_set = new (globalThis.Set)(node_kinds);
351
197
  __eliscript_tdz_ready_23 = true;
352
198
  function require_closed_record(value, expected, label) {
353
199
  {
@@ -483,8 +329,8 @@ function canonical_json_record(value, path, active, depth, collect_output = null
483
329
  }
484
330
  }
485
331
  function canonical_json_value(value, path, active, depth, collect_output = null, sink = null) {
486
- if (__eliscript_numeric_relation(">", depth, (__eliscript_tdz_read_2()))) {
487
- (__eliscript_tdz_read_14())((String(path) + String(" exceeds IR nesting depth ") + String((__eliscript_tdz_read_2()))));
332
+ if (__eliscript_numeric_relation(">", depth, ir_max_depth)) {
333
+ (__eliscript_tdz_read_14())((String(path) + String(" exceeds IR nesting depth ") + String(ir_max_depth)));
488
334
  }
489
335
  {
490
336
  const __eliscript_value_46 = typeof value;
@@ -566,8 +412,8 @@ function validate_span(span) {
566
412
  return span;
567
413
  }
568
414
  function validate_node(node, active, depth) {
569
- if (__eliscript_numeric_relation(">", depth, (__eliscript_tdz_read_2()))) {
570
- (__eliscript_tdz_read_14())((String("IR node exceeds nesting depth ") + String((__eliscript_tdz_read_2()))));
415
+ if (__eliscript_numeric_relation(">", depth, ir_max_depth)) {
416
+ (__eliscript_tdz_read_14())((String("IR node exceeds nesting depth ") + String(ir_max_depth)));
571
417
  }
572
418
  if (__eliscript_truthy((active)["has"](node))) {
573
419
  (__eliscript_tdz_read_14())("IR node children must not contain a cycle");
@@ -628,10 +474,10 @@ function validate_program(program) {
628
474
  }
629
475
  function validate_document(document) {
630
476
  require_closed_record(document, ["format", "program", "version"], "IR document");
631
- if ((!((document)["format"] === (__eliscript_tdz_read_0())))) {
477
+ if ((!((document)["format"] === ir_format))) {
632
478
  (__eliscript_tdz_read_14())((String("unsupported IR format: ") + String((document)["format"])));
633
479
  }
634
- if ((!((document)["version"] === (__eliscript_tdz_read_1())))) {
480
+ if ((!((document)["version"] === ir_version))) {
635
481
  (__eliscript_tdz_read_14())((String("unsupported IR version: ") + String((document)["version"])));
636
482
  }
637
483
  validate_program((document)["program"]);
@@ -639,7 +485,7 @@ function validate_document(document) {
639
485
  }
640
486
  function serialize_program(program) {
641
487
  {
642
- const __eliscript_value_53 = ({"format": (__eliscript_tdz_read_0()), "version": (__eliscript_tdz_read_1()), "program": program});
488
+ const __eliscript_value_53 = ({"format": ir_format, "version": ir_version, "program": program});
643
489
  {
644
490
  let document = __eliscript_value_53;
645
491
  validate_document(document);
@@ -649,7 +495,7 @@ function serialize_program(program) {
649
495
  }
650
496
  function validate_serializable_program(program) {
651
497
  {
652
- const __eliscript_value_54 = ({"format": (__eliscript_tdz_read_0()), "version": (__eliscript_tdz_read_1()), "program": program});
498
+ const __eliscript_value_54 = ({"format": ir_format, "version": ir_version, "program": program});
653
499
  {
654
500
  let document = __eliscript_value_54;
655
501
  validate_document(document);
@@ -676,7 +522,7 @@ function node_kind_p(kind) {
676
522
  return ((__eliscript_tdz_read_23()))["has"](kind);
677
523
  }
678
524
  function reference_node_kind_p(kind) {
679
- return ((__eliscript_tdz_read_3()))["includes"](kind);
525
+ return (node_kinds)["includes"](kind);
680
526
  }
681
527
  function make_program(filename, body) {
682
528
  if ((!__eliscript_truthy(Array.isArray(body)))) {
@@ -685,7 +531,7 @@ function make_program(filename, body) {
685
531
  if ((!__eliscript_truthy((body)["every"](node_p)))) {
686
532
  (__eliscript_tdz_read_12())("IR program body must contain only IR nodes");
687
533
  }
688
- return ({[(__eliscript_tdz_read_4())]: filename, [(__eliscript_tdz_read_5())]: body});
534
+ return ({[ir_filename_key]: filename, [ir_body_key]: body});
689
535
  }
690
536
  function node_p(value) {
691
537
  return ((__eliscript_value_55) => (__eliscript_truthy(__eliscript_value_55) ? ((__eliscript_value_56) => (__eliscript_truthy(__eliscript_value_56) ? node_kind_p((value)["kind"]) : __eliscript_value_56))((typeof value === "object")) : __eliscript_value_55))(value);
@@ -704,11 +550,11 @@ function make_node(kind, span, value, children, properties) {
704
550
  (__eliscript_tdz_read_12())("IR node children must all be IR nodes");
705
551
  }
706
552
  {
707
- const __eliscript_value_59 = ({[(__eliscript_tdz_read_6())]: ((__eliscript_tdz_read_11()))["get"](kind), [(__eliscript_tdz_read_7())]: span, [(__eliscript_tdz_read_8())]: value, [(__eliscript_tdz_read_9())]: children});
553
+ const __eliscript_value_59 = ({[ir_kind_key]: (canonical_node_kinds)["get"](kind), [ir_span_key]: span, [ir_value_key]: value, [ir_children_key]: children});
708
554
  {
709
555
  let node = __eliscript_value_59;
710
556
  if (__eliscript_truthy(properties)) {
711
- ((node)[(__eliscript_tdz_read_10())] = properties);
557
+ ((node)[ir_properties_key] = properties);
712
558
  }
713
559
  return node;
714
560
  }