eliscript 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -0
- package/bootstrap/README.md +26 -0
- package/bootstrap/backends/README.md +515 -0
- package/bootstrap/backends/async.eli +230 -0
- package/bootstrap/backends/binary.eli +173 -0
- package/bootstrap/backends/capabilities.eli +74 -0
- package/bootstrap/backends/elf.eli +246 -0
- package/bootstrap/backends/managed.eli +5976 -0
- package/bootstrap/backends/memory.eli +100 -0
- package/bootstrap/backends/native.eli +2000 -0
- package/bootstrap/backends/numeric.eli +1362 -0
- package/bootstrap/backends/optimize.eli +79 -0
- package/bootstrap/backends/regexp.eli +2263 -0
- package/bootstrap/backends/sha256.eli +138 -0
- package/bootstrap/backends/wasm.eli +1161 -0
- package/bootstrap/compiler/analyzer.eli +165 -77
- package/bootstrap/compiler/compiler.eli +43 -19
- package/bootstrap/compiler/emitter.eli +780 -170
- package/bootstrap/compiler/expander.eli +136 -45
- package/bootstrap/compiler/formatter.eli +8 -1
- package/bootstrap/compiler/ir.eli +148 -45
- package/bootstrap/compiler/lower.eli +29 -2
- package/bootstrap/compiler/project.eli +51 -21
- package/bootstrap/compiler/reader.eli +128 -36
- package/bootstrap/compiler/source-map.eli +46 -4
- package/bootstrap/compiler/symbol.eli +2 -1
- package/bootstrap/compiler/syntax.eli +47 -12
- package/bootstrap/compiler/transient-analysis.eli +40 -4
- package/bootstrap/host/check-cli-legacy.mjs +163 -0
- package/bootstrap/host/check-cli.mjs +59 -158
- package/bootstrap/host/check-cli.mjs.map +1 -0
- package/bootstrap/host/compiler-session.eli +1579 -0
- package/bootstrap/host/compiler-tools.eli +513 -0
- package/bootstrap/host/eliscript-cli.mjs +53 -33
- package/bootstrap/host/eliscript-cli.mjs.map +1 -0
- package/bootstrap/host/project-cli-legacy.mjs +295 -0
- package/bootstrap/host/project-cli.mjs +74 -289
- package/bootstrap/host/project-cli.mjs.map +1 -0
- package/bootstrap/host/project-legacy.mjs +1080 -0
- package/bootstrap/host/project.mjs +210 -1060
- package/bootstrap/host/project.mjs.map +1 -0
- package/bootstrap/runtime/UNICODE-LICENSE.txt +39 -0
- package/bootstrap/runtime/memory.eli +30379 -0
- package/browser/host.mjs +732 -11
- package/browser/worker.mjs +6 -3
- package/compiler/eliscript-analyzer.el +371 -4
- package/compiler/eliscript-cli.el +84 -1
- package/compiler/eliscript-emitter.el +1189 -256
- package/compiler/eliscript-expander.el +147 -10
- package/compiler/eliscript-ir-emitter.el +725 -208
- package/compiler/eliscript-lower.el +127 -1
- package/compiler/eliscript-portable.el +177 -51
- package/compiler/eliscript-project.el +20 -2
- package/compiler/eliscript-reader.el +141 -57
- package/compiler/eliscript-source-map.el +26 -12
- package/compiler/eliscript-transient-analysis.el +382 -19
- package/dist/backends/async.mjs +561 -0
- package/dist/backends/async.mjs.macro-origins.json +1 -0
- package/dist/backends/async.mjs.map +1 -0
- package/dist/backends/binary.mjs +381 -0
- package/dist/backends/binary.mjs.macro-origins.json +1 -0
- package/dist/backends/binary.mjs.map +1 -0
- package/dist/backends/capabilities.mjs +237 -0
- package/dist/backends/capabilities.mjs.macro-origins.json +1 -0
- package/dist/backends/capabilities.mjs.map +1 -0
- package/dist/backends/elf.mjs +540 -0
- package/dist/backends/elf.mjs.macro-origins.json +1 -0
- package/dist/backends/elf.mjs.map +1 -0
- package/dist/backends/managed.mjs +10616 -0
- package/dist/backends/managed.mjs.macro-origins.json +1 -0
- package/dist/backends/managed.mjs.map +1 -0
- package/dist/backends/memory.mjs +278 -0
- package/dist/backends/memory.mjs.macro-origins.json +1 -0
- package/dist/backends/memory.mjs.map +1 -0
- package/dist/backends/native.mjs +4099 -0
- package/dist/backends/native.mjs.macro-origins.json +1 -0
- package/dist/backends/native.mjs.map +1 -0
- package/dist/backends/numeric.mjs +2458 -0
- package/dist/backends/numeric.mjs.macro-origins.json +1 -0
- package/dist/backends/numeric.mjs.map +1 -0
- package/dist/backends/optimize.mjs +204 -0
- package/dist/backends/optimize.mjs.macro-origins.json +1 -0
- package/dist/backends/optimize.mjs.map +1 -0
- package/dist/backends/regexp.mjs +2033 -0
- package/dist/backends/regexp.mjs.macro-origins.json +1 -0
- package/dist/backends/regexp.mjs.map +1 -0
- package/dist/backends/sha256.mjs +310 -0
- package/dist/backends/sha256.mjs.macro-origins.json +1 -0
- package/dist/backends/sha256.mjs.map +1 -0
- package/dist/backends/wasm.mjs +2258 -0
- package/dist/backends/wasm.mjs.macro-origins.json +1 -0
- package/dist/backends/wasm.mjs.map +1 -0
- package/dist/bootstrap/analyzer.mjs +1908 -776
- package/dist/bootstrap/analyzer.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +450 -142
- package/dist/bootstrap/compiler.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +3083 -909
- package/dist/bootstrap/emitter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +2887 -1233
- package/dist/bootstrap/expander.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/formatter.mjs +582 -218
- package/dist/bootstrap/formatter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/formatter.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +670 -116
- package/dist/bootstrap/ir.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/lower.mjs +866 -257
- package/dist/bootstrap/lower.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/lower.mjs.map +1 -1
- package/dist/bootstrap/package.json +1 -0
- package/dist/bootstrap/project.mjs +1168 -498
- package/dist/bootstrap/project.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +674 -175
- package/dist/bootstrap/reader.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/runtime/math.mjs +1117 -0
- package/dist/bootstrap/runtime/math.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs +10125 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case.mjs +281 -0
- package/dist/bootstrap/runtime/unicode-case.mjs.map +1 -0
- package/dist/bootstrap/source-map.mjs +430 -119
- package/dist/bootstrap/source-map.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/symbol.mjs +229 -53
- package/dist/bootstrap/symbol.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/symbol.mjs.map +1 -1
- package/dist/bootstrap/syntax.mjs +205 -7
- package/dist/bootstrap/syntax.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/syntax.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +1185 -489
- package/dist/bootstrap/transient-analysis.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +199 -6478
- package/dist/browser/host.mjs +1078 -0
- package/dist/browser/loader.js +1 -0
- package/dist/browser/loader.mjs +231 -0
- package/dist/browser/worker.mjs +63 -0
- package/dist/compiler-artifact.json +1 -0
- package/dist/host/compiler-session.mjs +2980 -0
- package/dist/host/compiler-session.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-session.mjs.map +1 -0
- package/dist/host/compiler-tools.mjs +1084 -0
- package/dist/host/compiler-tools.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-tools.mjs.map +1 -0
- package/dist/literal-sources/runtime/core/collection-internals.eli +60 -0
- package/dist/literal-sources/runtime/core/collection.eli +639 -0
- package/dist/literal-sources/runtime/core/data-text.eli +290 -0
- package/dist/literal-sources/runtime/core/data.eli +22 -0
- package/dist/literal-sources/runtime/core/identifier.eli +44 -0
- package/dist/literal-sources/runtime/core/lazy-sequence.eli +131 -0
- package/dist/literal-sources/runtime/core/list.eli +19 -0
- package/dist/literal-sources/runtime/core/map.eli +9 -0
- package/dist/literal-sources/runtime/core/metadata-internals.eli +6 -0
- package/dist/literal-sources/runtime/core/metadata.eli +40 -0
- package/dist/literal-sources/runtime/core/object.eli +8 -0
- package/dist/literal-sources/runtime/core/order.eli +123 -0
- package/dist/literal-sources/runtime/core/persistent-kind.eli +28 -0
- package/dist/literal-sources/runtime/core/protocol-error.eli +32 -0
- package/dist/literal-sources/runtime/core/protocol.eli +28 -0
- package/dist/literal-sources/runtime/core/queue.eli +9 -0
- package/dist/literal-sources/runtime/core/record.eli +191 -0
- package/dist/literal-sources/runtime/core/regex.eli +158 -0
- package/dist/literal-sources/runtime/core/sequence.eli +305 -0
- package/dist/literal-sources/runtime/core/set-algebra.eli +28 -0
- package/dist/literal-sources/runtime/core/set.eli +9 -0
- package/dist/literal-sources/runtime/core/sorted.eli +408 -0
- package/dist/literal-sources/runtime/core/text.eli +14 -0
- package/dist/literal-sources/runtime/core/transducer.eli +268 -0
- package/dist/literal-sources/runtime/core/transient.eli +17 -0
- package/dist/literal-sources/runtime/core/truth.eli +4 -0
- package/dist/literal-sources/runtime/core/type.eli +232 -0
- package/dist/literal-sources/runtime/core/value-internals.eli +13 -0
- package/dist/literal-sources/runtime/core/value.eli +19 -0
- package/dist/literal-sources/runtime/core/vector.eli +25 -0
- package/dist/literal-sources/runtime/literals.eli +23 -0
- package/dist/literal-sources/runtime/testing/value.eli +6 -0
- package/dist/literal-sources/runtime/wire/http-rpc.eli +362 -0
- package/dist/literal-sources/runtime/wire/markdown.eli +275 -0
- package/dist/literal-sources/runtime/wire/schema.eli +193 -0
- package/dist/literal-sources/stdlib/bit.eli +36 -0
- package/dist/literal-sources/stdlib/core/data.eli +306 -0
- package/dist/literal-sources/stdlib/core/object.eli +89 -0
- package/dist/literal-sources/stdlib/core/protocol.eli +451 -0
- package/dist/literal-sources/stdlib/core/set.eli +312 -0
- package/dist/literal-sources/stdlib/core/text.eli +103 -0
- package/dist/literal-sources/stdlib/managed-literal-protocols.eli +494 -0
- package/dist/literal-sources/stdlib/managed-literals.eli +1469 -0
- package/dist/literal-sources/stdlib/managed-queue-state.eli +65 -0
- package/dist/literal-sources/stdlib/managed-sorted-state.eli +233 -0
- package/dist/literal-sources/stdlib/managed-transient-state.eli +348 -0
- package/dist/literal-sources/stdlib/managed-value-state.eli +153 -0
- package/dist/literal-sources/stdlib/managed-vector-view-state.eli +102 -0
- package/dist/literal-sources/stdlib/persistent-list.eli +145 -0
- package/dist/literal-sources/stdlib/persistent-map.eli +724 -0
- package/dist/literal-sources/stdlib/persistent-set.eli +236 -0
- package/dist/literal-sources/stdlib/persistent-vector.eli +359 -0
- package/dist/literal-sources/stdlib/value.eli +325 -0
- package/dist/package.json +10 -0
- package/dist/runtime/math.mjs +1116 -0
- package/dist/runtime/math.mjs.macro-origins.json +1 -0
- package/dist/runtime/math.mjs.map +1 -0
- package/dist/runtime/unicode-case-data.mjs +10124 -0
- package/dist/runtime/unicode-case-data.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/runtime/unicode-case.mjs +280 -0
- package/dist/runtime/unicode-case.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case.mjs.map +1 -0
- package/dist/runtime.eli +30379 -0
- package/dist/stage3-release.json +1 -0
- package/editor/README.md +1 -1
- package/editor/eliscript-mode.el +1 -1
- package/editor/eliscript-repl.el +1 -1
- package/package.json +106 -11
- package/platform/http.mjs +20 -0
- package/runtime/array-text.mjs +159 -0
- package/runtime/core/map-internals.mjs +27 -9
- package/runtime/core/object-impl.mjs +26 -17
- package/runtime/core/object-impl.mjs.map +1 -1
- package/runtime/core/protocol-impl.mjs +682 -255
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/protocol.mjs +4 -0
- package/runtime/core/record.mjs +23 -2
- package/runtime/core/regex.mjs +4 -0
- package/runtime/core/sorted.mjs +53 -0
- package/runtime/core/text-impl.mjs +167 -48
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/type.mjs +75 -3
- package/runtime/core/vector.mjs +6 -0
- package/runtime/math.eli +429 -0
- package/runtime/math.mjs +1116 -0
- package/runtime/math.mjs.map +1 -0
- package/runtime/number-radix.mjs +105 -0
- package/runtime/unicode-case-data.eli +29 -0
- package/runtime/unicode-case-data.mjs +10124 -0
- package/runtime/unicode-case-data.mjs.map +1 -0
- package/runtime/unicode-case.eli +100 -0
- package/runtime/unicode-case.mjs +280 -0
- package/runtime/unicode-case.mjs.map +1 -0
- package/runtime/wire/http-rpc.mjs +168 -0
- package/runtime/wire/markdown.mjs +196 -0
- package/runtime/wire/schema.mjs +109 -0
- package/stdlib/README.md +54 -0
- package/stdlib/core/protocol.eli +81 -17
- package/stdlib/core/seq.eli +1 -1
- package/stdlib/core/zipper.eli +172 -72
- package/stdlib/gepo.eli +12 -0
- package/stdlib/interop/js.eli +56 -15
- package/stdlib/managed-literal-protocols.eli +494 -0
- package/stdlib/managed-literals.eli +1469 -0
- package/stdlib/managed-protocol-error.eli +32 -0
- package/stdlib/managed-queue-state.eli +65 -0
- package/stdlib/managed-runtime-collection-internals.eli +60 -0
- package/stdlib/managed-runtime-collection.eli +639 -0
- package/stdlib/managed-runtime-data-text.eli +290 -0
- package/stdlib/managed-runtime-data.eli +22 -0
- package/stdlib/managed-runtime-identifier.eli +44 -0
- package/stdlib/managed-runtime-lazy-sequence.eli +131 -0
- package/stdlib/managed-runtime-list.eli +19 -0
- package/stdlib/managed-runtime-literals.eli +23 -0
- package/stdlib/managed-runtime-map.eli +9 -0
- package/stdlib/managed-runtime-metadata-internals.eli +6 -0
- package/stdlib/managed-runtime-metadata.eli +40 -0
- package/stdlib/managed-runtime-object.eli +8 -0
- package/stdlib/managed-runtime-order.eli +123 -0
- package/stdlib/managed-runtime-persistent-kind.eli +28 -0
- package/stdlib/managed-runtime-protocol.eli +28 -0
- package/stdlib/managed-runtime-queue.eli +9 -0
- package/stdlib/managed-runtime-record.eli +191 -0
- package/stdlib/managed-runtime-regex.eli +158 -0
- package/stdlib/managed-runtime-sequence.eli +305 -0
- package/stdlib/managed-runtime-set-algebra.eli +28 -0
- package/stdlib/managed-runtime-set.eli +9 -0
- package/stdlib/managed-runtime-sorted.eli +408 -0
- package/stdlib/managed-runtime-text.eli +14 -0
- package/stdlib/managed-runtime-transducer.eli +268 -0
- package/stdlib/managed-runtime-transient.eli +17 -0
- package/stdlib/managed-runtime-truth.eli +4 -0
- package/stdlib/managed-runtime-type.eli +232 -0
- package/stdlib/managed-runtime-value-internals.eli +13 -0
- package/stdlib/managed-runtime-value.eli +19 -0
- package/stdlib/managed-runtime-vector.eli +25 -0
- package/stdlib/managed-sorted-state.eli +233 -0
- package/stdlib/managed-testing-value.eli +6 -0
- package/stdlib/managed-transient-state.eli +348 -0
- package/stdlib/managed-value-state.eli +153 -0
- package/stdlib/managed-vector-view-state.eli +102 -0
- package/stdlib/managed-wire-http-rpc.eli +362 -0
- package/stdlib/managed-wire-markdown.eli +275 -0
- package/stdlib/managed-wire-schema.eli +193 -0
- package/stdlib/mdp.eli +7 -0
- package/stdlib/mds.eli +4 -0
- package/stdlib/persistent-vector.eli +23 -6
- package/tools/acceptance/check-legacy.mjs +687 -0
- package/tools/acceptance/check.eli +431 -0
- package/tools/acceptance/compile-evidence.el +49 -0
- package/tools/acceptance/finalize-legacy.mjs +498 -0
- package/tools/acceptance/finalize.eli +270 -0
- package/tools/backends/benchmark.mjs +175 -0
- package/tools/backends/build.mjs +135 -0
- package/tools/backends/compile.mjs +94 -0
- package/tools/backends/compiler-bootstrap.mjs +1001 -0
- package/tools/backends/compiler-browser.mjs +361 -0
- package/tools/backends/compiler-build.mjs +1628 -0
- package/tools/backends/compiler-cli-legacy.mjs +334 -0
- package/tools/backends/compiler-cli.mjs +29 -0
- package/tools/backends/compiler-corpus-bit.mjs +234 -0
- package/tools/backends/compiler-corpus-cli-adapters-legacy.mjs +362 -0
- package/tools/backends/compiler-corpus-cli-adapters.mjs +247 -0
- package/tools/backends/compiler-corpus-debugging.mjs +221 -0
- package/tools/backends/compiler-corpus-emitter.mjs +324 -0
- package/tools/backends/compiler-corpus-evaluation-adapters.mjs +65 -0
- package/tools/backends/compiler-corpus-execution-legacy.mjs +769 -0
- package/tools/backends/compiler-corpus-execution.mjs +3324 -0
- package/tools/backends/compiler-corpus-fuzz.mjs +229 -0
- package/tools/backends/compiler-corpus-generations.mjs +208 -0
- package/tools/backends/compiler-corpus-host-context-legacy.mjs +114 -0
- package/tools/backends/compiler-corpus-host-context.mjs +550 -0
- package/tools/backends/compiler-corpus-identity-host.mjs +553 -0
- package/tools/backends/compiler-corpus-identity-value-adapters-legacy.mjs +298 -0
- package/tools/backends/compiler-corpus-identity-value-adapters.mjs +69 -0
- package/tools/backends/compiler-corpus-isolated-exports.mjs +21 -0
- package/tools/backends/compiler-corpus-legacy.mjs +1155 -0
- package/tools/backends/compiler-corpus-literal-provider.mjs +282 -0
- package/tools/backends/compiler-corpus-managed-adapters-legacy.mjs +334 -0
- package/tools/backends/compiler-corpus-managed-adapters.mjs +937 -0
- package/tools/backends/compiler-corpus-managed-cases.mjs +179 -0
- package/tools/backends/compiler-corpus-managed-fixtures-legacy.mjs +879 -0
- package/tools/backends/compiler-corpus-managed-fixtures.mjs +1287 -0
- package/tools/backends/compiler-corpus-matchers.mjs +173 -0
- package/tools/backends/compiler-corpus-original-program.mjs +612 -0
- package/tools/backends/compiler-corpus-process.mjs +765 -0
- package/tools/backends/compiler-corpus-program-driver.mjs +306 -0
- package/tools/backends/compiler-corpus-project-adapters-legacy.mjs +497 -0
- package/tools/backends/compiler-corpus-project-adapters.mjs +340 -0
- package/tools/backends/compiler-corpus-project-entry-host.mjs +511 -0
- package/tools/backends/compiler-corpus-project-transport.mjs +151 -0
- package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1438 -0
- package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1456 -0
- package/tools/backends/compiler-corpus-raw-math-fixture.mjs +346 -0
- package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +523 -0
- package/tools/backends/compiler-corpus-reference-legacy.mjs +263 -0
- package/tools/backends/compiler-corpus-reference.mjs +241 -0
- package/tools/backends/compiler-corpus-runtime-adapters-legacy.mjs +843 -0
- package/tools/backends/compiler-corpus-runtime-adapters.mjs +663 -0
- package/tools/backends/compiler-corpus-source-archive.mjs +206 -0
- package/tools/backends/compiler-corpus-tools-artifact-adapters.mjs +410 -0
- package/tools/backends/compiler-corpus-tools-cli.mjs +363 -0
- package/tools/backends/compiler-corpus-tools-reference.mjs +264 -0
- package/tools/backends/compiler-corpus.mjs +2054 -0
- package/tools/backends/compiler-debug.mjs +142 -0
- package/tools/backends/compiler-matrix.mjs +1955 -0
- package/tools/backends/compiler-metadata.mjs +203 -0
- package/tools/backends/compiler-package-browser.mjs +120 -0
- package/tools/backends/compiler-package-legacy.mjs +654 -0
- package/tools/backends/compiler-package.mjs +464 -0
- package/tools/backends/compiler-project.mjs +126 -0
- package/tools/backends/compiler-session.mjs +843 -0
- package/tools/backends/compiler-sha256.mjs +152 -0
- package/tools/backends/compiler-unicode-profile-host.mjs +196 -0
- package/tools/backends/compiler-worker.mjs +573 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs +919 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -0
- package/tools/backends/dist/managed-ir-inventory.mjs +488 -0
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -0
- package/tools/backends/dist/record-grid.mjs +1256 -0
- package/tools/backends/dist/record-grid.mjs.map +1 -0
- package/tools/backends/dist/release-cli.mjs +462 -0
- package/tools/backends/dist/release-cli.mjs.map +1 -0
- package/tools/backends/dist/run-artifact.mjs +517 -0
- package/tools/backends/dist/run-artifact.mjs.map +1 -0
- package/tools/backends/eliscript/compiler-corpus-bit.eli +77 -0
- package/tools/backends/eliscript/compiler-corpus-debugging.eli +70 -0
- package/tools/backends/eliscript/compiler-corpus-project-entry-host.eli +256 -0
- package/tools/backends/managed-foreign-binding.mjs +497 -0
- package/tools/backends/managed-host-legacy.mjs +1181 -0
- package/tools/backends/managed-host-lifecycle.mjs +310 -0
- package/tools/backends/managed-host-object-provider.mjs +155 -0
- package/tools/backends/managed-host-object-realm.mjs +797 -0
- package/tools/backends/managed-host-proxy.mjs +71 -0
- package/tools/backends/managed-host-runtime.mjs +5868 -0
- package/tools/backends/managed-host.mjs +716 -0
- package/tools/backends/managed-module-graph-legacy.mjs +308 -0
- package/tools/backends/managed-module-graph.mjs +694 -0
- package/tools/backends/managed-runtime-host-legacy.mjs +195 -0
- package/tools/backends/managed-runtime.mjs +939 -0
- package/tools/backends/managed-source-view-legacy.mjs +332 -0
- package/tools/backends/managed-source-view.mjs +959 -0
- package/tools/backends/memory-runtime.mjs +100 -0
- package/tools/backends/native-benchmark.mjs +88 -0
- package/tools/backends/native-managed-runtime.mjs +677 -0
- package/tools/backends/native-memory.mjs +768 -0
- package/tools/backends/native-node-memory.mjs +142 -0
- package/tools/backends/native-node-runner.mjs +99 -0
- package/tools/backends/native-node-watchdog.mjs +19 -0
- package/tools/backends/native-node-worker.mjs +75 -0
- package/tools/backends/stage3-targets.mjs +493 -0
- package/tools/bootstrap-command.el +13 -0
- package/tools/bootstrap-runtime.el +101 -0
- package/tools/bootstrap-seed.el +55 -0
- package/tools/project/check-cli.eli +31 -0
- package/tools/project/project-cli.eli +42 -0
- package/tools/project/project.eli +122 -0
- package/tools/runtime/unicode-case-profiles.mjs +13 -0
- package/tools/runtime/unicode-case-runtime.el +57 -0
- package/tools/testing/source-debugging-corpus-host.eli +16 -0
- package/tools/testing/source-debugging.eli +139 -0
- package/tools/testing/stdlib-bit-corpus-host.eli +21 -0
- package/tools/testing/stdlib-bit-corpus-host.mjs +118 -0
- package/tools/testing/stdlib-bit.eli +104 -0
- package/tools/testing/stdlib-bit.mjs +255 -0
- package/bin/eliscript-bootstrap +0 -15
|
@@ -1,16 +1,155 @@
|
|
|
1
1
|
// Generated by Eliscript. Do not edit.
|
|
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
|
+
var __eliscript_tdz_ready_2;
|
|
10
|
+
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
|
+
var __eliscript_tdz_ready_3;
|
|
13
|
+
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
|
+
var __eliscript_tdz_ready_4;
|
|
16
|
+
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
|
+
var __eliscript_tdz_ready_5;
|
|
19
|
+
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
|
+
var __eliscript_tdz_ready_6;
|
|
22
|
+
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
|
+
import "eliscript/runtime/unicode-case.mjs";
|
|
25
|
+
import { c as __eliscript_at, d as __eliscript_at_direct } from "data:text/javascript;base64,dmFyIG09UmVmbGVjdC5hcHBseSx0dD1OdW1iZXIucHJvdG90eXBlLnZhbHVlT2Ysaj1OdW1iZXIucHJvdG90eXBlLnRvU3RyaW5nLFU9TnVtYmVyLG50PU9iamVjdC5jcmVhdGUsaD1CaWdJbnQsZXQ9RGF0YVZpZXcsb3Q9QXJyYXlCdWZmZXIsaXQ9RGF0YVZpZXcucHJvdG90eXB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Li51KT0+TChpLGYsU3QoYix1KSk7VChwLHB0LHt2YWx1ZToodSk9PnUgaW5zdGFuY2VvZiBpLGNvbmZpZ3VyYWJsZTohMH0pO2xldCByPXMoRSxwLFt2b2lkIDBdKTt1dChyLGZ0KG8pKTtsZXQgbD1hdChvKTtmb3IobGV0IHU9MDt1PGwubGVuZ3RoO3UrKylUKHIsbFt1XSxsdChvLGxbdV0pKTtyZXR1cm4gcn1yZXR1cm4gcyh0LG4sZSl9fWZ1bmN0aW9uIFJ0KHQsbil7bGV0IGU9dFtuXTtyZXR1cm4oLi4ubyk9PkwoZSx0LG8pfWZ1bmN0aW9uIEF0KHQsbiwuLi5lKXtsZXQgbz10W25dO3JldHVybiBMKG8sdCxlKX1leHBvcnR7UnQgYXMgYyxBdCBhcyBkfTs=";
|
|
2
26
|
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
|
+
};
|
|
3
117
|
|
|
4
118
|
import {read_string} from "./reader.mjs";
|
|
5
119
|
const formatter_format = "eliscript-formatter";
|
|
120
|
+
__eliscript_tdz_ready_0 = true;
|
|
6
121
|
const formatter_version = 1;
|
|
122
|
+
__eliscript_tdz_ready_1 = true;
|
|
7
123
|
const formatter_width = 88;
|
|
124
|
+
__eliscript_tdz_ready_2 = true;
|
|
8
125
|
const formatter_indent = 2;
|
|
9
|
-
|
|
126
|
+
__eliscript_tdz_ready_3 = true;
|
|
127
|
+
const formatter_fail = ((message, filename) => {
|
|
128
|
+
{
|
|
129
|
+
const __eliscript_value_1 = new (Error)(message);
|
|
130
|
+
{
|
|
131
|
+
let error = __eliscript_value_1;
|
|
132
|
+
{
|
|
133
|
+
const __eliscript_value_2 = ({"format": "eliscript-diagnostic", "version": 1, "code": "ELI-F0001", "severity": "error", "phase": "formatter", "message": message});
|
|
134
|
+
{
|
|
135
|
+
let diagnostic = __eliscript_value_2;
|
|
136
|
+
if (!!filename) {
|
|
137
|
+
((diagnostic)["location"] = ({"file": filename}));
|
|
138
|
+
}
|
|
139
|
+
((error)["eliscriptDiagnostic"] = diagnostic);
|
|
140
|
+
return ((__eliscript_value_3) => { throw __eliscript_value_3; })(error);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
__eliscript_tdz_ready_4 = true;
|
|
10
147
|
const declaration_heads = ["module", "defasync", "defconst", "defmacro", "defmethod", "defmulti", "defn", "defportable", "defprotocol", "defun", "defvar", "extend-category", "extend-default", "extend-type", "export-default"];
|
|
148
|
+
__eliscript_tdz_ready_5 = true;
|
|
11
149
|
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"];
|
|
150
|
+
__eliscript_tdz_ready_6 = true;
|
|
12
151
|
function formatter_error(message, filename) {
|
|
13
|
-
return
|
|
152
|
+
return (__eliscript_tdz_read_4())(message, filename);
|
|
14
153
|
}
|
|
15
154
|
function make_scan_state(source, filename) {
|
|
16
155
|
return ({"source": source, "filename": filename, "index": 0});
|
|
@@ -22,16 +161,20 @@ function peek_code_ahead(state, count) {
|
|
|
22
161
|
return ((state)["source"])["charCodeAt"](((state)["index"] + count));
|
|
23
162
|
}
|
|
24
163
|
function at_end_p(state) {
|
|
25
|
-
return ((state)["index"]
|
|
164
|
+
return __eliscript_numeric_relation(">=", (state)["index"], ((state)["source"])["length"]);
|
|
26
165
|
}
|
|
27
166
|
function advance(state) {
|
|
28
|
-
|
|
167
|
+
if ((!__eliscript_truthy(at_end_p(state)))) {
|
|
168
|
+
return ((state)["index"] = ((state)["index"] + 1));
|
|
169
|
+
} else {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
29
172
|
}
|
|
30
173
|
function whitespace_code_p(code) {
|
|
31
|
-
return ((
|
|
174
|
+
return ((code === 32) || (code === 9) || (code === 10) || (code === 13) || (code === 12));
|
|
32
175
|
}
|
|
33
176
|
function token_delimiter_code_p(code) {
|
|
34
|
-
return ((
|
|
177
|
+
return ((__eliscript_value_4) => (__eliscript_truthy(__eliscript_value_4) ? __eliscript_value_4 : ((__eliscript_value_5) => (__eliscript_truthy(__eliscript_value_5) ? __eliscript_value_5 : ((code === 40) || (code === 41) || (code === 91) || (code === 93) || (code === 123) || (code === 125) || (code === 34) || (code === 39) || (code === 44) || (code === 59) || (code === 96))))(whitespace_code_p(code))))((globalThis.Number)["isNaN"](code));
|
|
35
178
|
}
|
|
36
179
|
function token(kind, text) {
|
|
37
180
|
return ({"kind": kind, "text": text});
|
|
@@ -40,265 +183,486 @@ function collection_token(text, closing) {
|
|
|
40
183
|
return ({"kind": "open", "text": text, "closing": closing});
|
|
41
184
|
}
|
|
42
185
|
function read_string_token(state) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
186
|
+
{
|
|
187
|
+
const __eliscript_value_6 = (state)["index"];
|
|
188
|
+
const __eliscript_value_7 = false;
|
|
189
|
+
const __eliscript_value_8 = false;
|
|
190
|
+
{
|
|
191
|
+
let start = __eliscript_value_6;
|
|
192
|
+
let escaped = __eliscript_value_7;
|
|
193
|
+
let done = __eliscript_value_8;
|
|
194
|
+
advance(state);
|
|
195
|
+
while (((!__eliscript_truthy(done)) && (!__eliscript_truthy(at_end_p(state))))) {
|
|
196
|
+
{
|
|
197
|
+
const __eliscript_value_9 = peek_code(state);
|
|
198
|
+
{
|
|
199
|
+
let code = __eliscript_value_9;
|
|
200
|
+
advance(state);
|
|
201
|
+
if (__eliscript_truthy(escaped)) {
|
|
202
|
+
((escaped = false));
|
|
203
|
+
} else {
|
|
204
|
+
if ((code === 92)) {
|
|
205
|
+
((escaped = true));
|
|
206
|
+
} else {
|
|
207
|
+
if ((code === 34)) {
|
|
208
|
+
((done = true));
|
|
209
|
+
} else {
|
|
210
|
+
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
51
216
|
}
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
})((state)["index"], false, false);
|
|
217
|
+
return token("string", ((state)["source"])["slice"](start, (state)["index"]));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
56
220
|
}
|
|
57
221
|
function read_comment_token(state) {
|
|
58
|
-
|
|
59
|
-
(
|
|
60
|
-
|
|
222
|
+
{
|
|
223
|
+
const __eliscript_value_10 = (state)["index"];
|
|
224
|
+
{
|
|
225
|
+
let start = __eliscript_value_10;
|
|
226
|
+
while (((!__eliscript_truthy(at_end_p(state))) && (!(peek_code(state) === 10)) && (!(peek_code(state) === 13)))) {
|
|
61
227
|
advance(state);
|
|
62
228
|
}
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
})((state)["index"]);
|
|
229
|
+
return token("comment", (((state)["source"])["slice"](start, (state)["index"]))["replace"](/[ \t]+$/u, ""));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
67
232
|
}
|
|
68
233
|
function read_atom_token(state) {
|
|
69
|
-
|
|
70
|
-
(
|
|
71
|
-
|
|
234
|
+
{
|
|
235
|
+
const __eliscript_value_11 = (state)["index"];
|
|
236
|
+
{
|
|
237
|
+
let start = __eliscript_value_11;
|
|
238
|
+
while (((!__eliscript_truthy(at_end_p(state))) && (!__eliscript_truthy(token_delimiter_code_p(peek_code(state)))))) {
|
|
72
239
|
advance(state);
|
|
73
240
|
}
|
|
74
|
-
return
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
})((state)["index"]);
|
|
241
|
+
return token("atom", ((state)["source"])["slice"](start, (state)["index"]));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
78
244
|
}
|
|
79
245
|
function tokenize(source, filename) {
|
|
80
|
-
|
|
81
|
-
(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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)) ? (() => {
|
|
246
|
+
{
|
|
247
|
+
const __eliscript_value_12 = make_scan_state(source, filename);
|
|
248
|
+
const __eliscript_value_13 = [];
|
|
249
|
+
{
|
|
250
|
+
let state = __eliscript_value_12;
|
|
251
|
+
let tokens = __eliscript_value_13;
|
|
252
|
+
while ((!__eliscript_truthy(at_end_p(state)))) {
|
|
253
|
+
{
|
|
254
|
+
const __eliscript_value_14 = peek_code(state);
|
|
255
|
+
const __eliscript_value_15 = null;
|
|
256
|
+
{
|
|
257
|
+
let code = __eliscript_value_14;
|
|
258
|
+
let next = __eliscript_value_15;
|
|
259
|
+
if (__eliscript_truthy(whitespace_code_p(code))) {
|
|
112
260
|
advance(state);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
261
|
+
} else {
|
|
262
|
+
if ((code === 59)) {
|
|
263
|
+
(tokens)["push"](read_comment_token(state));
|
|
264
|
+
} else {
|
|
265
|
+
if ((code === 34)) {
|
|
266
|
+
(tokens)["push"](read_string_token(state));
|
|
267
|
+
} else {
|
|
268
|
+
if (((code === 35) && (peek_code_ahead(state, 1) === 123))) {
|
|
269
|
+
advance(state);
|
|
270
|
+
advance(state);
|
|
271
|
+
(tokens)["push"](collection_token("#{", "}"));
|
|
272
|
+
} else {
|
|
273
|
+
if (((code === 35) && (peek_code_ahead(state, 1) === 39))) {
|
|
274
|
+
advance(state);
|
|
275
|
+
advance(state);
|
|
276
|
+
(tokens)["push"](token("prefix", "#'"));
|
|
277
|
+
} else {
|
|
278
|
+
if ((code === 40)) {
|
|
279
|
+
advance(state);
|
|
280
|
+
(tokens)["push"](collection_token("(", ")"));
|
|
281
|
+
} else {
|
|
282
|
+
if ((code === 91)) {
|
|
283
|
+
advance(state);
|
|
284
|
+
(tokens)["push"](collection_token("[", "]"));
|
|
285
|
+
} else {
|
|
286
|
+
if ((code === 123)) {
|
|
287
|
+
advance(state);
|
|
288
|
+
(tokens)["push"](collection_token("{", "}"));
|
|
289
|
+
} else {
|
|
290
|
+
if (((code === 41) || (code === 93) || (code === 125))) {
|
|
291
|
+
((next = ((state)["source"])["charAt"]((state)["index"])));
|
|
292
|
+
advance(state);
|
|
293
|
+
(tokens)["push"](token("close", next));
|
|
294
|
+
} else {
|
|
295
|
+
if (((code === 39) || (code === 96))) {
|
|
296
|
+
((next = ((state)["source"])["charAt"]((state)["index"])));
|
|
297
|
+
advance(state);
|
|
298
|
+
(tokens)["push"](token("prefix", next));
|
|
299
|
+
} else {
|
|
300
|
+
if ((code === 44)) {
|
|
301
|
+
advance(state);
|
|
302
|
+
if ((peek_code(state) === 64)) {
|
|
303
|
+
advance(state);
|
|
304
|
+
(tokens)["push"](token("prefix", ",@"));
|
|
305
|
+
} else {
|
|
306
|
+
(tokens)["push"](token("prefix", ","));
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
309
|
+
{
|
|
310
|
+
const __eliscript_value_16 = read_atom_token(state);
|
|
311
|
+
{
|
|
312
|
+
let atom = __eliscript_value_16;
|
|
313
|
+
if ((((atom)["text"])["length"] === 0)) {
|
|
314
|
+
formatter_error("formatter tokenizer made no progress", filename);
|
|
315
|
+
}
|
|
316
|
+
(tokens)["push"](atom);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
120
332
|
}
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
})(make_scan_state(source, filename), []);
|
|
333
|
+
return tokens;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
125
336
|
}
|
|
126
337
|
function parse_node(tokens, cursor, filename) {
|
|
127
|
-
(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
338
|
+
if (__eliscript_numeric_relation(">=", (cursor)["index"], (tokens)["length"])) {
|
|
339
|
+
formatter_error("unexpected end of formatter token stream", filename);
|
|
340
|
+
}
|
|
341
|
+
{
|
|
342
|
+
let current = ((((tokens) ?? [])[(cursor)["index"]]) ?? null);
|
|
343
|
+
let kind = (current)["kind"];
|
|
344
|
+
((cursor)["index"] = ((cursor)["index"] + 1));
|
|
345
|
+
if (((kind === "atom") || (kind === "string") || (kind === "comment"))) {
|
|
346
|
+
return current;
|
|
347
|
+
} else {
|
|
348
|
+
if ((kind === "prefix")) {
|
|
349
|
+
{
|
|
350
|
+
const __eliscript_value_17 = [];
|
|
351
|
+
{
|
|
352
|
+
let children = __eliscript_value_17;
|
|
353
|
+
while ((__eliscript_numeric_relation("<", (cursor)["index"], (tokens)["length"]) && ((((((tokens) ?? [])[(cursor)["index"]]) ?? null))["kind"] === "comment"))) {
|
|
135
354
|
(children)["push"](((((tokens) ?? [])[(cursor)["index"]]) ?? null));
|
|
136
355
|
((cursor)["index"] = ((cursor)["index"] + 1));
|
|
137
356
|
}
|
|
138
|
-
|
|
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));
|
|
357
|
+
if (__eliscript_numeric_relation(">=", (cursor)["index"], (tokens)["length"])) {
|
|
358
|
+
formatter_error("reader prefix has no target", filename);
|
|
154
359
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
360
|
+
(children)["push"](parse_node(tokens, cursor, filename));
|
|
361
|
+
return ({"kind": "prefix", "text": (current)["text"], "children": children});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
if ((kind === "open")) {
|
|
366
|
+
{
|
|
367
|
+
const __eliscript_value_18 = [];
|
|
368
|
+
const __eliscript_value_19 = false;
|
|
369
|
+
{
|
|
370
|
+
let children = __eliscript_value_18;
|
|
371
|
+
let done = __eliscript_value_19;
|
|
372
|
+
while ((!__eliscript_truthy(done))) {
|
|
373
|
+
if (__eliscript_numeric_relation(">=", (cursor)["index"], (tokens)["length"])) {
|
|
374
|
+
formatter_error("collection has no closing delimiter", filename);
|
|
375
|
+
}
|
|
376
|
+
{
|
|
377
|
+
const __eliscript_value_20 = ((((tokens) ?? [])[(cursor)["index"]]) ?? null);
|
|
378
|
+
{
|
|
379
|
+
let next = __eliscript_value_20;
|
|
380
|
+
if (((next)["kind"] === "close")) {
|
|
381
|
+
if ((!((next)["text"] === (current)["closing"]))) {
|
|
382
|
+
formatter_error("mismatched collection delimiter", filename);
|
|
383
|
+
}
|
|
384
|
+
((cursor)["index"] = ((cursor)["index"] + 1));
|
|
385
|
+
((done = true));
|
|
386
|
+
} else {
|
|
387
|
+
(children)["push"](parse_node(tokens, cursor, filename));
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return ({"kind": "collection", "text": (current)["text"], "closing": (current)["closing"], "children": children});
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
} else {
|
|
396
|
+
return formatter_error("unexpected closing delimiter", filename);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
162
401
|
}
|
|
163
402
|
function concrete_tree(source, filename) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
})();
|
|
174
|
-
return ({"kind": "root", "children": children});
|
|
175
|
-
})();
|
|
176
|
-
})([]);
|
|
177
|
-
})(({"index": 0}));
|
|
178
|
-
})(tokenize(source, filename));
|
|
403
|
+
{
|
|
404
|
+
let tokens = tokenize(source, filename);
|
|
405
|
+
let cursor = ({"index": 0});
|
|
406
|
+
let children = [];
|
|
407
|
+
while (__eliscript_numeric_relation("<", (cursor)["index"], (tokens)["length"])) {
|
|
408
|
+
(children)["push"](parse_node(tokens, cursor, filename));
|
|
409
|
+
}
|
|
410
|
+
return ({"kind": "root", "children": children});
|
|
411
|
+
}
|
|
179
412
|
}
|
|
180
413
|
function flat_node(node) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
414
|
+
{
|
|
415
|
+
const __eliscript_value_21 = (node)["kind"];
|
|
416
|
+
{
|
|
417
|
+
let kind = __eliscript_value_21;
|
|
418
|
+
if (((kind === "atom") || (kind === "string"))) {
|
|
419
|
+
return (node)["text"];
|
|
420
|
+
} else {
|
|
421
|
+
if ((kind === "comment")) {
|
|
422
|
+
return null;
|
|
423
|
+
} else {
|
|
424
|
+
if ((kind === "prefix")) {
|
|
425
|
+
{
|
|
426
|
+
const __eliscript_value_22 = (node)["children"];
|
|
427
|
+
{
|
|
428
|
+
let children = __eliscript_value_22;
|
|
429
|
+
if ((!((children)["length"] === 1))) {
|
|
430
|
+
return null;
|
|
431
|
+
} else {
|
|
432
|
+
{
|
|
433
|
+
const __eliscript_value_23 = flat_node(((((children) ?? [])[0]) ?? null));
|
|
434
|
+
{
|
|
435
|
+
let child = __eliscript_value_23;
|
|
436
|
+
return ((__eliscript_value_24) => (__eliscript_truthy(__eliscript_value_24) ? (String((node)["text"]) + String(child)) : __eliscript_value_24))(child);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
} else {
|
|
443
|
+
if ((kind === "collection")) {
|
|
444
|
+
{
|
|
445
|
+
const __eliscript_value_25 = [];
|
|
446
|
+
const __eliscript_value_26 = (node)["children"];
|
|
447
|
+
const __eliscript_value_27 = 0;
|
|
448
|
+
const __eliscript_value_28 = true;
|
|
449
|
+
{
|
|
450
|
+
let pieces = __eliscript_value_25;
|
|
451
|
+
let children = __eliscript_value_26;
|
|
452
|
+
let index = __eliscript_value_27;
|
|
453
|
+
let possible = __eliscript_value_28;
|
|
454
|
+
while (__eliscript_truthy(((__eliscript_value_29) => (__eliscript_truthy(__eliscript_value_29) ? __eliscript_numeric_relation("<", index, (children)["length"]) : __eliscript_value_29))(possible))) {
|
|
455
|
+
{
|
|
456
|
+
const __eliscript_value_30 = flat_node(((((children) ?? [])[index]) ?? null));
|
|
457
|
+
{
|
|
458
|
+
let piece = __eliscript_value_30;
|
|
459
|
+
if (__eliscript_truthy(piece)) {
|
|
460
|
+
(pieces)["push"](piece);
|
|
461
|
+
} else {
|
|
462
|
+
((possible = false));
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
((index = (index + 1)));
|
|
467
|
+
}
|
|
468
|
+
return ((__eliscript_value_31) => (__eliscript_truthy(__eliscript_value_31) ? (String((node)["text"]) + String(__eliscript_at_direct(pieces, "join", " ")) + String((node)["closing"])) : __eliscript_value_31))(possible);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
} else {
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
193
475
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
})([], (node)["children"], 0, true) : null))));
|
|
198
|
-
})((node)["kind"]);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
199
479
|
}
|
|
200
480
|
function spaces(count) {
|
|
201
481
|
return (" ")["repeat"](count);
|
|
202
482
|
}
|
|
203
483
|
function list_leading_count(node) {
|
|
204
|
-
|
|
205
|
-
return
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
484
|
+
if ((!((node)["text"] === "("))) {
|
|
485
|
+
return 0;
|
|
486
|
+
} else {
|
|
487
|
+
{
|
|
488
|
+
const __eliscript_value_32 = (node)["children"];
|
|
489
|
+
{
|
|
490
|
+
let children = __eliscript_value_32;
|
|
491
|
+
if (((children)["length"] === 0)) {
|
|
492
|
+
return 0;
|
|
493
|
+
} else {
|
|
494
|
+
{
|
|
495
|
+
const __eliscript_value_33 = flat_node(((((children) ?? [])[0]) ?? null));
|
|
496
|
+
{
|
|
497
|
+
let head = __eliscript_value_33;
|
|
498
|
+
if (__eliscript_truthy(((__eliscript_value_34) => (__eliscript_truthy(__eliscript_value_34) ? ((__eliscript_tdz_read_5()))["includes"](head) : __eliscript_value_34))(head))) {
|
|
499
|
+
return 2;
|
|
500
|
+
} else {
|
|
501
|
+
if (__eliscript_truthy(((__eliscript_value_35) => (__eliscript_truthy(__eliscript_value_35) ? ((__eliscript_tdz_read_6()))["includes"](head) : __eliscript_value_35))(head))) {
|
|
502
|
+
return 2;
|
|
503
|
+
} else {
|
|
504
|
+
return 1;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
209
513
|
}
|
|
210
514
|
function append_inline_child(output, child, indent) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
})(flat_node(child));
|
|
515
|
+
{
|
|
516
|
+
let piece = flat_node(child);
|
|
517
|
+
let separator = (((output)["length"] === 1) ? "" : " ");
|
|
518
|
+
let candidate = ((__eliscript_value_36) => (__eliscript_truthy(__eliscript_value_36) ? (String(output) + String(separator) + String(piece)) : __eliscript_value_36))(piece);
|
|
519
|
+
return ((__eliscript_value_37) => (__eliscript_truthy(__eliscript_value_37) ? ((__eliscript_value_38) => (__eliscript_truthy(__eliscript_value_38) ? candidate : __eliscript_value_38))(__eliscript_numeric_relation("<=", (indent + (candidate)["length"]), (__eliscript_tdz_read_2()))) : __eliscript_value_37))(candidate);
|
|
520
|
+
}
|
|
218
521
|
}
|
|
219
522
|
function render_prefix(node, indent) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
523
|
+
{
|
|
524
|
+
const __eliscript_value_39 = (node)["children"];
|
|
525
|
+
{
|
|
526
|
+
let children = __eliscript_value_39;
|
|
527
|
+
if (((children)["length"] === 1)) {
|
|
528
|
+
return (String((node)["text"]) + String(render_node(((((children) ?? [])[0]) ?? null), (indent + ((node)["text"])["length"]))));
|
|
529
|
+
} else {
|
|
530
|
+
{
|
|
531
|
+
const __eliscript_value_40 = (node)["text"];
|
|
532
|
+
const __eliscript_value_41 = 0;
|
|
533
|
+
{
|
|
534
|
+
let output = __eliscript_value_40;
|
|
535
|
+
let index = __eliscript_value_41;
|
|
536
|
+
while (__eliscript_numeric_relation("<", index, (children)["length"])) {
|
|
537
|
+
((output = (String(output) + String("\n") + String(spaces((indent + (__eliscript_tdz_read_3())))) + String(render_node(((((children) ?? [])[index]) ?? null), (indent + (__eliscript_tdz_read_3())))))));
|
|
538
|
+
((index = (index + 1)));
|
|
539
|
+
}
|
|
540
|
+
return output;
|
|
541
|
+
}
|
|
226
542
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
})((node)["text"], 0));
|
|
231
|
-
})((node)["children"]);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
232
546
|
}
|
|
233
547
|
function render_collection(node, indent) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
548
|
+
{
|
|
549
|
+
let flat = flat_node(node);
|
|
550
|
+
let children = (node)["children"];
|
|
551
|
+
if (__eliscript_truthy(((__eliscript_value_42) => (__eliscript_truthy(__eliscript_value_42) ? __eliscript_numeric_relation("<=", (indent + (flat)["length"]), (__eliscript_tdz_read_2())) : __eliscript_value_42))(flat))) {
|
|
552
|
+
return flat;
|
|
553
|
+
} else {
|
|
554
|
+
{
|
|
555
|
+
const __eliscript_value_43 = (node)["text"];
|
|
556
|
+
const __eliscript_value_44 = 0;
|
|
557
|
+
const __eliscript_value_45 = list_leading_count(node);
|
|
558
|
+
const __eliscript_value_46 = false;
|
|
559
|
+
{
|
|
560
|
+
let output = __eliscript_value_43;
|
|
561
|
+
let index = __eliscript_value_44;
|
|
562
|
+
let inline_left = __eliscript_value_45;
|
|
563
|
+
let last_comment = __eliscript_value_46;
|
|
564
|
+
while ((__eliscript_numeric_relation(">", inline_left, 0) && __eliscript_numeric_relation("<", index, (children)["length"]))) {
|
|
565
|
+
{
|
|
566
|
+
const __eliscript_value_47 = append_inline_child(output, ((((children) ?? [])[index]) ?? null), indent);
|
|
567
|
+
{
|
|
568
|
+
let candidate = __eliscript_value_47;
|
|
569
|
+
if (__eliscript_truthy(candidate)) {
|
|
570
|
+
((output = candidate));
|
|
571
|
+
((index = (index + 1)));
|
|
572
|
+
((inline_left = __eliscript_numeric_decrement(inline_left)));
|
|
573
|
+
} else {
|
|
574
|
+
((inline_left = 0));
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
246
578
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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));
|
|
579
|
+
while (__eliscript_numeric_relation("<", index, (children)["length"])) {
|
|
580
|
+
{
|
|
581
|
+
let child = ((((children) ?? [])[index]) ?? null);
|
|
582
|
+
let comment = ((child)["kind"] === "comment");
|
|
583
|
+
((output = (String(output) + String("\n") + String(spaces((indent + (__eliscript_tdz_read_3())))) + String(render_node(child, (indent + (__eliscript_tdz_read_3())))))));
|
|
584
|
+
((last_comment = comment));
|
|
585
|
+
}
|
|
259
586
|
((index = (index + 1)));
|
|
260
587
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
588
|
+
if (__eliscript_truthy(last_comment)) {
|
|
589
|
+
((output = (String(output) + String("\n") + String(spaces(indent)))));
|
|
590
|
+
}
|
|
591
|
+
return (String(output) + String((node)["closing"]));
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
268
596
|
}
|
|
269
597
|
function render_node(node, indent) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
598
|
+
{
|
|
599
|
+
const __eliscript_value_48 = (node)["kind"];
|
|
600
|
+
{
|
|
601
|
+
let kind = __eliscript_value_48;
|
|
602
|
+
if (((kind === "atom") || (kind === "string") || (kind === "comment"))) {
|
|
603
|
+
return (node)["text"];
|
|
604
|
+
} else {
|
|
605
|
+
if ((kind === "prefix")) {
|
|
606
|
+
return render_prefix(node, indent);
|
|
607
|
+
} else {
|
|
608
|
+
if ((kind === "collection")) {
|
|
609
|
+
return render_collection(node, indent);
|
|
610
|
+
} else {
|
|
611
|
+
return formatter_error("unsupported concrete syntax node", null);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
273
617
|
}
|
|
274
618
|
function render_root(root) {
|
|
275
|
-
|
|
276
|
-
(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
619
|
+
{
|
|
620
|
+
const __eliscript_value_49 = (root)["children"];
|
|
621
|
+
const __eliscript_value_50 = "";
|
|
622
|
+
const __eliscript_value_51 = 0;
|
|
623
|
+
const __eliscript_value_52 = false;
|
|
624
|
+
const __eliscript_value_53 = false;
|
|
625
|
+
{
|
|
626
|
+
let children = __eliscript_value_49;
|
|
627
|
+
let output = __eliscript_value_50;
|
|
628
|
+
let index = __eliscript_value_51;
|
|
629
|
+
let seen_form = __eliscript_value_52;
|
|
630
|
+
let previous_comment = __eliscript_value_53;
|
|
631
|
+
while (__eliscript_numeric_relation("<", index, (children)["length"])) {
|
|
632
|
+
{
|
|
633
|
+
let child = ((((children) ?? [])[index]) ?? null);
|
|
634
|
+
let comment = ((child)["kind"] === "comment");
|
|
635
|
+
if (__eliscript_numeric_relation(">", (output)["length"], 0)) {
|
|
636
|
+
((output = (String(output) + String((__eliscript_truthy(((__eliscript_value_54) => (__eliscript_truthy(__eliscript_value_54) ? ((!__eliscript_truthy(previous_comment)) && (!__eliscript_truthy(comment))) : __eliscript_value_54))(seen_form)) ? "\n\n" : "\n")))));
|
|
637
|
+
}
|
|
638
|
+
((output = (String(output) + String(render_node(child, 0)))));
|
|
639
|
+
if ((!__eliscript_truthy(comment))) {
|
|
640
|
+
((seen_form = true));
|
|
641
|
+
}
|
|
642
|
+
((previous_comment = comment));
|
|
643
|
+
}
|
|
288
644
|
((index = (index + 1)));
|
|
289
645
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
646
|
+
if (((output)["length"] === 0)) {
|
|
647
|
+
return "";
|
|
648
|
+
} else {
|
|
649
|
+
return (String(output) + String("\n"));
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}
|
|
294
653
|
}
|
|
295
654
|
function format_source(source, filename) {
|
|
296
|
-
(
|
|
655
|
+
if ((!(typeof source === "string"))) {
|
|
656
|
+
formatter_error("formatter source must be a string", filename);
|
|
657
|
+
}
|
|
297
658
|
read_string(source, filename);
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
659
|
+
{
|
|
660
|
+
const __eliscript_value_55 = render_root(concrete_tree(source, filename));
|
|
661
|
+
{
|
|
662
|
+
let formatted = __eliscript_value_55;
|
|
663
|
+
read_string(formatted, filename);
|
|
664
|
+
return formatted;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
302
667
|
}
|
|
303
668
|
export {formatter_format, formatter_version, formatter_width, formatter_indent, format_source};
|
|
304
|
-
//# sourceMappingURL=formatter.mjs.map
|