eliscript 0.0.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.
- package/LICENSE +674 -0
- package/README.md +135 -0
- package/bin/eliscript +16 -0
- package/bin/eliscript-bootstrap +15 -0
- package/bin/eliscript-build +15 -0
- package/bin/eliscript-check +15 -0
- package/bin/eliscript-eval +15 -0
- package/bin/eliscript-format +15 -0
- package/bin/eliscript-org +10 -0
- package/bin/eliscript-portable +17 -0
- package/bin/eliscript-seed +10 -0
- package/bin/eliscript-seed-build +10 -0
- package/bin/eliscript-watch +15 -0
- package/bootstrap/README.md +100 -0
- package/bootstrap/compiler/analyzer.eli +1426 -0
- package/bootstrap/compiler/compiler.eli +472 -0
- package/bootstrap/compiler/emitter.eli +1745 -0
- package/bootstrap/compiler/expander.eli +2522 -0
- package/bootstrap/compiler/formatter.eli +359 -0
- package/bootstrap/compiler/ir.eli +297 -0
- package/bootstrap/compiler/lower.eli +661 -0
- package/bootstrap/compiler/project.eli +1120 -0
- package/bootstrap/compiler/reader.eli +321 -0
- package/bootstrap/compiler/source-map.eli +165 -0
- package/bootstrap/compiler/symbol.eli +92 -0
- package/bootstrap/compiler/syntax.eli +54 -0
- package/bootstrap/compiler/transient-analysis.eli +825 -0
- package/bootstrap/host/build.mjs +28 -0
- package/bootstrap/host/bun.mjs +282 -0
- package/bootstrap/host/check-cli.mjs +163 -0
- package/bootstrap/host/eliscript-cli.mjs +36 -0
- package/bootstrap/host/evaluation-cli.mjs +401 -0
- package/bootstrap/host/evaluation.mjs +560 -0
- package/bootstrap/host/format-cli.mjs +139 -0
- package/bootstrap/host/project-cli.mjs +295 -0
- package/bootstrap/host/project.mjs +1080 -0
- package/bootstrap/host/watch-cli.mjs +129 -0
- package/bootstrap/host/watch.mjs +267 -0
- package/browser/host.mjs +357 -0
- package/browser/worker.mjs +60 -0
- package/compiler/README.md +118 -0
- package/compiler/eliscript-analyzer.el +716 -0
- package/compiler/eliscript-cli.el +108 -0
- package/compiler/eliscript-diagnostic.el +158 -0
- package/compiler/eliscript-emitter.el +1351 -0
- package/compiler/eliscript-evaluation.el +259 -0
- package/compiler/eliscript-expander.el +1630 -0
- package/compiler/eliscript-form.el +79 -0
- package/compiler/eliscript-ir-emitter.el +1460 -0
- package/compiler/eliscript-ir.el +356 -0
- package/compiler/eliscript-lower.el +463 -0
- package/compiler/eliscript-macro-eval.el +811 -0
- package/compiler/eliscript-parameters.el +324 -0
- package/compiler/eliscript-portable.el +492 -0
- package/compiler/eliscript-project-cli.el +156 -0
- package/compiler/eliscript-project.el +1676 -0
- package/compiler/eliscript-reader.el +421 -0
- package/compiler/eliscript-source-map.el +192 -0
- package/compiler/eliscript-symbol.el +101 -0
- package/compiler/eliscript-transient-analysis.el +817 -0
- package/compiler/eliscript.el +239 -0
- package/dist/bootstrap/analyzer.mjs +968 -0
- package/dist/bootstrap/analyzer.mjs.map +1 -0
- package/dist/bootstrap/compiler.mjs +228 -0
- package/dist/bootstrap/compiler.mjs.map +1 -0
- package/dist/bootstrap/emitter.mjs +1173 -0
- package/dist/bootstrap/emitter.mjs.map +1 -0
- package/dist/bootstrap/expander.mjs +1469 -0
- package/dist/bootstrap/expander.mjs.map +1 -0
- package/dist/bootstrap/formatter.mjs +304 -0
- package/dist/bootstrap/formatter.mjs.map +1 -0
- package/dist/bootstrap/ir.mjs +193 -0
- package/dist/bootstrap/ir.mjs.map +1 -0
- package/dist/bootstrap/lower.mjs +344 -0
- package/dist/bootstrap/lower.mjs.map +1 -0
- package/dist/bootstrap/project.mjs +585 -0
- package/dist/bootstrap/project.mjs.map +1 -0
- package/dist/bootstrap/reader.mjs +259 -0
- package/dist/bootstrap/reader.mjs.map +1 -0
- package/dist/bootstrap/source-map.mjs +154 -0
- package/dist/bootstrap/source-map.mjs.map +1 -0
- package/dist/bootstrap/symbol.mjs +74 -0
- package/dist/bootstrap/symbol.mjs.map +1 -0
- package/dist/bootstrap/syntax.mjs +38 -0
- package/dist/bootstrap/syntax.mjs.map +1 -0
- package/dist/bootstrap/transient-analysis.mjs +660 -0
- package/dist/bootstrap/transient-analysis.mjs.map +1 -0
- package/dist/browser/compiler.js +6491 -0
- package/editor/README.md +83 -0
- package/editor/eliscript-mode.el +878 -0
- package/editor/eliscript-repl.el +501 -0
- package/package.json +163 -0
- package/platform/README.md +48 -0
- package/platform/browser.mjs +204 -0
- package/platform/worker.mjs +166 -0
- package/runtime/README.md +296 -0
- package/runtime/core/collection-internals.mjs +512 -0
- package/runtime/core/collection.mjs +645 -0
- package/runtime/core/data-text.mjs +532 -0
- package/runtime/core/data.mjs +268 -0
- package/runtime/core/identifier.mjs +314 -0
- package/runtime/core/lazy-sequence.mjs +244 -0
- package/runtime/core/list-internals.mjs +18 -0
- package/runtime/core/list.mjs +273 -0
- package/runtime/core/map-internals.mjs +793 -0
- package/runtime/core/map.mjs +394 -0
- package/runtime/core/metadata-internals.mjs +14 -0
- package/runtime/core/metadata.mjs +44 -0
- package/runtime/core/object-impl.mjs +65 -0
- package/runtime/core/object-impl.mjs.map +1 -0
- package/runtime/core/object.mjs +13 -0
- package/runtime/core/order.mjs +234 -0
- package/runtime/core/persistent-kind.mjs +43 -0
- package/runtime/core/protocol-error.mjs +36 -0
- package/runtime/core/protocol-impl.mjs +326 -0
- package/runtime/core/protocol-impl.mjs.map +1 -0
- package/runtime/core/protocol.mjs +14 -0
- package/runtime/core/queue-internals.mjs +27 -0
- package/runtime/core/queue.mjs +238 -0
- package/runtime/core/record.mjs +346 -0
- package/runtime/core/regex.mjs +184 -0
- package/runtime/core/sequence.mjs +632 -0
- package/runtime/core/set-algebra.mjs +287 -0
- package/runtime/core/set-internals.mjs +33 -0
- package/runtime/core/set.mjs +378 -0
- package/runtime/core/sorted-internals.mjs +215 -0
- package/runtime/core/sorted.mjs +598 -0
- package/runtime/core/text-impl.mjs +95 -0
- package/runtime/core/text-impl.mjs.map +1 -0
- package/runtime/core/text.mjs +15 -0
- package/runtime/core/transducer.mjs +668 -0
- package/runtime/core/transient-internals.mjs +38 -0
- package/runtime/core/transient.mjs +53 -0
- package/runtime/core/truth.mjs +3 -0
- package/runtime/core/type.mjs +262 -0
- package/runtime/core/value-internals.mjs +188 -0
- package/runtime/core/value.mjs +93 -0
- package/runtime/core/vector-internals.mjs +102 -0
- package/runtime/core/vector.mjs +951 -0
- package/runtime/literals.mjs +34 -0
- package/runtime/source-mapping.mjs +220 -0
- package/runtime/testing/list.mjs +52 -0
- package/runtime/testing/map.mjs +145 -0
- package/runtime/testing/queue.mjs +49 -0
- package/runtime/testing/set.mjs +61 -0
- package/runtime/testing/sorted.mjs +105 -0
- package/runtime/testing/value.mjs +17 -0
- package/runtime/testing/vector.mjs +102 -0
- package/runtime/worker-value-codec.mjs +565 -0
- package/runtime/worker-value-stream.mjs +786 -0
- package/runtime/worker.mjs +975 -0
- package/stdlib/README.md +774 -0
- package/stdlib/bit.eli +36 -0
- package/stdlib/core/collection.eli +134 -0
- package/stdlib/core/data-text.eli +16 -0
- package/stdlib/core/data.eli +306 -0
- package/stdlib/core/identifier.eli +32 -0
- package/stdlib/core/lazy-sequence.eli +63 -0
- package/stdlib/core/metadata.eli +20 -0
- package/stdlib/core/object.eli +89 -0
- package/stdlib/core/order.eli +133 -0
- package/stdlib/core/protocol.eli +387 -0
- package/stdlib/core/record.eli +16 -0
- package/stdlib/core/regex.eli +17 -0
- package/stdlib/core/seq.eli +701 -0
- package/stdlib/core/set.eli +312 -0
- package/stdlib/core/sorted.eli +53 -0
- package/stdlib/core/text.eli +103 -0
- package/stdlib/core/transducer.eli +59 -0
- package/stdlib/core/transient.eli +24 -0
- package/stdlib/core/type.eli +19 -0
- package/stdlib/core/walk.eli +195 -0
- package/stdlib/core/zipper.eli +508 -0
- package/stdlib/data-text.eli +1092 -0
- package/stdlib/data.eli +42 -0
- package/stdlib/deferred.eli +70 -0
- package/stdlib/function.eli +120 -0
- package/stdlib/hierarchy.eli +245 -0
- package/stdlib/identifier.eli +147 -0
- package/stdlib/interop/js.eli +616 -0
- package/stdlib/json.eli +870 -0
- package/stdlib/metadata.eli +56 -0
- package/stdlib/multimethod.eli +464 -0
- package/stdlib/numeric.eli +193 -0
- package/stdlib/object.eli +96 -0
- package/stdlib/persistent-list.eli +145 -0
- package/stdlib/persistent-map.eli +724 -0
- package/stdlib/persistent-queue.eli +32 -0
- package/stdlib/persistent-set.eli +236 -0
- package/stdlib/persistent-vector.eli +342 -0
- package/stdlib/result.eli +141 -0
- package/stdlib/sequence.eli +106 -0
- package/stdlib/state/atom.eli +265 -0
- package/stdlib/text.eli +88 -0
- package/stdlib/value.eli +325 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
// Generated by Eliscript. Do not edit.
|
|
2
|
+
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
3
|
+
|
|
4
|
+
import {read_string} from "./reader.mjs";
|
|
5
|
+
const formatter_format = "eliscript-formatter";
|
|
6
|
+
const formatter_version = 1;
|
|
7
|
+
const formatter_width = 88;
|
|
8
|
+
const formatter_indent = 2;
|
|
9
|
+
const formatter_fail = (message, filename) => { const error = new Error(message); error.eliscriptDiagnostic = { format: 'eliscript-diagnostic', version: 1, code: 'ELI-F0001', severity: 'error', phase: 'formatter', message, ...(filename ? { location: { file: filename } } : {}) }; throw error; };
|
|
10
|
+
const declaration_heads = ["module", "defasync", "defconst", "defmacro", "defmethod", "defmulti", "defn", "defportable", "defprotocol", "defun", "defvar", "extend-category", "extend-default", "extend-type", "export-default"];
|
|
11
|
+
const operand_heads = ["->", "->>", "as->", "case", "catch", "cond", "condp", "cond->", "cond->>", "if", "if-let", "if-some", "import", "import-portable", "let", "let*", "letfn", "loop", "unless", "when", "some->", "some->>", "when-let", "when-some", "while"];
|
|
12
|
+
function formatter_error(message, filename) {
|
|
13
|
+
return formatter_fail(message, filename);
|
|
14
|
+
}
|
|
15
|
+
function make_scan_state(source, filename) {
|
|
16
|
+
return ({"source": source, "filename": filename, "index": 0});
|
|
17
|
+
}
|
|
18
|
+
function peek_code(state) {
|
|
19
|
+
return ((state)["source"])["charCodeAt"]((state)["index"]);
|
|
20
|
+
}
|
|
21
|
+
function peek_code_ahead(state, count) {
|
|
22
|
+
return ((state)["source"])["charCodeAt"](((state)["index"] + count));
|
|
23
|
+
}
|
|
24
|
+
function at_end_p(state) {
|
|
25
|
+
return ((state)["index"] >= ((state)["source"])["length"]);
|
|
26
|
+
}
|
|
27
|
+
function advance(state) {
|
|
28
|
+
return (__eliscript_truthy((!__eliscript_truthy(at_end_p(state)))) ? ((state)["index"] = ((state)["index"] + 1)) : null);
|
|
29
|
+
}
|
|
30
|
+
function whitespace_code_p(code) {
|
|
31
|
+
return ((__eliscript_value_1) => (__eliscript_truthy(__eliscript_value_1) ? __eliscript_value_1 : ((__eliscript_value_2) => (__eliscript_truthy(__eliscript_value_2) ? __eliscript_value_2 : ((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? __eliscript_value_3 : ((__eliscript_value_4) => (__eliscript_truthy(__eliscript_value_4) ? __eliscript_value_4 : (code === 12)))((code === 13))))((code === 10))))((code === 9))))((code === 32));
|
|
32
|
+
}
|
|
33
|
+
function token_delimiter_code_p(code) {
|
|
34
|
+
return ((__eliscript_value_5) => (__eliscript_truthy(__eliscript_value_5) ? __eliscript_value_5 : ((__eliscript_value_6) => (__eliscript_truthy(__eliscript_value_6) ? __eliscript_value_6 : ((__eliscript_value_7) => (__eliscript_truthy(__eliscript_value_7) ? __eliscript_value_7 : ((__eliscript_value_8) => (__eliscript_truthy(__eliscript_value_8) ? __eliscript_value_8 : ((__eliscript_value_9) => (__eliscript_truthy(__eliscript_value_9) ? __eliscript_value_9 : ((__eliscript_value_10) => (__eliscript_truthy(__eliscript_value_10) ? __eliscript_value_10 : ((__eliscript_value_11) => (__eliscript_truthy(__eliscript_value_11) ? __eliscript_value_11 : ((__eliscript_value_12) => (__eliscript_truthy(__eliscript_value_12) ? __eliscript_value_12 : ((__eliscript_value_13) => (__eliscript_truthy(__eliscript_value_13) ? __eliscript_value_13 : ((__eliscript_value_14) => (__eliscript_truthy(__eliscript_value_14) ? __eliscript_value_14 : ((__eliscript_value_15) => (__eliscript_truthy(__eliscript_value_15) ? __eliscript_value_15 : ((__eliscript_value_16) => (__eliscript_truthy(__eliscript_value_16) ? __eliscript_value_16 : (code === 96)))((code === 59))))((code === 44))))((code === 39))))((code === 34))))((code === 125))))((code === 123))))((code === 93))))((code === 91))))((code === 41))))((code === 40))))(whitespace_code_p(code))))((globalThis.Number)["isNaN"](code));
|
|
35
|
+
}
|
|
36
|
+
function token(kind, text) {
|
|
37
|
+
return ({"kind": kind, "text": text});
|
|
38
|
+
}
|
|
39
|
+
function collection_token(text, closing) {
|
|
40
|
+
return ({"kind": "open", "text": text, "closing": closing});
|
|
41
|
+
}
|
|
42
|
+
function read_string_token(state) {
|
|
43
|
+
return ((start, escaped, done) => {
|
|
44
|
+
advance(state);
|
|
45
|
+
(() => {
|
|
46
|
+
while (__eliscript_truthy(((__eliscript_value_17) => (__eliscript_truthy(__eliscript_value_17) ? (!__eliscript_truthy(at_end_p(state))) : __eliscript_value_17))((!__eliscript_truthy(done))))) {
|
|
47
|
+
((code) => {
|
|
48
|
+
advance(state);
|
|
49
|
+
return (__eliscript_truthy(escaped) ? ((escaped = false)) : (__eliscript_truthy((code === 92)) ? ((escaped = true)) : (__eliscript_truthy((code === 34)) ? ((done = true)) : null)));
|
|
50
|
+
})(peek_code(state));
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
})();
|
|
54
|
+
return token("string", ((state)["source"])["slice"](start, (state)["index"]));
|
|
55
|
+
})((state)["index"], false, false);
|
|
56
|
+
}
|
|
57
|
+
function read_comment_token(state) {
|
|
58
|
+
return ((start) => {
|
|
59
|
+
(() => {
|
|
60
|
+
while (__eliscript_truthy(((__eliscript_value_18) => (__eliscript_truthy(__eliscript_value_18) ? ((__eliscript_value_19) => (__eliscript_truthy(__eliscript_value_19) ? (!__eliscript_truthy((peek_code(state) === 13))) : __eliscript_value_19))((!__eliscript_truthy((peek_code(state) === 10)))) : __eliscript_value_18))((!__eliscript_truthy(at_end_p(state)))))) {
|
|
61
|
+
advance(state);
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
})();
|
|
65
|
+
return token("comment", (((state)["source"])["slice"](start, (state)["index"]))["replace"](/[ \t]+$/u, ""));
|
|
66
|
+
})((state)["index"]);
|
|
67
|
+
}
|
|
68
|
+
function read_atom_token(state) {
|
|
69
|
+
return ((start) => {
|
|
70
|
+
(() => {
|
|
71
|
+
while (__eliscript_truthy(((__eliscript_value_20) => (__eliscript_truthy(__eliscript_value_20) ? (!__eliscript_truthy(token_delimiter_code_p(peek_code(state)))) : __eliscript_value_20))((!__eliscript_truthy(at_end_p(state)))))) {
|
|
72
|
+
advance(state);
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
})();
|
|
76
|
+
return token("atom", ((state)["source"])["slice"](start, (state)["index"]));
|
|
77
|
+
})((state)["index"]);
|
|
78
|
+
}
|
|
79
|
+
function tokenize(source, filename) {
|
|
80
|
+
return ((state, tokens) => {
|
|
81
|
+
(() => {
|
|
82
|
+
while (__eliscript_truthy((!__eliscript_truthy(at_end_p(state))))) {
|
|
83
|
+
((code, next) => {
|
|
84
|
+
return (__eliscript_truthy(whitespace_code_p(code)) ? advance(state) : (__eliscript_truthy((code === 59)) ? (tokens)["push"](read_comment_token(state)) : (__eliscript_truthy((code === 34)) ? (tokens)["push"](read_string_token(state)) : (__eliscript_truthy(((__eliscript_value_21) => (__eliscript_truthy(__eliscript_value_21) ? (peek_code_ahead(state, 1) === 123) : __eliscript_value_21))((code === 35))) ? (() => {
|
|
85
|
+
advance(state);
|
|
86
|
+
advance(state);
|
|
87
|
+
return (tokens)["push"](collection_token("#{", "}"));
|
|
88
|
+
})() : (__eliscript_truthy(((__eliscript_value_22) => (__eliscript_truthy(__eliscript_value_22) ? (peek_code_ahead(state, 1) === 39) : __eliscript_value_22))((code === 35))) ? (() => {
|
|
89
|
+
advance(state);
|
|
90
|
+
advance(state);
|
|
91
|
+
return (tokens)["push"](token("prefix", "#'"));
|
|
92
|
+
})() : (__eliscript_truthy((code === 40)) ? (() => {
|
|
93
|
+
advance(state);
|
|
94
|
+
return (tokens)["push"](collection_token("(", ")"));
|
|
95
|
+
})() : (__eliscript_truthy((code === 91)) ? (() => {
|
|
96
|
+
advance(state);
|
|
97
|
+
return (tokens)["push"](collection_token("[", "]"));
|
|
98
|
+
})() : (__eliscript_truthy((code === 123)) ? (() => {
|
|
99
|
+
advance(state);
|
|
100
|
+
return (tokens)["push"](collection_token("{", "}"));
|
|
101
|
+
})() : (__eliscript_truthy(((__eliscript_value_23) => (__eliscript_truthy(__eliscript_value_23) ? __eliscript_value_23 : ((__eliscript_value_24) => (__eliscript_truthy(__eliscript_value_24) ? __eliscript_value_24 : (code === 125)))((code === 93))))((code === 41))) ? (() => {
|
|
102
|
+
((next = ((state)["source"])["charAt"]((state)["index"])));
|
|
103
|
+
advance(state);
|
|
104
|
+
return (tokens)["push"](token("close", next));
|
|
105
|
+
})() : (__eliscript_truthy(((__eliscript_value_25) => (__eliscript_truthy(__eliscript_value_25) ? __eliscript_value_25 : (code === 96)))((code === 39))) ? (() => {
|
|
106
|
+
((next = ((state)["source"])["charAt"]((state)["index"])));
|
|
107
|
+
advance(state);
|
|
108
|
+
return (tokens)["push"](token("prefix", next));
|
|
109
|
+
})() : (__eliscript_truthy((code === 44)) ? (() => {
|
|
110
|
+
advance(state);
|
|
111
|
+
return (__eliscript_truthy((peek_code(state) === 64)) ? (() => {
|
|
112
|
+
advance(state);
|
|
113
|
+
return (tokens)["push"](token("prefix", ",@"));
|
|
114
|
+
})() : (tokens)["push"](token("prefix", ",")));
|
|
115
|
+
})() : ((atom) => {
|
|
116
|
+
(__eliscript_truthy((((atom)["text"])["length"] === 0)) ? formatter_error("formatter tokenizer made no progress", filename) : null);
|
|
117
|
+
return (tokens)["push"](atom);
|
|
118
|
+
})(read_atom_token(state)))))))))))));
|
|
119
|
+
})(peek_code(state), null);
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
})();
|
|
123
|
+
return tokens;
|
|
124
|
+
})(make_scan_state(source, filename), []);
|
|
125
|
+
}
|
|
126
|
+
function parse_node(tokens, cursor, filename) {
|
|
127
|
+
(__eliscript_truthy(((cursor)["index"] >= (tokens)["length"])) ? formatter_error("unexpected end of formatter token stream", filename) : null);
|
|
128
|
+
return ((current) => {
|
|
129
|
+
return ((kind) => {
|
|
130
|
+
return (() => {
|
|
131
|
+
((cursor)["index"] = ((cursor)["index"] + 1));
|
|
132
|
+
return (__eliscript_truthy(((__eliscript_value_26) => (__eliscript_truthy(__eliscript_value_26) ? __eliscript_value_26 : ((__eliscript_value_27) => (__eliscript_truthy(__eliscript_value_27) ? __eliscript_value_27 : (kind === "comment")))((kind === "string"))))((kind === "atom"))) ? current : (__eliscript_truthy((kind === "prefix")) ? ((children) => {
|
|
133
|
+
(() => {
|
|
134
|
+
while (__eliscript_truthy(((__eliscript_value_28) => (__eliscript_truthy(__eliscript_value_28) ? ((((((tokens) ?? [])[(cursor)["index"]]) ?? null))["kind"] === "comment") : __eliscript_value_28))(((cursor)["index"] < (tokens)["length"])))) {
|
|
135
|
+
(children)["push"](((((tokens) ?? [])[(cursor)["index"]]) ?? null));
|
|
136
|
+
((cursor)["index"] = ((cursor)["index"] + 1));
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
})();
|
|
140
|
+
(__eliscript_truthy(((cursor)["index"] >= (tokens)["length"])) ? formatter_error("reader prefix has no target", filename) : null);
|
|
141
|
+
(children)["push"](parse_node(tokens, cursor, filename));
|
|
142
|
+
return ({"kind": "prefix", "text": (current)["text"], "children": children});
|
|
143
|
+
})([]) : (__eliscript_truthy((kind === "open")) ? ((children, done) => {
|
|
144
|
+
(() => {
|
|
145
|
+
while (__eliscript_truthy((!__eliscript_truthy(done)))) {
|
|
146
|
+
(__eliscript_truthy(((cursor)["index"] >= (tokens)["length"])) ? formatter_error("collection has no closing delimiter", filename) : null);
|
|
147
|
+
((next) => {
|
|
148
|
+
return (__eliscript_truthy(((next)["kind"] === "close")) ? (() => {
|
|
149
|
+
(__eliscript_truthy((!__eliscript_truthy(((next)["text"] === (current)["closing"])))) ? formatter_error("mismatched collection delimiter", filename) : null);
|
|
150
|
+
((cursor)["index"] = ((cursor)["index"] + 1));
|
|
151
|
+
return ((done = true));
|
|
152
|
+
})() : (children)["push"](parse_node(tokens, cursor, filename)));
|
|
153
|
+
})(((((tokens) ?? [])[(cursor)["index"]]) ?? null));
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
})();
|
|
157
|
+
return ({"kind": "collection", "text": (current)["text"], "closing": (current)["closing"], "children": children});
|
|
158
|
+
})([], false) : formatter_error("unexpected closing delimiter", filename))));
|
|
159
|
+
})();
|
|
160
|
+
})((current)["kind"]);
|
|
161
|
+
})(((((tokens) ?? [])[(cursor)["index"]]) ?? null));
|
|
162
|
+
}
|
|
163
|
+
function concrete_tree(source, filename) {
|
|
164
|
+
return ((tokens) => {
|
|
165
|
+
return ((cursor) => {
|
|
166
|
+
return ((children) => {
|
|
167
|
+
return (() => {
|
|
168
|
+
(() => {
|
|
169
|
+
while (__eliscript_truthy(((cursor)["index"] < (tokens)["length"]))) {
|
|
170
|
+
(children)["push"](parse_node(tokens, cursor, filename));
|
|
171
|
+
}
|
|
172
|
+
return null;
|
|
173
|
+
})();
|
|
174
|
+
return ({"kind": "root", "children": children});
|
|
175
|
+
})();
|
|
176
|
+
})([]);
|
|
177
|
+
})(({"index": 0}));
|
|
178
|
+
})(tokenize(source, filename));
|
|
179
|
+
}
|
|
180
|
+
function flat_node(node) {
|
|
181
|
+
return ((kind) => {
|
|
182
|
+
return (__eliscript_truthy(((__eliscript_value_29) => (__eliscript_truthy(__eliscript_value_29) ? __eliscript_value_29 : (kind === "string")))((kind === "atom"))) ? (node)["text"] : (__eliscript_truthy((kind === "comment")) ? null : (__eliscript_truthy((kind === "prefix")) ? ((children) => {
|
|
183
|
+
return (__eliscript_truthy((!__eliscript_truthy(((children)["length"] === 1)))) ? null : ((child) => {
|
|
184
|
+
return ((__eliscript_value_30) => (__eliscript_truthy(__eliscript_value_30) ? (String((node)["text"]) + String(child)) : __eliscript_value_30))(child);
|
|
185
|
+
})(flat_node(((((children) ?? [])[0]) ?? null))));
|
|
186
|
+
})((node)["children"]) : (__eliscript_truthy((kind === "collection")) ? ((pieces, children, index, possible) => {
|
|
187
|
+
(() => {
|
|
188
|
+
while (__eliscript_truthy(((__eliscript_value_31) => (__eliscript_truthy(__eliscript_value_31) ? (index < (children)["length"]) : __eliscript_value_31))(possible))) {
|
|
189
|
+
((piece) => {
|
|
190
|
+
return (__eliscript_truthy(piece) ? (pieces)["push"](piece) : ((possible = false)));
|
|
191
|
+
})(flat_node(((((children) ?? [])[index]) ?? null)));
|
|
192
|
+
((index = (index + 1)));
|
|
193
|
+
}
|
|
194
|
+
return null;
|
|
195
|
+
})();
|
|
196
|
+
return ((__eliscript_value_32) => (__eliscript_truthy(__eliscript_value_32) ? (String((node)["text"]) + String((pieces)["join"](" ")) + String((node)["closing"])) : __eliscript_value_32))(possible);
|
|
197
|
+
})([], (node)["children"], 0, true) : null))));
|
|
198
|
+
})((node)["kind"]);
|
|
199
|
+
}
|
|
200
|
+
function spaces(count) {
|
|
201
|
+
return (" ")["repeat"](count);
|
|
202
|
+
}
|
|
203
|
+
function list_leading_count(node) {
|
|
204
|
+
return (__eliscript_truthy((!__eliscript_truthy(((node)["text"] === "(")))) ? 0 : ((children) => {
|
|
205
|
+
return (__eliscript_truthy(((children)["length"] === 0)) ? 0 : ((head) => {
|
|
206
|
+
return (__eliscript_truthy(((__eliscript_value_33) => (__eliscript_truthy(__eliscript_value_33) ? (declaration_heads)["includes"](head) : __eliscript_value_33))(head)) ? 2 : (__eliscript_truthy(((__eliscript_value_34) => (__eliscript_truthy(__eliscript_value_34) ? (operand_heads)["includes"](head) : __eliscript_value_34))(head)) ? 2 : 1));
|
|
207
|
+
})(flat_node(((((children) ?? [])[0]) ?? null))));
|
|
208
|
+
})((node)["children"]));
|
|
209
|
+
}
|
|
210
|
+
function append_inline_child(output, child, indent) {
|
|
211
|
+
return ((piece) => {
|
|
212
|
+
return ((separator) => {
|
|
213
|
+
return ((candidate) => {
|
|
214
|
+
return ((__eliscript_value_36) => (__eliscript_truthy(__eliscript_value_36) ? ((__eliscript_value_37) => (__eliscript_truthy(__eliscript_value_37) ? candidate : __eliscript_value_37))(((indent + (candidate)["length"]) <= formatter_width)) : __eliscript_value_36))(candidate);
|
|
215
|
+
})(((__eliscript_value_35) => (__eliscript_truthy(__eliscript_value_35) ? (String(output) + String(separator) + String(piece)) : __eliscript_value_35))(piece));
|
|
216
|
+
})((__eliscript_truthy(((output)["length"] === 1)) ? "" : " "));
|
|
217
|
+
})(flat_node(child));
|
|
218
|
+
}
|
|
219
|
+
function render_prefix(node, indent) {
|
|
220
|
+
return ((children) => {
|
|
221
|
+
return (__eliscript_truthy(((children)["length"] === 1)) ? (String((node)["text"]) + String(render_node(((((children) ?? [])[0]) ?? null), (indent + ((node)["text"])["length"])))) : ((output, index) => {
|
|
222
|
+
(() => {
|
|
223
|
+
while (__eliscript_truthy((index < (children)["length"]))) {
|
|
224
|
+
((output = (String(output) + String("\n") + String(spaces((indent + formatter_indent))) + String(render_node(((((children) ?? [])[index]) ?? null), (indent + formatter_indent))))));
|
|
225
|
+
((index = (index + 1)));
|
|
226
|
+
}
|
|
227
|
+
return null;
|
|
228
|
+
})();
|
|
229
|
+
return output;
|
|
230
|
+
})((node)["text"], 0));
|
|
231
|
+
})((node)["children"]);
|
|
232
|
+
}
|
|
233
|
+
function render_collection(node, indent) {
|
|
234
|
+
return ((flat) => {
|
|
235
|
+
return ((children) => {
|
|
236
|
+
return (__eliscript_truthy(((__eliscript_value_38) => (__eliscript_truthy(__eliscript_value_38) ? ((indent + (flat)["length"]) <= formatter_width) : __eliscript_value_38))(flat)) ? flat : ((output, index, inline_left, last_comment) => {
|
|
237
|
+
(() => {
|
|
238
|
+
while (__eliscript_truthy(((__eliscript_value_39) => (__eliscript_truthy(__eliscript_value_39) ? (index < (children)["length"]) : __eliscript_value_39))((inline_left > 0)))) {
|
|
239
|
+
((candidate) => {
|
|
240
|
+
return (__eliscript_truthy(candidate) ? (() => {
|
|
241
|
+
((output = candidate));
|
|
242
|
+
((index = (index + 1)));
|
|
243
|
+
return ((inline_left = (inline_left - 1)));
|
|
244
|
+
})() : ((inline_left = 0)));
|
|
245
|
+
})(append_inline_child(output, ((((children) ?? [])[index]) ?? null), indent));
|
|
246
|
+
}
|
|
247
|
+
return null;
|
|
248
|
+
})();
|
|
249
|
+
(() => {
|
|
250
|
+
while (__eliscript_truthy((index < (children)["length"]))) {
|
|
251
|
+
((child) => {
|
|
252
|
+
return ((comment) => {
|
|
253
|
+
return (() => {
|
|
254
|
+
((output = (String(output) + String("\n") + String(spaces((indent + formatter_indent))) + String(render_node(child, (indent + formatter_indent))))));
|
|
255
|
+
return ((last_comment = comment));
|
|
256
|
+
})();
|
|
257
|
+
})(((child)["kind"] === "comment"));
|
|
258
|
+
})(((((children) ?? [])[index]) ?? null));
|
|
259
|
+
((index = (index + 1)));
|
|
260
|
+
}
|
|
261
|
+
return null;
|
|
262
|
+
})();
|
|
263
|
+
(__eliscript_truthy(last_comment) ? ((output = (String(output) + String("\n") + String(spaces(indent))))) : null);
|
|
264
|
+
return (String(output) + String((node)["closing"]));
|
|
265
|
+
})((node)["text"], 0, list_leading_count(node), false));
|
|
266
|
+
})((node)["children"]);
|
|
267
|
+
})(flat_node(node));
|
|
268
|
+
}
|
|
269
|
+
function render_node(node, indent) {
|
|
270
|
+
return ((kind) => {
|
|
271
|
+
return (__eliscript_truthy(((__eliscript_value_40) => (__eliscript_truthy(__eliscript_value_40) ? __eliscript_value_40 : ((__eliscript_value_41) => (__eliscript_truthy(__eliscript_value_41) ? __eliscript_value_41 : (kind === "comment")))((kind === "string"))))((kind === "atom"))) ? (node)["text"] : (__eliscript_truthy((kind === "prefix")) ? render_prefix(node, indent) : (__eliscript_truthy((kind === "collection")) ? render_collection(node, indent) : formatter_error("unsupported concrete syntax node", null))));
|
|
272
|
+
})((node)["kind"]);
|
|
273
|
+
}
|
|
274
|
+
function render_root(root) {
|
|
275
|
+
return ((children, output, index, seen_form, previous_comment) => {
|
|
276
|
+
(() => {
|
|
277
|
+
while (__eliscript_truthy((index < (children)["length"]))) {
|
|
278
|
+
((child) => {
|
|
279
|
+
return ((comment) => {
|
|
280
|
+
return (() => {
|
|
281
|
+
(__eliscript_truthy(((output)["length"] > 0)) ? ((output = (String(output) + String((__eliscript_truthy(((__eliscript_value_42) => (__eliscript_truthy(__eliscript_value_42) ? ((__eliscript_value_43) => (__eliscript_truthy(__eliscript_value_43) ? (!__eliscript_truthy(comment)) : __eliscript_value_43))((!__eliscript_truthy(previous_comment))) : __eliscript_value_42))(seen_form)) ? "\n\n" : "\n"))))) : null);
|
|
282
|
+
((output = (String(output) + String(render_node(child, 0)))));
|
|
283
|
+
(__eliscript_truthy((!__eliscript_truthy(comment))) ? ((seen_form = true)) : null);
|
|
284
|
+
return ((previous_comment = comment));
|
|
285
|
+
})();
|
|
286
|
+
})(((child)["kind"] === "comment"));
|
|
287
|
+
})(((((children) ?? [])[index]) ?? null));
|
|
288
|
+
((index = (index + 1)));
|
|
289
|
+
}
|
|
290
|
+
return null;
|
|
291
|
+
})();
|
|
292
|
+
return (__eliscript_truthy(((output)["length"] === 0)) ? "" : (String(output) + String("\n")));
|
|
293
|
+
})((root)["children"], "", 0, false, false);
|
|
294
|
+
}
|
|
295
|
+
function format_source(source, filename) {
|
|
296
|
+
(__eliscript_truthy((!__eliscript_truthy((typeof source === "string")))) ? formatter_error("formatter source must be a string", filename) : null);
|
|
297
|
+
read_string(source, filename);
|
|
298
|
+
return ((formatted) => {
|
|
299
|
+
read_string(formatted, filename);
|
|
300
|
+
return formatted;
|
|
301
|
+
})(render_root(concrete_tree(source, filename)));
|
|
302
|
+
}
|
|
303
|
+
export {formatter_format, formatter_version, formatter_width, formatter_indent, format_source};
|
|
304
|
+
//# sourceMappingURL=formatter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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 (js* \"(message, filename) => { const error = new Error(message); error.eliscriptDiagnostic = { format: 'eliscript-diagnostic', version: 1, code: 'ELI-F0001', severity: 'error', phase: 'formatter', message, ...(filename ? { location: { file: filename } } : {}) }; 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;AACF,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;SAC7B,eAAe,SAAQ;;AAE1B,yBAAwB,QAAO;SAC7B,EAAW,UAAQ,QAAO,YAAU,UAAS,SAAO;;AAEtD,mBAAkB;SAChB,CAAS,CAAK,OAAM,WAAS,cAAY,CAAK,OAAM;;AAEtD,yBAAwB,OAAM;SAC5B,CACE,CAAK,OAAM,WACX,cACA,CAAG,CAAK,OAAM,WAAQ;;AAE1B,kBAAiB;SACf,CAAI,CAAK,OAAM,YAAQ,CAAK,CAAK,OAAM,WAAS;;AAElD,iBAAgB;SACd,yCAAS,SAAS,YAChB,EAAK,OAAM,WAAO,CAAI,CAAK,OAAM;;AAErC,2BAA0B;SACxB,4WAAmD,CAAG,SAAK,MAApB,CAAG,SAAK,OAApB,CAAG,SAAK,OAAnB,CAAG,SAAK,MAApB,CAAG,SAAK;;AAEd,gCAA+B;SAC7B,ylCAM4B,CAAG,SAAK,MAApB,CAAG,SAAK,OAApB,CAAG,SAAK,OADI,CAAG,SAAK,OAApB,CAAG,SAAK,OADK,CAAG,SAAK,QAArB,CAAG,SAAK,QADI,CAAG,SAAK,OAApB,CAAG,SAAK,OADI,CAAG,SAAK,OAApB,CAAG,SAAK,OADP,kBAAkB,SADnB,CAAS,mBAAkB,SAAO;;AAQxC,eAAc,MAAK;S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,OAAO;eACxC,QAAK,iBAAO,CAAK,MAAK;SAxBV,CAAK,MAAK,SACX,GACO,mBAAmB,OACnB;OANP,CAAK,MAAK;KADb,UAAU;;AA8B1B,qBAAoB,MAAK;SACvB,EAAM;WAEF,oBAAC,4LAAsC,CAAG,SAAK,aAA1B,CAAG,SAAK,aAAxB,CAAG,SAAK,YACZ,CAAK,MAAK,UACX,oBAAC,CAAG,SAAK,aAAW,cAAc,MAAK,UACvC,oBAAC,CAAG,SAAK,iBAAe,kBAAkB,MAAK,UAC3C,gBAAgB,oCAAmC;KAN/C,CAAK,MAAK;;AAQxB,qBAAoB;SAClB,EAAM,UACA,QACA,OACA,WACA;IACJ;gCAAO,CAAG,QAAM,CAAK,UAAS;QAC5B,EAAO;mBACA;;cACL,oBAAM,CAAG,CAAK,QAAO,YAAS,MAC5B,CAAM,CAAA,SACJ,QAAK,iBACA,oBAAI,8IAAsC,qBAAK,mCAA5B,qBAAK,6CAAf,cACL,SACF;cACX,CAAM,CAAA,SAAO,QAAK,iBAAQ,YAAY,OAAM;cAC5C,yCAAQ,aAAQ,CAAM,CAAA,YAAU;qBAChC,CAAM,CAAA,mBAAiB;;aATT,CAAG,CAAK,OAAM,YAAO;WADvB,IAAc,iBAAN;QAWtB,CAAM,CAAA,QAAM,CAAI;;;;WAClB,oBAAI,CAAG,CAAK,QAAO,cAAS,MAAG,KAAG,QAAK,iBAAO;KAlBhC,CAAK,MAAK,aACZ,IACD,GACI,OACO;;AAgB1B,uBAAsB,QAAO;EAC3B,yCAAQ,CAAG,kBAAsB,eAC9B,gBAAgB,qCAAoC;EACtD,YAAY,QAAO;SACpB,EAAM;IACH,YAAY,WAAU;WACvB;KAFgB,YAAa,cAAc,QAAO;;AAItD,QACE,kBACA,mBACA,iBACA,kBACA"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// Generated by Eliscript. Do not edit.
|
|
2
|
+
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
3
|
+
|
|
4
|
+
const ir_format = "eliscript-ir";
|
|
5
|
+
const ir_version = 1;
|
|
6
|
+
const ir_max_depth = 512;
|
|
7
|
+
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"]);
|
|
8
|
+
const fail = (message) => { throw new Error(message); };
|
|
9
|
+
const schema_fail = (message) => { const error = new Error(message); error.eliscriptDiagnostic = { format: 'eliscript-diagnostic', version: 1, code: 'ELI-I0001', severity: 'error', phase: 'ir-schema', message }; throw error; };
|
|
10
|
+
const array_p = Array.isArray;
|
|
11
|
+
const dense_json_array_p = (value) => { if (!Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype || Object.getOwnPropertySymbols(value).length !== 0) return false; const names = Object.getOwnPropertyNames(value); if (names.length !== value.length + 1 || names[names.length - 1] !== 'length') return false; for (let index = 0; index < value.length; index += 1) { const name = String(index); if (names[index] !== name) return false; const descriptor = Object.getOwnPropertyDescriptor(value, name); if (!descriptor || !descriptor.enumerable || !Object.hasOwn(descriptor, 'value')) return false; } return true; };
|
|
12
|
+
const plain_record_keys = (value) => { if (value === null || typeof value !== 'object' || Array.isArray(value)) return null; const prototype = Object.getPrototypeOf(value); if (prototype !== Object.prototype && prototype !== null) return null; if (Object.getOwnPropertySymbols(value).length !== 0) return null; const names = Object.getOwnPropertyNames(value); for (const name of names) { const descriptor = Object.getOwnPropertyDescriptor(value, name); if (!descriptor || !descriptor.enumerable || !Object.hasOwn(descriptor, 'value')) return null; } return names.sort(); };
|
|
13
|
+
const has_own = Object.hasOwn;
|
|
14
|
+
const finite_number_p = Number.isFinite;
|
|
15
|
+
const non_negative_integer_p = (value) => Number.isSafeInteger(value) && value >= 0;
|
|
16
|
+
const positive_integer_p = (value) => Number.isSafeInteger(value) && value >= 1;
|
|
17
|
+
const parse_json = (source, reject) => { try { return JSON.parse(source); } catch (error) { return reject(`invalid canonical IR JSON: ${error.message}`); } };
|
|
18
|
+
const node_kind_set = new globalThis.Set(node_kinds);
|
|
19
|
+
function require_closed_record(value, expected, label) {
|
|
20
|
+
return ((keys) => {
|
|
21
|
+
(__eliscript_truthy((keys === null)) ? schema_fail((String(label) + String(" must be a plain data object"))) : null);
|
|
22
|
+
(__eliscript_truthy((!__eliscript_truthy(((keys)["length"] === (expected)["length"])))) ? schema_fail((String(label) + String(" has unknown or missing fields"))) : null);
|
|
23
|
+
(expected)["forEach"]((key) => {
|
|
24
|
+
return (__eliscript_truthy((!__eliscript_truthy((keys)["includes"](key)))) ? schema_fail((String(label) + String(" has unknown or missing fields"))) : null);
|
|
25
|
+
});
|
|
26
|
+
return keys;
|
|
27
|
+
})(plain_record_keys(value));
|
|
28
|
+
}
|
|
29
|
+
function canonical_json_array(value, path, active, depth) {
|
|
30
|
+
(__eliscript_truthy((!__eliscript_truthy(dense_json_array_p(value)))) ? schema_fail((String(path) + String(" must be a dense plain array"))) : null);
|
|
31
|
+
(__eliscript_truthy((active)["has"](value)) ? schema_fail((String(path) + String(" contains a cyclic JSON value"))) : null);
|
|
32
|
+
(active)["add"](value);
|
|
33
|
+
return ((parts, index) => {
|
|
34
|
+
(() => {
|
|
35
|
+
while (__eliscript_truthy((index < (value)["length"]))) {
|
|
36
|
+
(parts)["push"](canonical_json_value(((((value) ?? [])[index]) ?? null), (String(path) + String("[") + String(index) + String("]")), active, (depth + 1)));
|
|
37
|
+
((index = (index + 1)));
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
})();
|
|
41
|
+
(active)["delete"](value);
|
|
42
|
+
return (String("[") + String((parts)["join"](",")) + String("]"));
|
|
43
|
+
})([], 0);
|
|
44
|
+
}
|
|
45
|
+
function canonical_json_record(value, path, active, depth) {
|
|
46
|
+
return ((keys) => {
|
|
47
|
+
(__eliscript_truthy((keys === null)) ? schema_fail((String(path) + String(" must be a plain data object"))) : null);
|
|
48
|
+
(__eliscript_truthy((active)["has"](value)) ? schema_fail((String(path) + String(" contains a cyclic JSON value"))) : null);
|
|
49
|
+
(active)["add"](value);
|
|
50
|
+
return ((parts) => {
|
|
51
|
+
(keys)["forEach"]((key) => {
|
|
52
|
+
return (parts)["push"]((String(JSON.stringify(key)) + String(":") + String(canonical_json_value((value)[key], (String(path) + String(".") + String(key)), active, (depth + 1)))));
|
|
53
|
+
});
|
|
54
|
+
(active)["delete"](value);
|
|
55
|
+
return (String("{") + String((parts)["join"](",")) + String("}"));
|
|
56
|
+
})([]);
|
|
57
|
+
})(plain_record_keys(value));
|
|
58
|
+
}
|
|
59
|
+
function canonical_json_value(value, path, active, depth) {
|
|
60
|
+
(__eliscript_truthy((depth > ir_max_depth)) ? schema_fail((String(path) + String(" exceeds IR nesting depth ") + String(ir_max_depth))) : null);
|
|
61
|
+
return ((type) => {
|
|
62
|
+
return (__eliscript_truthy((value === null)) ? "null" : (__eliscript_truthy((type === "boolean")) ? (__eliscript_truthy(value) ? "true" : "false") : (__eliscript_truthy((type === "number")) ? (() => {
|
|
63
|
+
(__eliscript_truthy((!__eliscript_truthy(finite_number_p(value)))) ? schema_fail((String(path) + String(" must contain only finite numbers"))) : null);
|
|
64
|
+
return (__eliscript_truthy(Object.is(value, -0)) ? "-0" : JSON.stringify(value));
|
|
65
|
+
})() : (__eliscript_truthy((type === "string")) ? JSON.stringify(value) : (__eliscript_truthy(array_p(value)) ? canonical_json_array(value, path, active, depth) : (__eliscript_truthy((type === "object")) ? canonical_json_record(value, path, active, depth) : schema_fail((String(path) + String(" contains unsupported JSON type ") + String(type)))))))));
|
|
66
|
+
})(typeof value);
|
|
67
|
+
}
|
|
68
|
+
function canonical_json(value) {
|
|
69
|
+
return canonical_json_value(value, "$", new globalThis.Set(), 0);
|
|
70
|
+
}
|
|
71
|
+
function validate_span(span) {
|
|
72
|
+
require_closed_record(span, ["column", "end", "endColumn", "endLine", "filename", "line", "start"], "IR span");
|
|
73
|
+
(__eliscript_truthy((!__eliscript_truthy((typeof span.filename === "string")))) ? schema_fail("IR span filename must be a string") : null);
|
|
74
|
+
(["start", "end"])["forEach"]((key) => {
|
|
75
|
+
return (__eliscript_truthy((!__eliscript_truthy(non_negative_integer_p((span)[key])))) ? schema_fail((String("IR span ") + String(key) + String(" must be a non-negative integer"))) : null);
|
|
76
|
+
});
|
|
77
|
+
(["line", "column", "endLine", "endColumn"])["forEach"]((key) => {
|
|
78
|
+
return (__eliscript_truthy((!__eliscript_truthy(positive_integer_p((span)[key])))) ? schema_fail((String("IR span ") + String(key) + String(" must be a positive integer"))) : null);
|
|
79
|
+
});
|
|
80
|
+
(__eliscript_truthy(((span)["start"] > (span)["end"])) ? schema_fail("IR span start must not exceed end") : null);
|
|
81
|
+
return span;
|
|
82
|
+
}
|
|
83
|
+
function validate_node(node, active, depth) {
|
|
84
|
+
(__eliscript_truthy((depth > ir_max_depth)) ? schema_fail((String("IR node exceeds nesting depth ") + String(ir_max_depth))) : null);
|
|
85
|
+
(__eliscript_truthy((active)["has"](node)) ? schema_fail("IR node children must not contain a cycle") : null);
|
|
86
|
+
((keys) => {
|
|
87
|
+
(__eliscript_truthy((keys === null)) ? schema_fail("IR node must be a plain data object") : null);
|
|
88
|
+
return ((expected) => {
|
|
89
|
+
return require_closed_record(node, expected, "IR node");
|
|
90
|
+
})((__eliscript_truthy((keys)["includes"]("properties")) ? ["children", "kind", "properties", "span", "value"] : ["children", "kind", "span", "value"]));
|
|
91
|
+
})(plain_record_keys(node));
|
|
92
|
+
(__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_1) => (__eliscript_truthy(__eliscript_value_1) ? node_kind_p((node)["kind"]) : __eliscript_value_1))((typeof node.kind === "string"))))) ? schema_fail((String("unknown Eliscript IR node kind: ") + String((node)["kind"]))) : null);
|
|
93
|
+
validate_span((node)["span"]);
|
|
94
|
+
(__eliscript_truthy((!__eliscript_truthy(dense_json_array_p((node)["children"])))) ? schema_fail("IR node children must be a dense plain array") : null);
|
|
95
|
+
(__eliscript_truthy(has_own(node, "properties")) ? (__eliscript_truthy((plain_record_keys((node)["properties"]) === null)) ? schema_fail("IR node properties must be a plain data object") : null) : null);
|
|
96
|
+
(active)["add"](node);
|
|
97
|
+
((node)["children"])["forEach"]((child) => {
|
|
98
|
+
return validate_node(child, active, (depth + 1));
|
|
99
|
+
});
|
|
100
|
+
(active)["delete"](node);
|
|
101
|
+
return node;
|
|
102
|
+
}
|
|
103
|
+
function validate_program(program) {
|
|
104
|
+
require_closed_record(program, ["body", "filename"], "IR program");
|
|
105
|
+
(__eliscript_truthy((!__eliscript_truthy((typeof program.filename === "string")))) ? schema_fail("IR program filename must be a string") : null);
|
|
106
|
+
(__eliscript_truthy((!__eliscript_truthy(dense_json_array_p((program)["body"])))) ? schema_fail("IR program body must be a dense plain array") : null);
|
|
107
|
+
((active) => {
|
|
108
|
+
return ((program)["body"])["forEach"]((node) => {
|
|
109
|
+
return validate_node(node, active, 0);
|
|
110
|
+
});
|
|
111
|
+
})(new globalThis.Set());
|
|
112
|
+
return program;
|
|
113
|
+
}
|
|
114
|
+
function validate_document(document) {
|
|
115
|
+
require_closed_record(document, ["format", "program", "version"], "IR document");
|
|
116
|
+
(__eliscript_truthy((!__eliscript_truthy(((document)["format"] === ir_format)))) ? schema_fail((String("unsupported IR format: ") + String((document)["format"]))) : null);
|
|
117
|
+
(__eliscript_truthy((!__eliscript_truthy(((document)["version"] === ir_version)))) ? schema_fail((String("unsupported IR version: ") + String((document)["version"]))) : null);
|
|
118
|
+
validate_program((document)["program"]);
|
|
119
|
+
return document;
|
|
120
|
+
}
|
|
121
|
+
function serialize_program(program) {
|
|
122
|
+
return ((document) => {
|
|
123
|
+
validate_document(document);
|
|
124
|
+
return canonical_json(document);
|
|
125
|
+
})(({"format": ir_format, "version": ir_version, "program": program}));
|
|
126
|
+
}
|
|
127
|
+
function deserialize_program(source) {
|
|
128
|
+
(__eliscript_truthy((!__eliscript_truthy((typeof source === "string")))) ? schema_fail("canonical IR source must be a string") : null);
|
|
129
|
+
return ((document) => {
|
|
130
|
+
return ((_validated) => {
|
|
131
|
+
return ((canonical) => {
|
|
132
|
+
return (() => {
|
|
133
|
+
(__eliscript_truthy((!__eliscript_truthy((source === canonical)))) ? schema_fail("IR source is valid JSON but not canonical IR JSON") : null);
|
|
134
|
+
return (document)["program"];
|
|
135
|
+
})();
|
|
136
|
+
})(canonical_json(document));
|
|
137
|
+
})(validate_document(document));
|
|
138
|
+
})(parse_json(source, schema_fail));
|
|
139
|
+
}
|
|
140
|
+
function node_kind_p(kind) {
|
|
141
|
+
return (node_kind_set)["has"](kind);
|
|
142
|
+
}
|
|
143
|
+
function reference_node_kind_p(kind) {
|
|
144
|
+
return (node_kinds)["includes"](kind);
|
|
145
|
+
}
|
|
146
|
+
function make_program(filename, body) {
|
|
147
|
+
(__eliscript_truthy((!__eliscript_truthy(Array.isArray(body)))) ? fail("IR program body must be an array") : null);
|
|
148
|
+
(__eliscript_truthy((!__eliscript_truthy((body)["every"](node_p)))) ? fail("IR program body must contain only IR nodes") : null);
|
|
149
|
+
return ({"filename": filename, "body": body});
|
|
150
|
+
}
|
|
151
|
+
function node_p(value) {
|
|
152
|
+
return ((__eliscript_value_2) => (__eliscript_truthy(__eliscript_value_2) ? ((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? node_kind_p((value)["kind"]) : __eliscript_value_3))((typeof value === "object")) : __eliscript_value_2))(value);
|
|
153
|
+
}
|
|
154
|
+
function reference_node_p(value) {
|
|
155
|
+
return ((__eliscript_value_4) => (__eliscript_truthy(__eliscript_value_4) ? ((__eliscript_value_5) => (__eliscript_truthy(__eliscript_value_5) ? reference_node_kind_p((value)["kind"]) : __eliscript_value_5))((typeof value === "object")) : __eliscript_value_4))(value);
|
|
156
|
+
}
|
|
157
|
+
function make_node(kind, span, value, children, properties) {
|
|
158
|
+
(__eliscript_truthy((!__eliscript_truthy(node_kind_p(kind)))) ? fail((String("unknown Eliscript IR node kind: ") + String(kind))) : null);
|
|
159
|
+
(__eliscript_truthy((!__eliscript_truthy(Array.isArray(children)))) ? fail("IR node children must be an array") : null);
|
|
160
|
+
(__eliscript_truthy((!__eliscript_truthy((children)["every"](node_p)))) ? fail("IR node children must all be IR nodes") : null);
|
|
161
|
+
return ((node) => {
|
|
162
|
+
(__eliscript_truthy(properties) ? ((node)["properties"] = properties) : null);
|
|
163
|
+
return node;
|
|
164
|
+
})(({"kind": kind, "span": span, "value": value, "children": children}));
|
|
165
|
+
}
|
|
166
|
+
function program_filename(program) {
|
|
167
|
+
return (program)["filename"];
|
|
168
|
+
}
|
|
169
|
+
function program_body(program) {
|
|
170
|
+
return (program)["body"];
|
|
171
|
+
}
|
|
172
|
+
function ir_kind(node) {
|
|
173
|
+
return (node)["kind"];
|
|
174
|
+
}
|
|
175
|
+
function ir_span(node) {
|
|
176
|
+
return (node)["span"];
|
|
177
|
+
}
|
|
178
|
+
function ir_value(node) {
|
|
179
|
+
return (node)["value"];
|
|
180
|
+
}
|
|
181
|
+
function ir_children(node) {
|
|
182
|
+
return (node)["children"];
|
|
183
|
+
}
|
|
184
|
+
function ir_properties(node) {
|
|
185
|
+
return (node)["properties"];
|
|
186
|
+
}
|
|
187
|
+
function ir_property(node, name) {
|
|
188
|
+
return ((properties) => {
|
|
189
|
+
return ((__eliscript_value_6) => (__eliscript_truthy(__eliscript_value_6) ? (properties)[name] : __eliscript_value_6))(properties);
|
|
190
|
+
})(ir_properties(node));
|
|
191
|
+
}
|
|
192
|
+
export {ir_format, ir_version, node_kinds, node_kind_p, reference_node_kind_p, node_p, reference_node_p, make_program, make_node, program_filename, program_body, ir_kind, ir_span, ir_value, ir_children, ir_properties, ir_property, serialize_program, deserialize_program};
|
|
193
|
+
//# sourceMappingURL=ir.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.mjs","sources":["../../bootstrap/compiler/ir.eli"],"sourcesContent":["(module bootstrap.compiler.ir\n (defconst ir-format \"eliscript-ir\")\n (defconst ir-version 1)\n (defconst ir-max-depth 512)\n\n (defconst node-kinds\n (js-call globalThis.Object :freeze\n (js-array \"module-declaration\" \"import-declaration\" \"import-default\"\n \"import-namespace\" \"import-named\" \"variable-declaration\"\n \"function-declaration\" \"export-declaration\" \"export-default\"\n \"expression-statement\" \"parameter-binding\" \"array-binding-pattern\"\n \"map-binding-pattern\" \"map-binding-entry\"\n \"binding-name\" \"binding-hole\" \"reference\" \"literal\"\n \"array-literal\" \"persistent-list-literal\" \"persistent-vector-literal\"\n \"persistent-map-literal\" \"persistent-set-literal\" \"persistent-queue-literal\"\n \"quoted-literal\" \"function-expression\"\n \"await-expression\" \"throw-expression\" \"try-expression\"\n \"catch-clause\" \"catch-binding\" \"finally-clause\" \"conditional\"\n \"conditional-sugar\" \"conditional-chain\" \"conditional-clause\"\n \"sequence\" \"lexical-bindings\" \"lexical-binding\" \"assignment\"\n \"assignment-pair\" \"loop\" \"binding-loop\" \"recur\"\n \"short-circuit\" \"intrinsic\"\n \"object-literal\" \"object-property\" \"property-read\" \"property-write\"\n \"method-call\" \"constructor-call\" \"raw-javascript\" \"print\"\n \"string-concat\" \"invoke\" \"apply-call\" \"call\")))\n\n (defconst fail\n (js* \"(message) => { throw new Error(message); }\"))\n\n (defconst schema-fail\n (js* \"(message) => { const error = new Error(message); error.eliscriptDiagnostic = { format: 'eliscript-diagnostic', version: 1, code: 'ELI-I0001', severity: 'error', phase: 'ir-schema', message }; throw error; }\"))\n\n (defconst array-p (js* \"Array.isArray\"))\n (defconst dense-json-array-p\n (js* \"(value) => { if (!Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype || Object.getOwnPropertySymbols(value).length !== 0) return false; const names = Object.getOwnPropertyNames(value); if (names.length !== value.length + 1 || names[names.length - 1] !== 'length') return false; for (let index = 0; index < value.length; index += 1) { const name = String(index); if (names[index] !== name) return false; const descriptor = Object.getOwnPropertyDescriptor(value, name); if (!descriptor || !descriptor.enumerable || !Object.hasOwn(descriptor, 'value')) return false; } return true; }\"))\n (defconst plain-record-keys\n (js* \"(value) => { if (value === null || typeof value !== 'object' || Array.isArray(value)) return null; const prototype = Object.getPrototypeOf(value); if (prototype !== Object.prototype && prototype !== null) return null; if (Object.getOwnPropertySymbols(value).length !== 0) return null; const names = Object.getOwnPropertyNames(value); for (const name of names) { const descriptor = Object.getOwnPropertyDescriptor(value, name); if (!descriptor || !descriptor.enumerable || !Object.hasOwn(descriptor, 'value')) return null; } return names.sort(); }\"))\n (defconst has-own (js* \"Object.hasOwn\"))\n (defconst finite-number-p (js* \"Number.isFinite\"))\n (defconst non-negative-integer-p\n (js* \"(value) => Number.isSafeInteger(value) && value >= 0\"))\n (defconst positive-integer-p\n (js* \"(value) => Number.isSafeInteger(value) && value >= 1\"))\n (defconst parse-json\n (js* \"(source, reject) => { try { return JSON.parse(source); } catch (error) { return reject(`invalid canonical IR JSON: ${error.message}`); } }\"))\n\n (defconst node-kind-set\n (new globalThis.Set node-kinds))\n\n (defun require-closed-record (value expected label)\n (let ((keys (funcall plain-record-keys value)))\n (when (nil? keys)\n (schema-fail (str label \" must be a plain data object\")))\n (unless (= (get keys :length) (get expected :length))\n (schema-fail (str label \" has unknown or missing fields\")))\n (js-call expected :forEach\n (lambda (key)\n (unless (js-call keys :includes key)\n (schema-fail (str label \" has unknown or missing fields\")))))\n keys))\n\n (defun canonical-json-array (value path active depth)\n (unless (funcall dense-json-array-p value)\n (schema-fail (str path \" must be a dense plain array\")))\n (when (js-call active :has value)\n (schema-fail (str path \" contains a cyclic JSON value\")))\n (js-call active :add value)\n (let ((parts (js-array))\n (index 0))\n (while (< index (get value :length))\n (js-call parts :push\n (canonical-json-value\n (js-nth index value)\n (str path \"[\" index \"]\")\n active\n (1+ depth)))\n (setq index (1+ index)))\n (js-call active :delete value)\n (str \"[\" (js-call parts :join \",\") \"]\")))\n\n (defun canonical-json-record (value path active depth)\n (let ((keys (funcall plain-record-keys value)))\n (when (nil? keys)\n (schema-fail (str path \" must be a plain data object\")))\n (when (js-call active :has value)\n (schema-fail (str path \" contains a cyclic JSON value\")))\n (js-call active :add value)\n (let ((parts (js-array)))\n (js-call keys :forEach\n (lambda (key)\n (js-call parts :push\n (str\n (JSON/stringify key)\n \":\"\n (canonical-json-value\n (get value key)\n (str path \".\" key)\n active\n (1+ depth))))))\n (js-call active :delete value)\n (str \"{\" (js-call parts :join \",\") \"}\"))))\n\n (defun canonical-json-value (value path active depth)\n (when (> depth ir-max-depth)\n (schema-fail (str path \" exceeds IR nesting depth \" ir-max-depth)))\n (let ((type (js* \"typeof value\")))\n (cond\n ((nil? value) \"null\")\n ((= type \"boolean\") (if value \"true\" \"false\"))\n ((= type \"number\")\n (unless (funcall finite-number-p value)\n (schema-fail (str path \" must contain only finite numbers\")))\n (if (js* \"Object.is(value, -0)\") \"-0\" (JSON/stringify value)))\n ((= type \"string\") (JSON/stringify value))\n ((funcall array-p value)\n (canonical-json-array value path active depth))\n ((= type \"object\")\n (canonical-json-record value path active depth))\n (t\n (schema-fail (str path \" contains unsupported JSON type \" type))))))\n\n (defun canonical-json (value)\n (canonical-json-value value \"$\" (new globalThis.Set) 0))\n\n (defun validate-span (span)\n (require-closed-record\n span\n (js-array \"column\" \"end\" \"endColumn\" \"endLine\" \"filename\" \"line\" \"start\")\n \"IR span\")\n (unless (= (js* \"typeof span.filename\") \"string\")\n (schema-fail \"IR span filename must be a string\"))\n (js-call (js-array \"start\" \"end\") :forEach\n (lambda (key)\n (unless (funcall non-negative-integer-p (get span key))\n (schema-fail (str \"IR span \" key \" must be a non-negative integer\")))))\n (js-call (js-array \"line\" \"column\" \"endLine\" \"endColumn\") :forEach\n (lambda (key)\n (unless (funcall positive-integer-p (get span key))\n (schema-fail (str \"IR span \" key \" must be a positive integer\")))))\n (when (> (get span :start) (get span :end))\n (schema-fail \"IR span start must not exceed end\"))\n span)\n\n (defun validate-node (node active depth)\n (when (> depth ir-max-depth)\n (schema-fail (str \"IR node exceeds nesting depth \" ir-max-depth)))\n (when (js-call active :has node)\n (schema-fail \"IR node children must not contain a cycle\"))\n (let ((keys (funcall plain-record-keys node)))\n (when (nil? keys)\n (schema-fail \"IR node must be a plain data object\"))\n (let ((expected\n (if (js-call keys :includes \"properties\")\n (js-array \"children\" \"kind\" \"properties\" \"span\" \"value\")\n (js-array \"children\" \"kind\" \"span\" \"value\"))))\n (require-closed-record node expected \"IR node\")))\n (unless (and (= (js* \"typeof node.kind\") \"string\")\n (node-kind-p (get node :kind)))\n (schema-fail (str \"unknown Eliscript IR node kind: \" (get node :kind))))\n (validate-span (get node :span))\n (unless (funcall dense-json-array-p (get node :children))\n (schema-fail \"IR node children must be a dense plain array\"))\n (when (funcall has-own node \"properties\")\n (when (nil? (funcall plain-record-keys (get node :properties)))\n (schema-fail \"IR node properties must be a plain data object\")))\n (js-call active :add node)\n (js-call (get node :children) :forEach\n (lambda (child) (validate-node child active (1+ depth))))\n (js-call active :delete node)\n node)\n\n (defun validate-program (program)\n (require-closed-record\n program (js-array \"body\" \"filename\") \"IR program\")\n (unless (= (js* \"typeof program.filename\") \"string\")\n (schema-fail \"IR program filename must be a string\"))\n (unless (funcall dense-json-array-p (get program :body))\n (schema-fail \"IR program body must be a dense plain array\"))\n (let ((active (new globalThis.Set)))\n (js-call (get program :body) :forEach\n (lambda (node) (validate-node node active 0))))\n program)\n\n (defun validate-document (document)\n (require-closed-record\n document (js-array \"format\" \"program\" \"version\") \"IR document\")\n (unless (= (get document :format) ir-format)\n (schema-fail (str \"unsupported IR format: \" (get document :format))))\n (unless (= (get document :version) ir-version)\n (schema-fail (str \"unsupported IR version: \" (get document :version))))\n (validate-program (get document :program))\n document)\n\n (defun serialize-program (program)\n (let ((document\n (js-object\n :format ir-format\n :version ir-version\n :program program)))\n (validate-document document)\n (canonical-json document)))\n\n (defun deserialize-program (source)\n (unless (= (js* \"typeof source\") \"string\")\n (schema-fail \"canonical IR source must be a string\"))\n (let* ((document (funcall parse-json source schema-fail))\n (_validated (validate-document document))\n (canonical (canonical-json document)))\n (unless (= source canonical)\n (schema-fail \"IR source is valid JSON but not canonical IR JSON\"))\n (get document :program)))\n\n (defun node-kind-p (kind)\n (js-call node-kind-set :has kind))\n\n (defun reference-node-kind-p (kind)\n (js-call node-kinds :includes kind))\n\n (defun make-program (filename body)\n (unless (js* \"Array.isArray(body)\")\n (fail \"IR program body must be an array\"))\n (unless (js-call body :every node-p)\n (fail \"IR program body must contain only IR nodes\"))\n (js-object :filename filename :body body))\n\n (defun node-p (value)\n (and value\n (= (js* \"typeof value\") \"object\")\n (node-kind-p (get value :kind))))\n\n (defun reference-node-p (value)\n (and value\n (= (js* \"typeof value\") \"object\")\n (reference-node-kind-p (get value :kind))))\n\n (defun make-node (kind span value children properties)\n (unless (node-kind-p kind)\n (fail (str \"unknown Eliscript IR node kind: \" kind)))\n (unless (js* \"Array.isArray(children)\")\n (fail \"IR node children must be an array\"))\n (unless (js-call children :every node-p)\n (fail \"IR node children must all be IR nodes\"))\n (let ((node\n (js-object\n :kind kind\n :span span\n :value value\n :children children)))\n (when properties\n (put node :properties properties))\n node))\n\n (defun program-filename (program)\n (get program :filename))\n\n (defun program-body (program)\n (get program :body))\n\n (defun ir-kind (node)\n (get node :kind))\n\n (defun ir-span (node)\n (get node :span))\n\n (defun ir-value (node)\n (get node :value))\n\n (defun ir-children (node)\n (get node :children))\n\n (defun ir-properties (node)\n (get node :properties))\n\n (defun ir-property (node name)\n (let ((properties (ir-properties node)))\n (and properties (get properties name))))\n\n (export\n ir-format\n ir-version\n node-kinds\n node-kind-p\n reference-node-kind-p\n node-p\n reference-node-p\n make-program\n make-node\n program-filename\n program-body\n ir-kind\n ir-span\n ir-value\n ir-children\n ir-properties\n ir-property\n serialize-program\n deserialize-program))\n"],"names":[],"mappings":";;;AACE,kBAAoB;AACpB,mBAAqB;AACrB,qBAAuB;AAEvB,mBACE,CAAS,mBAAkB,UACzB,CAAU,sBAAqB,sBAAqB,kBACnD,oBAAmB,gBAAe,wBAClC,wBAAuB,sBAAqB,kBAC5C,wBAAuB,qBAAoB,yBAC3C,uBAAsB,qBACtB,gBAAe,gBAAe,aAAY,WAC1C,iBAAgB,2BAA0B,6BAC1C,0BAAyB,0BAAyB,4BAClD,kBAAiB,uBACjB,oBAAmB,oBAAmB,kBACtC,gBAAe,iBAAgB,kBAAiB,eAChD,qBAAoB,qBAAoB,sBACxC,YAAW,oBAAmB,mBAAkB,cAChD,mBAAkB,QAAO,gBAAe,SACxC,iBAAgB,aAChB,kBAAiB,mBAAkB,iBAAgB,kBACnD,eAAc,oBAAmB,kBAAiB,SAClD,iBAAgB,UAAS,cAAa;AAE3C,aACE;AAEF,oBACE;AAEF,gBAAkB;AAClB,2BACE;AACF,0BACE;AACF,gBAAkB;AAClB,wBAA0B;AAC1B,+BACE;AACF,2BACE;AACF,mBACE;AAEF,sBACE,IAAK,eAAe;AAEtB,+BAA8B,OAAM,UAAS;SAC3C,EAAM;IACJ,oBAAM,CAAM,kBACT,YAAY,QAAK,gBAAM;IAC1B,yCAAQ,CAAG,CAAK,MAAK,cAAS,CAAK,UAAS,gBACzC,YAAY,QAAK,gBAAM;IAC1B,CAAS,UAAS,WAChB,CAAS;aACP,yCAAQ,CAAS,MAAK,YAAU,UAC7B,YAAY,QAAK,gBAAM;;WAC9B;KATmB,kBAAkB;;AAWzC,8BAA6B,OAAM,MAAK,QAAO;EAC7C,yCAAiB,mBAAmB,YACjC,YAAY,QAAK,eAAK;EACzB,oBAAM,CAAS,QAAO,OAAK,UACxB,YAAY,QAAK,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