eliscript 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -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-legacy.mjs +37 -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 +89 -0
- 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 +446 -0
- package/dist/browser/loader.js +1 -0
- package/dist/browser/loader.mjs +231 -0
- package/dist/browser/worker.mjs +60 -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 +579 -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 +23 -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 +20 -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 +483 -0
- package/dist/literal-sources/stdlib/managed-literals.eli +1414 -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 +97 -10
- 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 +114 -47
- package/stdlib/gepo.eli +12 -0
- package/stdlib/interop/js.eli +56 -15
- package/stdlib/managed-literal-protocols.eli +483 -0
- package/stdlib/managed-literals.eli +1414 -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 +579 -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 +23 -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 +20 -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 +460 -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 +486 -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
|
@@ -0,0 +1,1084 @@
|
|
|
1
|
+
// Generated by Eliscript. Do not edit.
|
|
2
|
+
import "eliscript/runtime/unicode-case.mjs";
|
|
3
|
+
import { c as __eliscript_at, d as __eliscript_at_direct } from "data:text/javascript;base64,dmFyIG09UmVmbGVjdC5hcHBseSx0dD1OdW1iZXIucHJvdG90eXBlLnZhbHVlT2Ysaj1OdW1iZXIucHJvdG90eXBlLnRvU3RyaW5nLFU9TnVtYmVyLG50PU9iamVjdC5jcmVhdGUsaD1CaWdJbnQsZXQ9RGF0YVZpZXcsb3Q9QXJyYXlCdWZmZXIsaXQ9RGF0YVZpZXcucHJvdG90eXBlLnNldEZsb2F0NjQsSj1EYXRhVmlldy5wcm90b3R5cGUuZ2V0VWludDMyLHJ0PVJhbmdlRXJyb3I7ZnVuY3Rpb24gY3QodCxuKXtsZXQgZT1oKG4pLG89aCh0KSxpPSIiO2lmKG88MG4pbz0tbztkb3tsZXQgZj1vJWU7aT0iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltVKGYpXStpLG8vPWV9d2hpbGUobyE9PTBuKTtyZXR1cm4gdDwwPyItIitpOml9ZnVuY3Rpb24gc3QodCxuKXtsZXQgZT1uZXcgZXQobmV3IG90KDgpKTttKGl0LGUsWzAsdCwhMV0pO2xldCBvPW0oSixlLFswLCExXSksaT1tKEosZSxbNCwhMV0pLGY9bz4+PjIwJjIwNDcsYj1vJjEwNDg1NzUscD1vPj4+MzEscj1oKGIpPDwzMm58aChpKTtpZihmIT09MClyKz0xbjw8NTJuO3I8PD0ybjtsZXQgbD00bix1PWY+MSYmYj09PTAmJmk9PT0wPzFuOjJuLGs9Mm47aWYoZj49MTA3NSl7bGV0IGM9aChmLTEwNzUpO3I8PD1jLHU8PD1jLGs8PD1jfWVsc2UgbDw8PWgoZj09PTA/MTA3NDoxMDc1LWYpO2xldCBkPWgobiksZz1udChudWxsKSxhPTAsUz0wLEQ9MDtpZihyPGwpd2hpbGUocjxsKXtpZihyKjJuPmwmJnIraz5sKWJyZWFrO3IqPWQsdSo9ZCxrKj1kLFMtLX1lbHNlIHdoaWxlKHI+PWwqZClsKj1kLFMrKztmb3IoOzspe2xldCBjPVUoci9sKTtyJT1sO2xldCBJPXI8dSx4PXIraz5sO2dbYSsrXT1jLEQ9RCoobiYxKStjJjE7bGV0IHE9cioybixQPXE+bHx8cT09PWwmJkQ9PT0xO2lmKFAmJnh8fCFQJiZJKXtpZihQKXtsZXQgUj1hLEI9ITA7d2hpbGUoUj4wJiZCKXtSLS07bGV0IEg9Z1tSXSsxO2lmKEg9PT1uKWdbUl09MDtlbHNlIGdbUl09SCxCPSExfWlmKEIpZ1swXT0xLFMrK31icmVha31pZihhPj02NCl0aHJvdyBuZXcgcnQoIm51bWJlciByYWRpeCBmb3JtYXR0aW5nIGRpZCBub3QgY29udmVyZ2UiKTtyKj1kLHUqPWQsayo9ZH13aGlsZShhPjEmJmdbYS0xXT09PTApYS0tO2xldCB3PSIiO2lmKFM8MCl7dz0iMC4iO2ZvcihsZXQgYz0wO2M8LTEtUztjKyspdys9IjAiO2ZvcihsZXQgYz0wO2M8YTtjKyspdys9IjAxMjM0NTY3ODlhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5eiJbZ1tjXV19ZWxzZXtsZXQgYz1TKzEsST1jPmE/YzphO2ZvcihsZXQgeD0wO3g8STt4Kyspe2lmKHg9PT1jJiZjPGEpdys9Ii4iO3crPXg8YT8iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltnW3hdXToiMCJ9fXJldHVybiBwPyItIit3Ond9ZnVuY3Rpb24gRyh0LG4pe2xldCBlO3RyeXtlPW0odHQsdCxbXSl9Y2F0Y2h7cmV0dXJuIG0oaix0LFtuXSl9bGV0IG89MTA7aWYobiE9PXZvaWQgMCl7bGV0IGk9K247aWYobz1pIT09aT8wOmktaSUxLG88Mnx8bz4zNnx8byE9PW8pcmV0dXJuIG0oaixlLFtvXSl9aWYobz09PTEwfHxlPT09MHx8ZSE9PWV8fGU9PT0xLzB8fGU9PT0tMS8wKXJldHVybiBtKGosZSxbMTBdKTtyZXR1cm4gZSUxPT09MD9jdChlLG8pOnN0KGUsbyl9dmFyIHM9UmVmbGVjdC5hcHBseSxNPUZ1bmN0aW9uLnByb3RvdHlwZS5jYWxsLE49RnVuY3Rpb24ucHJvdG90eXBlLmFwcGx5LEU9RnVuY3Rpb24ucHJvdG90eXBlLmJpbmQsVD1PYmplY3QuZGVmaW5lUHJvcGVydHksbHQ9T2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcixmdD1PYmplY3QuZ2V0UHJvdG90eXBlT2YsdXQ9T2JqZWN0LnNldFByb3RvdHlwZU9mLGF0PVJlZmxlY3Qub3duS2V5cyxwdD1TeW1ib2wuaGFzSW5zdGFuY2UsVj1BcnJheS5pc0FycmF5LEs9QXJyYXkucHJvdG90eXBlLmpvaW4sej1BcnJheS5wcm90b3R5cGUudG9TdHJpbmcseXQ9T2JqZWN0LnByb3RvdHlwZS50b1N0cmluZyxidD1TdHJpbmcsQz1UeXBlRXJyb3IsZHQ9U3ltYm9sLnRvUHJpbWl0aXZlLGd0PVdlYWtTZXQucHJvdG90eXBlLmhhcyx3dD1XZWFrU2V0LnByb3RvdHlwZS5hZGQseHQ9V2Vha1NldC5wcm90b3R5cGUuZGVsZXRlLEY9bmV3IFdlYWtTZXQsTz1udWxsLFc9KHQpPT50IT09bnVsbCYmKHR5cGVvZiB0PT09Im9iamVjdCJ8fHR5cGVvZiB0PT09ImZ1bmN0aW9uInx8dHlwZW9mIHQ+InUiJiZ0IT09dm9pZCAwKSxBPSh0KT0+dHlwZW9mIHQ9PT0iZnVuY3Rpb24ifHx0eXBlb2YgdD4idSImJnQhPT12b2lkIDA7ZnVuY3Rpb24gaHQoKXtsZXQgbj1uZXcgQygiY3ljbGljIGFycmF5IHRleHQgY29udmVyc2lvbiIpO3Rocm93IG4uZWxpc2NyaXB0RGlhZ25vc3RpYz17Zm9ybWF0OiJlbGlzY3JpcHQtZGlhZ25vc3RpYyIsdmVyc2lvbjoxLGNvZGU6IkVMSS1SVDAwMDkiLHNldmVyaXR5OiJlcnJvciIscGhhc2U6InJ1bnRpbWUiLG1lc3NhZ2U6ImN5Y2xpYyBhcnJheSB0ZXh0IGNvbnZlcnNpb24ifSxufWZ1bmN0aW9uIG10KHQpe2lmKCFXKHQpKXJldHVybiB0O2xldCBuPXRbZHRdO2lmKG4hPT12b2lkIDAmJm4hPT1udWxsKXtsZXQgZT1zKG4sdCxbInN0cmluZyJdKTtpZighVyhlKSlyZXR1cm4gZTt0aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZSIpfWZvcihsZXQgZT0wO2U8MjtlKyspe2xldCBvPXRbZT09PTA/InRvU3RyaW5nIjoidmFsdWVPZiJdO2lmKEEobykpe2xldCBpPW89PT16JiZWKHQpP3YodCk6cyhvLHQsW10pO2lmKCFXKGkpKXJldHVybiBpfX10aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZSIpfWZ1bmN0aW9uIFEodCl7bGV0IG49bXQodCk7aWYodHlwZW9mIG49PT0ic3ltYm9sIil0aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgYSBTeW1ib2wgdmFsdWUgdG8gYSBzdHJpbmciKTtyZXR1cm4gYnQobil9ZnVuY3Rpb24gXyh0LG4pe2xldCBlPSt0Lmxlbmd0aCxvPWUhPT1lfHxlPD0wPzA6ZT49OTAwNzE5OTI1NDc0MDk5MT85MDA3MTk5MjU0NzQwOTkxOmUtZSUxLGk9bj09PXZvaWQgMD8iLCI6UShuKSxmPU89PT1udWxsO2lmKGYpTz10O2Vsc2V7aWYodD09PU98fHMoZ3QsRixbdF0pKWh0KCk7cyh3dCxGLFt0XSl9dHJ5e2xldCBiPSIiO2ZvcihsZXQgcD0wO3A8bztwKyspe2lmKHApYis9aTtsZXQgcj10W3BdO2lmKHIhPT1udWxsJiZyIT09dm9pZCAwKWIrPVEocil9cmV0dXJuIGJ9ZmluYWxseXtpZihmKU89bnVsbDtlbHNlIHMoeHQsRixbdF0pfX1mdW5jdGlvbiB2KHQpe2xldCBuPXQuam9pbjtyZXR1cm4gQShuKT9uPT09Sz9fKHQsdm9pZCAwKTpzKG4sdCxbXSk6cyh5dCx0LFtdKX1mdW5jdGlvbiB5KHQsbil7cmV0dXJuIG48dC5sZW5ndGg/dFtuXTp2b2lkIDB9ZnVuY3Rpb24gWCh0LG4pe2xldCBlPVtdO2ZvcihsZXQgbz1uO288dC5sZW5ndGg7bysrKVQoZSxlLmxlbmd0aCx7dmFsdWU6dFtvXSx3cml0YWJsZTohMCxlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMH0pO3JldHVybiBlfWZ1bmN0aW9uIFN0KHQsbil7bGV0IGU9W107Zm9yKGxldCBvPTA7bzx0Lmxlbmd0aCtuLmxlbmd0aDtvKyspVChlLG8se3ZhbHVlOm88dC5sZW5ndGg/dFtvXTpuW28tdC5sZW5ndGhdLHdyaXRhYmxlOiEwLGVudW1lcmFibGU6ITAsY29uZmlndXJhYmxlOiEwfSk7cmV0dXJuIGV9ZnVuY3Rpb24gWSguLi50KXtyZXR1cm4gdH1mdW5jdGlvbiBaKHQsbil7cmV0dXJuIG4/cyhOLFksW3ZvaWQgMCx0XSk6cyhZLHZvaWQgMCx0KX1mdW5jdGlvbiBMKHQsbixlKXtmb3IoOzspe2lmKHQ9PT1qKXJldHVybiBHKG4seShlLDApKTtpZih0PT09SyYmVihuKSlyZXR1cm4gXyhuLHkoZSwwKSk7aWYodD09PXomJlYobikpcmV0dXJuIHYobik7aWYodD09PU0pe2lmKCFBKG4pKXJldHVybiBzKHQsbixlKTtsZXQgbz1uLGk9eShlLDApO2U9WChlLDEpLHQ9byxuPWk7Y29udGludWV9aWYodD09PU4pe2lmKCFBKG4pKXJldHVybiBzKHQsbixlKTtsZXQgbz1uLGk9eShlLDApO2U9Wih5KGUsMSksITApLHQ9byxuPWk7Y29udGludWV9aWYodD09PXMpe2xldCBvPXkoZSwwKSxpPXkoZSwxKTtpZighQShvKSlyZXR1cm4gcyh0LG4sZSk7ZT1aKHkoZSwyKSwhMSksdD1vLG49aTtjb250aW51ZX1pZih0PT09RSl7bGV0IG89cyh0LG4sZSk7aWYobiE9PWomJm4hPT1LJiZuIT09eiYmbiE9PU0mJm4hPT1OJiZuIT09cyYmbiE9PUUpcmV0dXJuIG87bGV0IGk9bixmPXkoZSwwKSxiPVgoZSwxKSxwPSguLi51KT0+TChpLGYsU3QoYix1KSk7VChwLHB0LHt2YWx1ZToodSk9PnUgaW5zdGFuY2VvZiBpLGNvbmZpZ3VyYWJsZTohMH0pO2xldCByPXMoRSxwLFt2b2lkIDBdKTt1dChyLGZ0KG8pKTtsZXQgbD1hdChvKTtmb3IobGV0IHU9MDt1PGwubGVuZ3RoO3UrKylUKHIsbFt1XSxsdChvLGxbdV0pKTtyZXR1cm4gcn1yZXR1cm4gcyh0LG4sZSl9fWZ1bmN0aW9uIFJ0KHQsbil7bGV0IGU9dFtuXTtyZXR1cm4oLi4ubyk9PkwoZSx0LG8pfWZ1bmN0aW9uIEF0KHQsbiwuLi5lKXtsZXQgbz10W25dO3JldHVybiBMKG8sdCxlKX1leHBvcnR7UnQgYXMgYyxBdCBhcyBkfTs=";
|
|
4
|
+
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
5
|
+
const __eliscript_number_intrinsic = globalThis.Number;
|
|
6
|
+
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
7
|
+
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
8
|
+
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
9
|
+
const __eliscript_numeric_error = globalThis.TypeError;
|
|
10
|
+
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
11
|
+
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
12
|
+
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
13
|
+
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
14
|
+
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
15
|
+
const __eliscript_numeric_primitive = (value) => {
|
|
16
|
+
if (!__eliscript_numeric_object(value)) return value;
|
|
17
|
+
const exotic = value[__eliscript_numeric_symbol];
|
|
18
|
+
if (exotic !== void 0 && exotic !== null) {
|
|
19
|
+
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
20
|
+
if (!__eliscript_numeric_object(result)) return result;
|
|
21
|
+
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
22
|
+
}
|
|
23
|
+
for (let index = 0; index < 2; index++) {
|
|
24
|
+
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
25
|
+
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
26
|
+
const result = __eliscript_numeric_apply(method, value, []);
|
|
27
|
+
if (!__eliscript_numeric_object(result)) return result;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
31
|
+
};
|
|
32
|
+
const __eliscript_to_number = (value) => {
|
|
33
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
34
|
+
if (typeof primitive === "string") {
|
|
35
|
+
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
36
|
+
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
37
|
+
let first = 2;
|
|
38
|
+
while (first < text.length && text[first] === "0") first++;
|
|
39
|
+
if (first === text.length) return 0;
|
|
40
|
+
const prefix = text[1];
|
|
41
|
+
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
42
|
+
if (text.length - first > limit) return 1 / 0;
|
|
43
|
+
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
44
|
+
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return __eliscript_number_intrinsic(primitive);
|
|
48
|
+
};
|
|
49
|
+
const __eliscript_numeric = (value) => {
|
|
50
|
+
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
51
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
52
|
+
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
53
|
+
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
54
|
+
};
|
|
55
|
+
const __eliscript_implicit_number = (value) => {
|
|
56
|
+
if (typeof value === "number") return value;
|
|
57
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
58
|
+
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
59
|
+
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
60
|
+
};
|
|
61
|
+
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
62
|
+
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
63
|
+
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
64
|
+
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
65
|
+
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
66
|
+
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
67
|
+
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
68
|
+
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
69
|
+
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
70
|
+
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
71
|
+
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
72
|
+
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
73
|
+
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
74
|
+
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
75
|
+
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
76
|
+
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
77
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
78
|
+
if (operator === "<") return left < right;
|
|
79
|
+
if (operator === "<=") return left <= right;
|
|
80
|
+
if (operator === ">") return left > right;
|
|
81
|
+
return left >= right;
|
|
82
|
+
}
|
|
83
|
+
let a = __eliscript_numeric_primitive(left);
|
|
84
|
+
let b = __eliscript_numeric_primitive(right);
|
|
85
|
+
const x = typeof a, y = typeof b;
|
|
86
|
+
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
87
|
+
a = __eliscript_numeric(a);
|
|
88
|
+
b = __eliscript_numeric(b);
|
|
89
|
+
}
|
|
90
|
+
if (operator === "<") return a < b;
|
|
91
|
+
if (operator === "<=") return a <= b;
|
|
92
|
+
if (operator === ">") return a > b;
|
|
93
|
+
return a >= b;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
import {read_string} from "../bootstrap/reader.mjs";
|
|
97
|
+
import {expand_module_with_origins} from "../bootstrap/expander.mjs";
|
|
98
|
+
import {analyze_module} from "../bootstrap/analyzer.mjs";
|
|
99
|
+
import {lower_module} from "../bootstrap/lower.mjs";
|
|
100
|
+
import {sha256_string_utf16le} from "../backends/sha256.mjs";
|
|
101
|
+
function tools_fail(message, filename, code = null) {
|
|
102
|
+
{
|
|
103
|
+
const __eliscript_value_1 = new (Error)(message);
|
|
104
|
+
{
|
|
105
|
+
let error = __eliscript_value_1;
|
|
106
|
+
((error)["eliscriptDiagnostic"] = ({"format": "eliscript-diagnostic", "version": 1, "code": ((__eliscript_value_2) => (__eliscript_truthy(__eliscript_value_2) ? __eliscript_value_2 : "ELI-T0001"))(code), "severity": "error", "phase": "compiler-tools", "message": message, "location": ({"file": filename})}));
|
|
107
|
+
return ((__eliscript_value_3) => { throw __eliscript_value_3; })(error);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function tools_span_key(span) {
|
|
112
|
+
if (__eliscript_truthy(span)) {
|
|
113
|
+
return (String((span)["start"]) + String(":") + String((span)["end"]));
|
|
114
|
+
} else {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function tools_syntax_index(node, context) {
|
|
119
|
+
{
|
|
120
|
+
const __eliscript_value_4 = ((node)["span"] ?? null);
|
|
121
|
+
const __eliscript_value_5 = ((node)["kind"] ?? null);
|
|
122
|
+
{
|
|
123
|
+
let span = __eliscript_value_4;
|
|
124
|
+
let kind = __eliscript_value_5;
|
|
125
|
+
if (__eliscript_truthy(span)) {
|
|
126
|
+
((context)["syntax"])["set"](tools_span_key(span), node);
|
|
127
|
+
}
|
|
128
|
+
if (((kind === "list") || (kind === "vector"))) {
|
|
129
|
+
return ((node)["items"])["forEach"](((child) => {
|
|
130
|
+
return tools_syntax_index(child, context);
|
|
131
|
+
}));
|
|
132
|
+
} else {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function tools_symbol_span(node, name, context) {
|
|
139
|
+
{
|
|
140
|
+
let span = ((node)["span"] ?? null);
|
|
141
|
+
let original = ((__eliscript_value_6) => (__eliscript_truthy(__eliscript_value_6) ? ((context)["syntax"])["get"](tools_span_key(span)) : __eliscript_value_6))(span);
|
|
142
|
+
let kind = ((node)["kind"] ?? null);
|
|
143
|
+
if (__eliscript_truthy(original)) {
|
|
144
|
+
if ((((original)["kind"] === "symbol") && ((original)["name"] === name))) {
|
|
145
|
+
return (original)["span"];
|
|
146
|
+
} else {
|
|
147
|
+
if (((kind === "binding-name") && ((original)["kind"] === "symbol"))) {
|
|
148
|
+
{
|
|
149
|
+
let qualified = (original)["name"];
|
|
150
|
+
let slash = (qualified)["lastIndexOf"]("/");
|
|
151
|
+
if ((__eliscript_numeric_relation(">=", slash, 0) && ((qualified)["slice"]((slash + 1)) === name))) {
|
|
152
|
+
{
|
|
153
|
+
let prefix = tools_scalar_length((qualified)["slice"](0, (slash + 1)));
|
|
154
|
+
let original_span = (original)["span"];
|
|
155
|
+
return (globalThis.Object)["assign"](({}), original_span, ({"start": ((original_span)["start"] + prefix), "column": ((original_span)["column"] + prefix)}));
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
if (((original)["kind"] === "list")) {
|
|
163
|
+
{
|
|
164
|
+
let items = (original)["items"];
|
|
165
|
+
let head = ((((items) ?? [])[0]) ?? null);
|
|
166
|
+
let operator = ((__eliscript_value_7) => (__eliscript_truthy(__eliscript_value_7) ? ((head)["name"] ?? null) : __eliscript_value_7))(head);
|
|
167
|
+
let declaration = ((__eliscript_value_8) => (__eliscript_truthy(__eliscript_value_8) ? __eliscript_value_8 : ((kind === "variable-declaration") && ((operator === "defconst") || (operator === "defvar")))))(((__eliscript_value_9) => (__eliscript_truthy(__eliscript_value_9) ? (["defun", "defn", "defportable", "defasync"])["includes"](operator) : __eliscript_value_9))((kind === "function-declaration")));
|
|
168
|
+
let candidate = (__eliscript_truthy(declaration) ? ((((items) ?? [])[1]) ?? null) : ((kind === "lexical-binding") ? head : null));
|
|
169
|
+
if (__eliscript_truthy(((__eliscript_value_10) => (__eliscript_truthy(__eliscript_value_10) ? (((candidate)["kind"] === "symbol") && ((candidate)["name"] === name)) : __eliscript_value_10))(candidate))) {
|
|
170
|
+
return (candidate)["span"];
|
|
171
|
+
} else {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function tools_origin(span, context) {
|
|
186
|
+
{
|
|
187
|
+
const __eliscript_value_11 = null;
|
|
188
|
+
{
|
|
189
|
+
let result = __eliscript_value_11;
|
|
190
|
+
if (__eliscript_truthy(span)) {
|
|
191
|
+
((context)["macroOrigins"])["forEach"](((origin) => {
|
|
192
|
+
if ((tools_span_key(span) === tools_span_key((origin)["span"]))) {
|
|
193
|
+
return ((result = origin));
|
|
194
|
+
} else {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
{
|
|
200
|
+
const __eliscript_value_12 = [];
|
|
201
|
+
{
|
|
202
|
+
let trace = __eliscript_value_12;
|
|
203
|
+
if (__eliscript_truthy(span)) {
|
|
204
|
+
((context)["macroExpansions"])["forEach"](((event) => {
|
|
205
|
+
if ((tools_span_key(span) === tools_span_key((event)["callSpan"]))) {
|
|
206
|
+
return (trace)["push"](event);
|
|
207
|
+
} else {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
if (__eliscript_numeric_relation(">", ((trace) ?? []).length, 0)) {
|
|
213
|
+
{
|
|
214
|
+
const __eliscript_value_13 = ((((trace) ?? [])[__eliscript_numeric_decrement(((trace) ?? []).length)]) ?? null);
|
|
215
|
+
{
|
|
216
|
+
let event = __eliscript_value_13;
|
|
217
|
+
((result = (globalThis.Object)["assign"](({}), ((__eliscript_value_14) => (__eliscript_truthy(__eliscript_value_14) ? __eliscript_value_14 : ({})))(result), ({"macroName": (event)["macroName"], "span": (event)["callSpan"], "definitionSpan": (event)["definitionSpan"], "trace": trace}))));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return result;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function tools_scope(parent) {
|
|
228
|
+
return ({"parent": parent, "names": new (globalThis.Map)()});
|
|
229
|
+
}
|
|
230
|
+
function tools_find(scope, name) {
|
|
231
|
+
{
|
|
232
|
+
const __eliscript_value_15 = scope;
|
|
233
|
+
const __eliscript_value_16 = null;
|
|
234
|
+
{
|
|
235
|
+
let current = __eliscript_value_15;
|
|
236
|
+
let binding = __eliscript_value_16;
|
|
237
|
+
while (__eliscript_truthy(((__eliscript_value_17) => (__eliscript_truthy(__eliscript_value_17) ? (binding == null) : __eliscript_value_17))(current))) {
|
|
238
|
+
((binding = ((current)["names"])["get"](name)));
|
|
239
|
+
((current = (current)["parent"]));
|
|
240
|
+
}
|
|
241
|
+
return binding;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function tools_declare(node, scope, kind, context) {
|
|
246
|
+
{
|
|
247
|
+
let name = (node)["value"];
|
|
248
|
+
let span = tools_symbol_span(node, name, context);
|
|
249
|
+
let definition = ({"id": (String("binding-") + String((((context)["definitions"]) ?? []).length)), "name": name, "kind": kind, "span": span, "expandedSpan": ((node)["span"] ?? null), "generated": (span === null), "macroOrigin": tools_origin(((node)["span"] ?? null), context)});
|
|
250
|
+
((scope)["names"])["set"](name, definition);
|
|
251
|
+
((context)["definitions"])["push"](definition);
|
|
252
|
+
return definition;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function tools_reference(node, scope, role, context) {
|
|
256
|
+
{
|
|
257
|
+
let name = (node)["value"];
|
|
258
|
+
let binding = tools_find(scope, name);
|
|
259
|
+
let span = tools_symbol_span(node, name, context);
|
|
260
|
+
return ((context)["references"])["push"](({"name": name, "role": role, "span": span, "expandedSpan": ((node)["span"] ?? null), "generated": (span === null), "bindingId": (__eliscript_truthy(binding) ? (binding)["id"] : null), "definitionSpan": (__eliscript_truthy(binding) ? (binding)["span"] : null), "macroOrigin": tools_origin(((node)["span"] ?? null), context)}));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function tools_pattern_defaults(node, scope, context) {
|
|
264
|
+
{
|
|
265
|
+
const __eliscript_value_18 = (node)["kind"];
|
|
266
|
+
const __eliscript_value_19 = (node)["children"];
|
|
267
|
+
{
|
|
268
|
+
let kind = __eliscript_value_18;
|
|
269
|
+
let children = __eliscript_value_19;
|
|
270
|
+
if ((kind === "map-binding-entry")) {
|
|
271
|
+
if (__eliscript_numeric_relation(">", ((children) ?? []).length, 2)) {
|
|
272
|
+
tools_walk(((((children) ?? [])[2]) ?? null), scope, context);
|
|
273
|
+
}
|
|
274
|
+
return tools_pattern_defaults(((((children) ?? [])[0]) ?? null), scope, context);
|
|
275
|
+
} else {
|
|
276
|
+
if (((kind === "array-binding-pattern") || (kind === "map-binding-pattern"))) {
|
|
277
|
+
return (children)["forEach"](((child) => {
|
|
278
|
+
return tools_pattern_defaults(child, scope, context);
|
|
279
|
+
}));
|
|
280
|
+
} else {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function tools_pattern_declare(node, scope, kind, context) {
|
|
288
|
+
{
|
|
289
|
+
const __eliscript_value_20 = (node)["kind"];
|
|
290
|
+
const __eliscript_value_21 = (node)["children"];
|
|
291
|
+
{
|
|
292
|
+
let tag = __eliscript_value_20;
|
|
293
|
+
let children = __eliscript_value_21;
|
|
294
|
+
if ((tag === "binding-name")) {
|
|
295
|
+
return tools_declare(node, scope, kind, context);
|
|
296
|
+
} else {
|
|
297
|
+
if ((tag === "map-binding-entry")) {
|
|
298
|
+
return tools_pattern_declare(((((children) ?? [])[0]) ?? null), scope, kind, context);
|
|
299
|
+
} else {
|
|
300
|
+
if (((tag === "array-binding-pattern") || (tag === "map-binding-pattern"))) {
|
|
301
|
+
return (children)["forEach"](((child) => {
|
|
302
|
+
return tools_pattern_declare(child, scope, kind, context);
|
|
303
|
+
}));
|
|
304
|
+
} else {
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function tools_binding_defaults(node, scope, context) {
|
|
313
|
+
if (((node)["kind"] === "parameter-binding")) {
|
|
314
|
+
tools_binding_initializer(node, scope, context);
|
|
315
|
+
}
|
|
316
|
+
if (__eliscript_truthy(((((node)["properties"] ?? null))["pattern"] ?? false))) {
|
|
317
|
+
return tools_pattern_defaults((((((node)["children"]) ?? [])[0]) ?? null), scope, context);
|
|
318
|
+
} else {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function tools_binding_declare(node, scope, kind, context) {
|
|
323
|
+
if (__eliscript_truthy(((((node)["properties"] ?? null))["pattern"] ?? false))) {
|
|
324
|
+
return tools_pattern_declare((((((node)["children"]) ?? [])[0]) ?? null), scope, kind, context);
|
|
325
|
+
} else {
|
|
326
|
+
return tools_declare(node, scope, kind, context);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function tools_binding_initializer(node, scope, context) {
|
|
330
|
+
{
|
|
331
|
+
const __eliscript_value_22 = (node)["children"];
|
|
332
|
+
const __eliscript_value_23 = (__eliscript_truthy(((((node)["properties"] ?? null))["pattern"] ?? false)) ? 1 : 0);
|
|
333
|
+
{
|
|
334
|
+
let children = __eliscript_value_22;
|
|
335
|
+
let start = __eliscript_value_23;
|
|
336
|
+
while (__eliscript_numeric_relation("<", start, ((children) ?? []).length)) {
|
|
337
|
+
tools_walk(((((children) ?? [])[start]) ?? null), scope, context);
|
|
338
|
+
((start = (start + 1)));
|
|
339
|
+
}
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function tools_predeclare(nodes, scope, context) {
|
|
345
|
+
return (nodes)["forEach"](((node) => {
|
|
346
|
+
{
|
|
347
|
+
const __eliscript_value_24 = (node)["kind"];
|
|
348
|
+
{
|
|
349
|
+
let kind = __eliscript_value_24;
|
|
350
|
+
if ((kind === "module-declaration")) {
|
|
351
|
+
return tools_predeclare((node)["children"], scope, context);
|
|
352
|
+
} else {
|
|
353
|
+
if ((kind === "function-declaration")) {
|
|
354
|
+
return tools_declare(node, scope, "function", context);
|
|
355
|
+
} else {
|
|
356
|
+
if ((kind === "variable-declaration")) {
|
|
357
|
+
return tools_declare(node, scope, "variable", context);
|
|
358
|
+
} else {
|
|
359
|
+
if ((kind === "import-declaration")) {
|
|
360
|
+
return ((node)["children"])["forEach"](((child) => {
|
|
361
|
+
return tools_declare(child, scope, "import", context);
|
|
362
|
+
}));
|
|
363
|
+
} else {
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}));
|
|
372
|
+
}
|
|
373
|
+
function tools_function(node, scope, context) {
|
|
374
|
+
{
|
|
375
|
+
let children = (node)["children"];
|
|
376
|
+
let count = ((node)["properties"])["parameterCount"];
|
|
377
|
+
let child = tools_scope(scope);
|
|
378
|
+
let index = 0;
|
|
379
|
+
while (__eliscript_numeric_relation("<", index, count)) {
|
|
380
|
+
tools_binding_defaults(((((children) ?? [])[index]) ?? null), scope, context);
|
|
381
|
+
((index = (index + 1)));
|
|
382
|
+
}
|
|
383
|
+
((index = 0));
|
|
384
|
+
while (__eliscript_numeric_relation("<", index, count)) {
|
|
385
|
+
tools_binding_declare(((((children) ?? [])[index]) ?? null), child, "parameter", context);
|
|
386
|
+
((index = (index + 1)));
|
|
387
|
+
}
|
|
388
|
+
while (__eliscript_numeric_relation("<", index, ((children) ?? []).length)) {
|
|
389
|
+
tools_walk(((((children) ?? [])[index]) ?? null), child, context);
|
|
390
|
+
((index = (index + 1)));
|
|
391
|
+
}
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
function tools_let(node, scope, context) {
|
|
396
|
+
{
|
|
397
|
+
let children = (node)["children"];
|
|
398
|
+
let properties = (node)["properties"];
|
|
399
|
+
let count = (properties)["bindingCount"];
|
|
400
|
+
let sequential = ((properties)["sequential"] ?? false);
|
|
401
|
+
let child = tools_scope(scope);
|
|
402
|
+
let index = 0;
|
|
403
|
+
while (__eliscript_numeric_relation("<", index, count)) {
|
|
404
|
+
{
|
|
405
|
+
let binding = ((((children) ?? [])[index]) ?? null);
|
|
406
|
+
let initializer_scope = (__eliscript_truthy(sequential) ? child : scope);
|
|
407
|
+
tools_binding_initializer(binding, initializer_scope, context);
|
|
408
|
+
tools_binding_defaults(binding, initializer_scope, context);
|
|
409
|
+
if (__eliscript_truthy(sequential)) {
|
|
410
|
+
tools_binding_declare(binding, child, "local", context);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
((index = (index + 1)));
|
|
414
|
+
}
|
|
415
|
+
if ((!__eliscript_truthy(sequential))) {
|
|
416
|
+
((index = 0));
|
|
417
|
+
while (__eliscript_numeric_relation("<", index, count)) {
|
|
418
|
+
tools_binding_declare(((((children) ?? [])[index]) ?? null), child, (((node)["kind"] === "binding-loop") ? "loop" : "local"), context);
|
|
419
|
+
((index = (index + 1)));
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
while (__eliscript_numeric_relation("<", index, ((children) ?? []).length)) {
|
|
423
|
+
tools_walk(((((children) ?? [])[index]) ?? null), child, context);
|
|
424
|
+
((index = (index + 1)));
|
|
425
|
+
}
|
|
426
|
+
return null;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
function tools_walk(node, scope, context) {
|
|
430
|
+
{
|
|
431
|
+
const __eliscript_value_25 = (node)["kind"];
|
|
432
|
+
const __eliscript_value_26 = (node)["children"];
|
|
433
|
+
{
|
|
434
|
+
let kind = __eliscript_value_25;
|
|
435
|
+
let children = __eliscript_value_26;
|
|
436
|
+
if ((kind === "reference")) {
|
|
437
|
+
return tools_reference(node, scope, "read", context);
|
|
438
|
+
} else {
|
|
439
|
+
if ((kind === "assignment-pair")) {
|
|
440
|
+
tools_reference(node, scope, "write", context);
|
|
441
|
+
return (children)["forEach"](((child) => {
|
|
442
|
+
return tools_walk(child, scope, context);
|
|
443
|
+
}));
|
|
444
|
+
} else {
|
|
445
|
+
if (((kind === "function-declaration") || (kind === "function-expression"))) {
|
|
446
|
+
return tools_function(node, scope, context);
|
|
447
|
+
} else {
|
|
448
|
+
if (((kind === "lexical-bindings") || (kind === "binding-loop"))) {
|
|
449
|
+
return tools_let(node, scope, context);
|
|
450
|
+
} else {
|
|
451
|
+
if ((kind === "catch-clause")) {
|
|
452
|
+
{
|
|
453
|
+
const __eliscript_value_27 = tools_scope(scope);
|
|
454
|
+
const __eliscript_value_28 = ((((children) ?? [])[0]) ?? null);
|
|
455
|
+
const __eliscript_value_29 = 1;
|
|
456
|
+
{
|
|
457
|
+
let child = __eliscript_value_27;
|
|
458
|
+
let binding = __eliscript_value_28;
|
|
459
|
+
let index = __eliscript_value_29;
|
|
460
|
+
tools_binding_defaults(binding, scope, context);
|
|
461
|
+
tools_binding_declare(binding, child, "catch", context);
|
|
462
|
+
while (__eliscript_numeric_relation("<", index, ((children) ?? []).length)) {
|
|
463
|
+
tools_walk(((((children) ?? [])[index]) ?? null), child, context);
|
|
464
|
+
((index = (index + 1)));
|
|
465
|
+
}
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
} else {
|
|
470
|
+
if (((kind === "quoted-literal") || (kind === "raw-javascript") || (kind === "import-declaration"))) {
|
|
471
|
+
return null;
|
|
472
|
+
} else {
|
|
473
|
+
return (children)["forEach"](((child) => {
|
|
474
|
+
return tools_walk(child, scope, context);
|
|
475
|
+
}));
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function tools_source_sequence(nodes, context) {
|
|
486
|
+
return (nodes)["forEach"](((node) => {
|
|
487
|
+
return tools_source_expression(node, context);
|
|
488
|
+
}));
|
|
489
|
+
}
|
|
490
|
+
function tools_source_binding_defaults(node, context) {
|
|
491
|
+
{
|
|
492
|
+
const __eliscript_value_30 = (node)["kind"];
|
|
493
|
+
{
|
|
494
|
+
let kind = __eliscript_value_30;
|
|
495
|
+
if ((kind === "vector")) {
|
|
496
|
+
return ((node)["items"])["forEach"](((item) => {
|
|
497
|
+
return tools_source_binding_defaults(item, context);
|
|
498
|
+
}));
|
|
499
|
+
} else {
|
|
500
|
+
if ((kind === "list")) {
|
|
501
|
+
{
|
|
502
|
+
let items = (node)["items"];
|
|
503
|
+
let head = ((((items) ?? [])[0]) ?? null);
|
|
504
|
+
if (__eliscript_truthy(((__eliscript_value_31) => (__eliscript_truthy(__eliscript_value_31) ? (((head)["kind"] === "symbol") && ((head)["name"] === "hash-map")) : __eliscript_value_31))(head))) {
|
|
505
|
+
{
|
|
506
|
+
const __eliscript_value_32 = 1;
|
|
507
|
+
{
|
|
508
|
+
let index = __eliscript_value_32;
|
|
509
|
+
while (__eliscript_numeric_relation("<", index, ((items) ?? []).length)) {
|
|
510
|
+
{
|
|
511
|
+
let target = ((((items) ?? [])[index]) ?? null);
|
|
512
|
+
let value = ((((items) ?? [])[(index + 1)]) ?? null);
|
|
513
|
+
let directive = (((target)["kind"] === "keyword") ? (target)["name"] : null);
|
|
514
|
+
if ((directive === "or")) {
|
|
515
|
+
{
|
|
516
|
+
const __eliscript_value_33 = (value)["items"];
|
|
517
|
+
const __eliscript_value_34 = 2;
|
|
518
|
+
{
|
|
519
|
+
let defaults = __eliscript_value_33;
|
|
520
|
+
let position = __eliscript_value_34;
|
|
521
|
+
while (__eliscript_numeric_relation("<", position, ((defaults) ?? []).length)) {
|
|
522
|
+
tools_source_expression(((((defaults) ?? [])[position]) ?? null), context);
|
|
523
|
+
((position = (position + 2)));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
} else {
|
|
528
|
+
if ((!((target)["kind"] === "keyword"))) {
|
|
529
|
+
tools_source_binding_defaults(target, context);
|
|
530
|
+
} else {
|
|
531
|
+
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
((index = (index + 2)));
|
|
536
|
+
}
|
|
537
|
+
return null;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
} else {
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
} else {
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
function tools_source_parameter_defaults(parameters, context) {
|
|
552
|
+
return (((parameters)["items"] ?? []))["forEach"](((parameter) => {
|
|
553
|
+
return tools_source_binding_defaults(parameter, context);
|
|
554
|
+
}));
|
|
555
|
+
}
|
|
556
|
+
function tools_source_expression(node, context) {
|
|
557
|
+
{
|
|
558
|
+
const __eliscript_value_35 = (node)["kind"];
|
|
559
|
+
{
|
|
560
|
+
let kind = __eliscript_value_35;
|
|
561
|
+
if ((kind === "vector")) {
|
|
562
|
+
return tools_source_sequence((node)["items"], context);
|
|
563
|
+
} else {
|
|
564
|
+
if ((kind === "list")) {
|
|
565
|
+
{
|
|
566
|
+
let items = (node)["items"];
|
|
567
|
+
let head = ((((items) ?? [])[0]) ?? null);
|
|
568
|
+
let operator = ((__eliscript_value_36) => (__eliscript_truthy(__eliscript_value_36) ? ((__eliscript_value_37) => (__eliscript_truthy(__eliscript_value_37) ? (head)["name"] : __eliscript_value_37))(((head)["kind"] === "symbol")) : __eliscript_value_36))(head);
|
|
569
|
+
let macro = ((__eliscript_value_38) => (__eliscript_truthy(__eliscript_value_38) ? ((context)["macros"])["get"](operator) : __eliscript_value_38))(operator);
|
|
570
|
+
if (__eliscript_truthy(macro)) {
|
|
571
|
+
{
|
|
572
|
+
const __eliscript_value_39 = ({"name": operator, "span": (node)["span"], "definitionId": (macro)["id"], "definitionSpan": (macro)["span"], "precision": "source-invocation"});
|
|
573
|
+
{
|
|
574
|
+
let origin = __eliscript_value_39;
|
|
575
|
+
((context)["macroOrigins"])["push"](origin);
|
|
576
|
+
return ((context)["references"])["push"](({"name": operator, "role": "macro-expansion", "span": (head)["span"], "expandedSpan": (node)["span"], "generated": false, "bindingId": (macro)["id"], "definitionSpan": (macro)["span"], "macroOrigin": origin}));
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
} else {
|
|
580
|
+
if (((operator === "quote") || (operator === "js*"))) {
|
|
581
|
+
return null;
|
|
582
|
+
} else {
|
|
583
|
+
if (((operator === "lambda") || (operator === "fn") || (operator === "async"))) {
|
|
584
|
+
tools_source_parameter_defaults(((((items) ?? [])[1]) ?? null), context);
|
|
585
|
+
return tools_source_sequence((items)["slice"](2), context);
|
|
586
|
+
} else {
|
|
587
|
+
if (((operator === "let") || (operator === "let*") || (operator === "loop"))) {
|
|
588
|
+
{
|
|
589
|
+
const __eliscript_value_40 = ((((((items) ?? [])[1]) ?? null))["items"] ?? []);
|
|
590
|
+
{
|
|
591
|
+
let bindings = __eliscript_value_40;
|
|
592
|
+
(bindings)["forEach"](((binding) => {
|
|
593
|
+
if (((binding)["kind"] === "list")) {
|
|
594
|
+
return tools_source_sequence(((binding)["items"])["slice"](1), context);
|
|
595
|
+
} else {
|
|
596
|
+
return null;
|
|
597
|
+
}
|
|
598
|
+
}));
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
return tools_source_sequence((items)["slice"](2), context);
|
|
602
|
+
} else {
|
|
603
|
+
if ((operator === "cond")) {
|
|
604
|
+
return ((items)["slice"](1))["forEach"](((clause) => {
|
|
605
|
+
return tools_source_sequence((clause)["items"], context);
|
|
606
|
+
}));
|
|
607
|
+
} else {
|
|
608
|
+
if ((operator === "try")) {
|
|
609
|
+
return ((items)["slice"](1))["forEach"](((clause) => {
|
|
610
|
+
{
|
|
611
|
+
let parts = ((clause)["items"] ?? []);
|
|
612
|
+
let tag = ((__eliscript_value_41) => (__eliscript_truthy(__eliscript_value_41) ? ((((((parts) ?? [])[0]) ?? null))["name"] ?? null) : __eliscript_value_41))(__eliscript_numeric_relation(">", ((parts) ?? []).length, 0));
|
|
613
|
+
if ((tag === "catch")) {
|
|
614
|
+
return tools_source_sequence((parts)["slice"](2), context);
|
|
615
|
+
} else {
|
|
616
|
+
if ((tag === "finally")) {
|
|
617
|
+
return tools_source_sequence((parts)["slice"](1), context);
|
|
618
|
+
} else {
|
|
619
|
+
return tools_source_expression(clause, context);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}));
|
|
624
|
+
} else {
|
|
625
|
+
if ((operator === "js-object")) {
|
|
626
|
+
{
|
|
627
|
+
const __eliscript_value_42 = 1;
|
|
628
|
+
{
|
|
629
|
+
let index = __eliscript_value_42;
|
|
630
|
+
while (__eliscript_numeric_relation("<", index, ((items) ?? []).length)) {
|
|
631
|
+
{
|
|
632
|
+
const __eliscript_value_43 = ((((items) ?? [])[index]) ?? null);
|
|
633
|
+
{
|
|
634
|
+
let key = __eliscript_value_43;
|
|
635
|
+
if ((((key)["kind"] === "list") || ((key)["kind"] === "vector"))) {
|
|
636
|
+
tools_source_expression(key, context);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
tools_source_expression(((((items) ?? [])[(index + 1)]) ?? null), context);
|
|
641
|
+
((index = (index + 2)));
|
|
642
|
+
}
|
|
643
|
+
return null;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
} else {
|
|
647
|
+
if ((!__eliscript_truthy(((__eliscript_value_44) => (__eliscript_truthy(__eliscript_value_44) ? ((head)["kind"] === "symbol") : __eliscript_value_44))(head)))) {
|
|
648
|
+
if (__eliscript_truthy(head)) {
|
|
649
|
+
tools_source_expression(head, context);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return tools_source_sequence((items)["slice"](1), context);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
} else {
|
|
662
|
+
return null;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
function tools_source_top(forms, context) {
|
|
669
|
+
return (forms)["forEach"](((node) => {
|
|
670
|
+
{
|
|
671
|
+
let items = ((node)["items"] ?? []);
|
|
672
|
+
let head = ((((items) ?? [])[0]) ?? null);
|
|
673
|
+
let operator = ((__eliscript_value_45) => (__eliscript_truthy(__eliscript_value_45) ? ((head)["name"] ?? null) : __eliscript_value_45))(head);
|
|
674
|
+
if ((operator === "module")) {
|
|
675
|
+
return tools_source_top((items)["slice"](2), context);
|
|
676
|
+
} else {
|
|
677
|
+
if ((operator === "defmacro")) {
|
|
678
|
+
{
|
|
679
|
+
let name_node = ((((items) ?? [])[1]) ?? null);
|
|
680
|
+
let name = (name_node)["name"];
|
|
681
|
+
let definition = ({"id": (String("binding-") + String((((context)["definitions"]) ?? []).length)), "name": name, "kind": "macro", "span": (name_node)["span"], "expandedSpan": (node)["span"], "generated": false, "macroOrigin": null});
|
|
682
|
+
((context)["definitions"])["push"](definition);
|
|
683
|
+
return ((context)["macros"])["set"](name, definition);
|
|
684
|
+
}
|
|
685
|
+
} else {
|
|
686
|
+
if (((operator === "import") || (operator === "import-portable") || (operator === "export"))) {
|
|
687
|
+
return null;
|
|
688
|
+
} else {
|
|
689
|
+
if (((operator === "defun") || (operator === "defn") || (operator === "defportable") || (operator === "defasync"))) {
|
|
690
|
+
tools_source_parameter_defaults(((((items) ?? [])[2]) ?? null), context);
|
|
691
|
+
return tools_source_sequence((items)["slice"](3), context);
|
|
692
|
+
} else {
|
|
693
|
+
if (((operator === "defvar") || (operator === "defconst"))) {
|
|
694
|
+
return tools_source_sequence((items)["slice"](2), context);
|
|
695
|
+
} else {
|
|
696
|
+
return tools_source_expression(node, context);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}));
|
|
704
|
+
}
|
|
705
|
+
function tools_scalar_length(source) {
|
|
706
|
+
{
|
|
707
|
+
const __eliscript_value_46 = 0;
|
|
708
|
+
const __eliscript_value_47 = 0;
|
|
709
|
+
const __eliscript_value_48 = ((source) ?? []).length;
|
|
710
|
+
{
|
|
711
|
+
let index = __eliscript_value_46;
|
|
712
|
+
let count = __eliscript_value_47;
|
|
713
|
+
let length = __eliscript_value_48;
|
|
714
|
+
while (__eliscript_numeric_relation("<", index, length)) {
|
|
715
|
+
{
|
|
716
|
+
const __eliscript_value_49 = (source).charCodeAt(index);
|
|
717
|
+
{
|
|
718
|
+
let first = __eliscript_value_49;
|
|
719
|
+
if ((__eliscript_numeric_relation(">=", first, 55296) && __eliscript_numeric_relation("<=", first, 56319) && __eliscript_numeric_relation("<", (index + 1), length))) {
|
|
720
|
+
{
|
|
721
|
+
const __eliscript_value_50 = (source).charCodeAt((index + 1));
|
|
722
|
+
{
|
|
723
|
+
let second = __eliscript_value_50;
|
|
724
|
+
if ((__eliscript_numeric_relation(">=", second, 56320) && __eliscript_numeric_relation("<=", second, 57343))) {
|
|
725
|
+
((index = (index + 1)));
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
((index = (index + 1)));
|
|
733
|
+
((count = (count + 1)));
|
|
734
|
+
}
|
|
735
|
+
return count;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
function tools_contains(span, offset) {
|
|
740
|
+
return ((__eliscript_value_51) => (__eliscript_truthy(__eliscript_value_51) ? (__eliscript_numeric_relation("<=", (span)["start"], offset) && __eliscript_numeric_relation("<", offset, (span)["end"])) : __eliscript_value_51))(span);
|
|
741
|
+
}
|
|
742
|
+
function tools_at(context, offset) {
|
|
743
|
+
{
|
|
744
|
+
const __eliscript_value_52 = null;
|
|
745
|
+
const __eliscript_value_53 = null;
|
|
746
|
+
const __eliscript_value_54 = false;
|
|
747
|
+
{
|
|
748
|
+
let selected = __eliscript_value_52;
|
|
749
|
+
let width = __eliscript_value_53;
|
|
750
|
+
let ambiguous = __eliscript_value_54;
|
|
751
|
+
((context)["definitions"])["forEach"](((definition) => {
|
|
752
|
+
{
|
|
753
|
+
const __eliscript_value_55 = (definition)["span"];
|
|
754
|
+
{
|
|
755
|
+
let span = __eliscript_value_55;
|
|
756
|
+
if (__eliscript_truthy(tools_contains(span, offset))) {
|
|
757
|
+
{
|
|
758
|
+
const __eliscript_value_56 = __eliscript_numeric_sub((span)["end"], (span)["start"]);
|
|
759
|
+
{
|
|
760
|
+
let size = __eliscript_value_56;
|
|
761
|
+
if (((width === null) || __eliscript_numeric_relation("<", size, width))) {
|
|
762
|
+
((selected = ({"kind": "definition", "value": definition, "bindingId": (definition)["id"]})));
|
|
763
|
+
((width = size));
|
|
764
|
+
return ((ambiguous = false));
|
|
765
|
+
} else {
|
|
766
|
+
if ((size === width)) {
|
|
767
|
+
return ((ambiguous = true));
|
|
768
|
+
} else {
|
|
769
|
+
return null;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
} else {
|
|
775
|
+
return null;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}));
|
|
780
|
+
((context)["references"])["forEach"](((reference) => {
|
|
781
|
+
{
|
|
782
|
+
const __eliscript_value_57 = (reference)["span"];
|
|
783
|
+
{
|
|
784
|
+
let span = __eliscript_value_57;
|
|
785
|
+
if (__eliscript_truthy(tools_contains(span, offset))) {
|
|
786
|
+
{
|
|
787
|
+
const __eliscript_value_58 = __eliscript_numeric_sub((span)["end"], (span)["start"]);
|
|
788
|
+
{
|
|
789
|
+
let size = __eliscript_value_58;
|
|
790
|
+
if (((width === null) || __eliscript_numeric_relation("<", size, width))) {
|
|
791
|
+
((selected = ({"kind": "reference", "value": reference, "bindingId": (reference)["bindingId"]})));
|
|
792
|
+
((width = size));
|
|
793
|
+
return ((ambiguous = false));
|
|
794
|
+
} else {
|
|
795
|
+
if ((size === width)) {
|
|
796
|
+
return ((ambiguous = true));
|
|
797
|
+
} else {
|
|
798
|
+
return null;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
} else {
|
|
804
|
+
return null;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}));
|
|
809
|
+
if (__eliscript_truthy(ambiguous)) {
|
|
810
|
+
return null;
|
|
811
|
+
} else {
|
|
812
|
+
return selected;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
function tools_query(context, request, source, filename) {
|
|
818
|
+
{
|
|
819
|
+
const __eliscript_value_59 = ((request)["offset"] ?? null);
|
|
820
|
+
const __eliscript_value_60 = ((request)["offsetUnit"] ?? null);
|
|
821
|
+
const __eliscript_value_61 = ((request)["query"] ?? "symbol");
|
|
822
|
+
{
|
|
823
|
+
let offset = __eliscript_value_59;
|
|
824
|
+
let unit = __eliscript_value_60;
|
|
825
|
+
let query = __eliscript_value_61;
|
|
826
|
+
if ((!(unit === "unicode-scalar"))) {
|
|
827
|
+
tools_fail("query offsetUnit must be unicode-scalar", filename);
|
|
828
|
+
}
|
|
829
|
+
if ((!__eliscript_truthy(((__eliscript_value_62) => (__eliscript_truthy(__eliscript_value_62) ? (__eliscript_numeric_relation(">=", offset, 0) && __eliscript_numeric_relation("<=", offset, tools_scalar_length(source))) : __eliscript_value_62))(Number.isSafeInteger(offset))))) {
|
|
830
|
+
tools_fail("query offset is outside the source Unicode scalar range", filename);
|
|
831
|
+
}
|
|
832
|
+
if ((!__eliscript_truthy((["symbol", "definition", "references"])["includes"](query)))) {
|
|
833
|
+
tools_fail("unsupported compiler query", filename);
|
|
834
|
+
}
|
|
835
|
+
{
|
|
836
|
+
let selected = tools_at(context, offset);
|
|
837
|
+
let binding_id = ((__eliscript_value_63) => (__eliscript_truthy(__eliscript_value_63) ? (selected)["bindingId"] : __eliscript_value_63))(selected);
|
|
838
|
+
let definition = null;
|
|
839
|
+
let references = [];
|
|
840
|
+
if ((!(binding_id === null))) {
|
|
841
|
+
((context)["definitions"])["forEach"](((item) => {
|
|
842
|
+
if (((item)["id"] === binding_id)) {
|
|
843
|
+
return ((definition = item));
|
|
844
|
+
} else {
|
|
845
|
+
return null;
|
|
846
|
+
}
|
|
847
|
+
}));
|
|
848
|
+
((context)["references"])["forEach"](((item) => {
|
|
849
|
+
if (((item)["bindingId"] === binding_id)) {
|
|
850
|
+
return (references)["push"](item);
|
|
851
|
+
} else {
|
|
852
|
+
return null;
|
|
853
|
+
}
|
|
854
|
+
}));
|
|
855
|
+
}
|
|
856
|
+
return ({"query": query, "offset": offset, "offsetUnit": unit, "symbol": selected, "definition": definition, "references": references, "result": ((query === "definition") ? definition : ((query === "references") ? references : selected))});
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
function tools_source_identity(source, filename) {
|
|
862
|
+
{
|
|
863
|
+
const __eliscript_value_64 = sha256_string_utf16le(source);
|
|
864
|
+
const __eliscript_value_65 = "";
|
|
865
|
+
const __eliscript_value_66 = "0123456789abcdef";
|
|
866
|
+
const __eliscript_value_67 = 0;
|
|
867
|
+
{
|
|
868
|
+
let bytes = __eliscript_value_64;
|
|
869
|
+
let hex = __eliscript_value_65;
|
|
870
|
+
let digits = __eliscript_value_66;
|
|
871
|
+
let index = __eliscript_value_67;
|
|
872
|
+
while (__eliscript_numeric_relation("<", index, ((bytes) ?? []).length)) {
|
|
873
|
+
{
|
|
874
|
+
const __eliscript_value_68 = ((((bytes) ?? [])[index]) ?? null);
|
|
875
|
+
{
|
|
876
|
+
let byte = __eliscript_value_68;
|
|
877
|
+
((hex = (String(hex) + String((digits)["charAt"](__eliscript_numeric_ushr(byte, 4))) + String((digits)["charAt"](__eliscript_numeric_and(byte, 15))))));
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
((index = (index + 1)));
|
|
881
|
+
}
|
|
882
|
+
return ({"format": "eliscript-source-identity", "version": 1, "encoding": "utf16le", "filename": filename, "units": ((source) ?? []).length, "sha256": hex});
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
function tools_check_source_identity(request, identity, filename, required) {
|
|
887
|
+
{
|
|
888
|
+
const __eliscript_value_69 = (request)["expectedSourceIdentity"];
|
|
889
|
+
{
|
|
890
|
+
let expected = __eliscript_value_69;
|
|
891
|
+
if (__eliscript_truthy(((__eliscript_value_70) => (__eliscript_truthy(__eliscript_value_70) ? (expected === undefined) : __eliscript_value_70))(required))) {
|
|
892
|
+
tools_fail("edit-preview requires expectedSourceIdentity", filename);
|
|
893
|
+
}
|
|
894
|
+
if ((!(expected === undefined))) {
|
|
895
|
+
if ((!((!(expected === null)) && (((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(expected) === "object") && (!__eliscript_truthy(Array.isArray(expected))) && (((expected)["format"] ?? null) === "eliscript-source-identity") && (((expected)["version"] ?? null) === 1) && (((expected)["encoding"] ?? null) === "utf16le") && (((expected)["filename"] ?? null) === (identity)["filename"]) && (((expected)["units"] ?? null) === (identity)["units"]) && (((expected)["sha256"] ?? null) === (identity)["sha256"])))) {
|
|
896
|
+
return tools_fail("request belongs to a different source snapshot", filename, "ELI-T0002");
|
|
897
|
+
} else {
|
|
898
|
+
return null;
|
|
899
|
+
}
|
|
900
|
+
} else {
|
|
901
|
+
return null;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
function tools_next_scalar(source, index) {
|
|
907
|
+
{
|
|
908
|
+
const __eliscript_value_71 = (source).charCodeAt(index);
|
|
909
|
+
const __eliscript_value_72 = (index + 1);
|
|
910
|
+
{
|
|
911
|
+
let first = __eliscript_value_71;
|
|
912
|
+
let next = __eliscript_value_72;
|
|
913
|
+
if ((__eliscript_numeric_relation(">=", first, 55296) && __eliscript_numeric_relation("<=", first, 56319) && __eliscript_numeric_relation("<", next, ((source) ?? []).length))) {
|
|
914
|
+
{
|
|
915
|
+
const __eliscript_value_73 = (source).charCodeAt(next);
|
|
916
|
+
{
|
|
917
|
+
let second = __eliscript_value_73;
|
|
918
|
+
if ((__eliscript_numeric_relation(">=", second, 56320) && __eliscript_numeric_relation("<=", second, 57343))) {
|
|
919
|
+
((next = (next + 1)));
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
return next;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
function tools_edit_preview(request, source, filename, identity) {
|
|
929
|
+
{
|
|
930
|
+
const __eliscript_value_74 = ((request)["edits"] ?? undefined);
|
|
931
|
+
const __eliscript_value_75 = tools_scalar_length(source);
|
|
932
|
+
const __eliscript_value_76 = -1;
|
|
933
|
+
const __eliscript_value_77 = 0;
|
|
934
|
+
{
|
|
935
|
+
let edits = __eliscript_value_74;
|
|
936
|
+
let length = __eliscript_value_75;
|
|
937
|
+
let previous_start = __eliscript_value_76;
|
|
938
|
+
let previous_end = __eliscript_value_77;
|
|
939
|
+
if ((!(((request)["offsetUnit"] ?? null) === "unicode-scalar"))) {
|
|
940
|
+
tools_fail("edit offsetUnit must be unicode-scalar", filename);
|
|
941
|
+
}
|
|
942
|
+
if ((!__eliscript_truthy(Array.isArray(edits)))) {
|
|
943
|
+
tools_fail("edits must be an array", filename);
|
|
944
|
+
}
|
|
945
|
+
(edits)["forEach"](((edit) => {
|
|
946
|
+
if ((!((!(edit === null)) && (((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(edit) === "object") && (!__eliscript_truthy(Array.isArray(edit)))))) {
|
|
947
|
+
tools_fail("each edit must be an object", filename);
|
|
948
|
+
}
|
|
949
|
+
{
|
|
950
|
+
const __eliscript_value_78 = ((edit)["start"] ?? null);
|
|
951
|
+
const __eliscript_value_79 = ((edit)["end"] ?? null);
|
|
952
|
+
const __eliscript_value_80 = ((edit)["text"] ?? undefined);
|
|
953
|
+
{
|
|
954
|
+
let start = __eliscript_value_78;
|
|
955
|
+
let end = __eliscript_value_79;
|
|
956
|
+
let text = __eliscript_value_80;
|
|
957
|
+
if ((!__eliscript_truthy(((__eliscript_value_81) => (__eliscript_truthy(__eliscript_value_81) ? ((__eliscript_value_82) => (__eliscript_truthy(__eliscript_value_82) ? (__eliscript_numeric_relation(">=", start, 0) && __eliscript_numeric_relation(">=", end, start) && __eliscript_numeric_relation("<=", end, length) && (((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(text) === "string")) : __eliscript_value_82))(Number.isSafeInteger(end)) : __eliscript_value_81))(Number.isSafeInteger(start))))) {
|
|
958
|
+
tools_fail("edit requires a valid scalar range and replacement string", filename);
|
|
959
|
+
}
|
|
960
|
+
if ((!(__eliscript_numeric_relation(">", start, previous_start) && __eliscript_numeric_relation(">=", start, previous_end)))) {
|
|
961
|
+
tools_fail("edits must have distinct starts in nonoverlapping source order", filename);
|
|
962
|
+
}
|
|
963
|
+
((previous_start = start));
|
|
964
|
+
return ((previous_end = end));
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
}));
|
|
968
|
+
{
|
|
969
|
+
const __eliscript_value_83 = [];
|
|
970
|
+
const __eliscript_value_84 = 0;
|
|
971
|
+
const __eliscript_value_85 = 0;
|
|
972
|
+
const __eliscript_value_86 = 0;
|
|
973
|
+
{
|
|
974
|
+
let parts = __eliscript_value_83;
|
|
975
|
+
let unit = __eliscript_value_84;
|
|
976
|
+
let scalar = __eliscript_value_85;
|
|
977
|
+
let copied = __eliscript_value_86;
|
|
978
|
+
(edits)["forEach"](((edit) => {
|
|
979
|
+
while (__eliscript_numeric_relation("<", scalar, (edit)["start"])) {
|
|
980
|
+
((unit = tools_next_scalar(source, unit)));
|
|
981
|
+
((scalar = (scalar + 1)));
|
|
982
|
+
}
|
|
983
|
+
(parts)["push"]((source)["slice"](copied, unit), (edit)["text"]);
|
|
984
|
+
while (__eliscript_numeric_relation("<", scalar, (edit)["end"])) {
|
|
985
|
+
((unit = tools_next_scalar(source, unit)));
|
|
986
|
+
((scalar = (scalar + 1)));
|
|
987
|
+
}
|
|
988
|
+
return ((copied = unit));
|
|
989
|
+
}));
|
|
990
|
+
(parts)["push"]((source)["slice"](copied));
|
|
991
|
+
{
|
|
992
|
+
const __eliscript_value_87 = __eliscript_at_direct(parts, "join", "");
|
|
993
|
+
{
|
|
994
|
+
let updated = __eliscript_value_87;
|
|
995
|
+
return ({"ok": true, "operation": "edit-preview", "filename": filename, "offsetUnit": "unicode-scalar", "readOnly": true, "diagnostics": [], "previousSourceIdentity": identity, "sourceIdentity": tools_source_identity(updated, filename), "source": updated});
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
function tools_request(request) {
|
|
1004
|
+
{
|
|
1005
|
+
const __eliscript_value_88 = ((request)["filename"] ?? "<input>");
|
|
1006
|
+
const __eliscript_value_89 = null;
|
|
1007
|
+
{
|
|
1008
|
+
let filename = __eliscript_value_88;
|
|
1009
|
+
let identity = __eliscript_value_89;
|
|
1010
|
+
if ((!(((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(filename) === "string"))) {
|
|
1011
|
+
tools_fail("filename must be a string", "<input>");
|
|
1012
|
+
}
|
|
1013
|
+
return (() => {
|
|
1014
|
+
try {
|
|
1015
|
+
{
|
|
1016
|
+
const __eliscript_value_90 = ((request)["source"] ?? undefined);
|
|
1017
|
+
const __eliscript_value_91 = ((request)["operation"] ?? null);
|
|
1018
|
+
{
|
|
1019
|
+
let source = __eliscript_value_90;
|
|
1020
|
+
let operation = __eliscript_value_91;
|
|
1021
|
+
if ((!(((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(source) === "string"))) {
|
|
1022
|
+
tools_fail("source must be a string", filename);
|
|
1023
|
+
}
|
|
1024
|
+
if ((!((operation === "analyze") || (operation === "query") || (operation === "edit-preview")))) {
|
|
1025
|
+
tools_fail("unsupported compiler tools operation", filename);
|
|
1026
|
+
}
|
|
1027
|
+
((identity = tools_source_identity(source, filename)));
|
|
1028
|
+
tools_check_source_identity(request, identity, filename, (operation === "edit-preview"));
|
|
1029
|
+
if ((operation === "edit-preview")) {
|
|
1030
|
+
return tools_edit_preview(request, source, filename, identity);
|
|
1031
|
+
} else {
|
|
1032
|
+
{
|
|
1033
|
+
let forms = read_string(source, filename);
|
|
1034
|
+
let expansion = expand_module_with_origins(forms, filename, ((request)["macroContext"] ?? null));
|
|
1035
|
+
let expanded = (expansion)["forms"];
|
|
1036
|
+
let context = ({"syntax": new (globalThis.Map)(), "macros": new (globalThis.Map)(), "definitions": [], "references": [], "macroOrigins": [], "macroExpansions": (expansion)["macroOrigins"]});
|
|
1037
|
+
let scope = tools_scope(null);
|
|
1038
|
+
analyze_module(expanded, filename);
|
|
1039
|
+
{
|
|
1040
|
+
const __eliscript_value_92 = lower_module(expanded, filename);
|
|
1041
|
+
{
|
|
1042
|
+
let program = __eliscript_value_92;
|
|
1043
|
+
(forms)["forEach"](((node) => {
|
|
1044
|
+
return tools_syntax_index(node, context);
|
|
1045
|
+
}));
|
|
1046
|
+
tools_source_top(forms, context);
|
|
1047
|
+
tools_predeclare((program)["body"], scope, context);
|
|
1048
|
+
((program)["body"])["forEach"](((node) => {
|
|
1049
|
+
return tools_walk(node, scope, context);
|
|
1050
|
+
}));
|
|
1051
|
+
{
|
|
1052
|
+
const __eliscript_value_93 = ({"ok": true, "operation": operation, "filename": filename, "offsetUnit": "unicode-scalar", "sourceIdentity": identity, "readOnly": true, "diagnostics": [], "definitions": (context)["definitions"], "references": (context)["references"], "macroOrigins": (context)["macroOrigins"], "macroExpansions": (context)["macroExpansions"], "macroExpansionTraceAvailable": true});
|
|
1053
|
+
{
|
|
1054
|
+
let result = __eliscript_value_93;
|
|
1055
|
+
if ((operation === "query")) {
|
|
1056
|
+
((result)["query"] = tools_query(context, request, source, filename));
|
|
1057
|
+
}
|
|
1058
|
+
return result;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
} catch (error) {
|
|
1068
|
+
{
|
|
1069
|
+
const __eliscript_value_94 = ((error)["eliscriptDiagnostic"] ?? null);
|
|
1070
|
+
{
|
|
1071
|
+
let diagnostic = __eliscript_value_94;
|
|
1072
|
+
if (__eliscript_truthy(diagnostic)) {
|
|
1073
|
+
return ({"ok": false, "operation": ((request)["operation"] ?? null), "filename": filename, "offsetUnit": "unicode-scalar", "sourceIdentity": identity, "readOnly": true, "diagnostics": [diagnostic], "definitions": [], "references": [], "macroOrigins": [], "macroExpansions": ((error)["macroOrigins"] ?? []), "macroExpansionTraceAvailable": true, "query": null});
|
|
1074
|
+
} else {
|
|
1075
|
+
return ((__eliscript_value_95) => { throw __eliscript_value_95; })(error);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
})();
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
export {tools_request};
|