wasm-idle 0.7.2 → 1.0.0
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 +760 -81
- package/dist/index.d.ts +4 -9
- package/dist/index.js +2 -4
- package/dist/playground/applicationAssets.d.ts +4 -0
- package/dist/playground/applicationAssets.js +277 -0
- package/dist/playground/assemblyscript.d.ts +41 -0
- package/dist/playground/assemblyscript.js +630 -0
- package/dist/playground/assetBridge.d.ts +18 -7
- package/dist/playground/assetBridge.js +824 -100
- package/dist/playground/assets.d.ts +813 -19
- package/dist/playground/assets.js +2096 -156
- package/dist/playground/awk.d.ts +5 -0
- package/dist/playground/awk.js +60 -0
- package/dist/playground/bash.d.ts +53 -0
- package/dist/playground/bash.js +1096 -0
- package/dist/playground/bashWorkerProtocol.d.ts +88 -0
- package/dist/playground/bashWorkerProtocol.js +135 -0
- package/dist/playground/bqn.d.ts +5 -0
- package/dist/playground/bqn.js +57 -0
- package/dist/playground/bqnPreflight.d.ts +26 -0
- package/dist/playground/bqnPreflight.js +399 -0
- package/dist/playground/c3.d.ts +15 -0
- package/dist/playground/c3.js +154 -0
- package/dist/playground/clang.d.ts +35 -19
- package/dist/playground/clang.js +241 -52
- package/dist/playground/clangAssetIntegrity.d.ts +32 -0
- package/dist/playground/clangAssetIntegrity.js +8 -0
- package/dist/playground/clojurescript.d.ts +5 -0
- package/dist/playground/clojurescript.js +59 -0
- package/dist/playground/clojurescriptPreflight.d.ts +26 -0
- package/dist/playground/clojurescriptPreflight.js +383 -0
- package/dist/playground/cobol.d.ts +46 -0
- package/dist/playground/cobol.js +703 -0
- package/dist/playground/d.d.ts +47 -0
- package/dist/playground/d.js +644 -0
- package/dist/playground/dOuterAssets.d.ts +16 -0
- package/dist/playground/dOuterAssets.js +163 -0
- package/dist/playground/dotnet.d.ts +99 -0
- package/dist/playground/dotnet.js +1131 -0
- package/dist/playground/duckdb.d.ts +36 -0
- package/dist/playground/duckdb.js +542 -0
- package/dist/playground/elixir.d.ts +18 -10
- package/dist/playground/elixir.js +630 -96
- package/dist/playground/elixirAssets.d.ts +6 -0
- package/dist/playground/elixirAssets.js +33 -0
- package/dist/playground/executionObservation.d.ts +22 -0
- package/dist/playground/executionObservation.js +65 -0
- package/dist/playground/forth.d.ts +5 -0
- package/dist/playground/forth.js +53 -0
- package/dist/playground/forthPreflight.d.ts +24 -0
- package/dist/playground/forthPreflight.js +198 -0
- package/dist/playground/fortran.d.ts +47 -0
- package/dist/playground/fortran.js +651 -0
- package/dist/playground/fortranAssets.d.ts +6 -0
- package/dist/playground/fortranAssets.js +27 -0
- package/dist/playground/gleam.d.ts +6 -0
- package/dist/playground/gleam.js +33 -0
- package/dist/playground/go.d.ts +17 -11
- package/dist/playground/go.js +376 -72
- package/dist/playground/goDebugInstrumentation.d.ts +1 -0
- package/dist/playground/goDebugInstrumentation.js +229 -0
- package/dist/playground/haskell.d.ts +44 -0
- package/dist/playground/haskell.js +678 -0
- package/dist/playground/haskellAssets.d.ts +24 -0
- package/dist/playground/haskellAssets.js +93 -0
- package/dist/playground/index.d.ts +1 -1
- package/dist/playground/index.js +360 -111
- package/dist/playground/j.d.ts +5 -0
- package/dist/playground/j.js +60 -0
- package/dist/playground/jPreflight.d.ts +26 -0
- package/dist/playground/jPreflight.js +372 -0
- package/dist/playground/janet.d.ts +5 -0
- package/dist/playground/janet.js +64 -0
- package/dist/playground/java.d.ts +24 -10
- package/dist/playground/java.js +706 -84
- package/dist/playground/javaSource.d.ts +5 -0
- package/dist/playground/javaSource.js +16 -0
- package/dist/playground/javaStdin.d.ts +1 -1
- package/dist/playground/javaStdin.js +13 -4
- package/dist/playground/julia.d.ts +5 -0
- package/dist/playground/julia.js +64 -0
- package/dist/playground/lfortran.d.ts +8 -0
- package/dist/playground/lfortran.js +30 -0
- package/dist/playground/lfortranAssets.d.ts +21 -0
- package/dist/playground/lfortranAssets.js +118 -0
- package/dist/playground/lisp.d.ts +45 -0
- package/dist/playground/lisp.js +640 -0
- package/dist/playground/lispAssets.d.ts +9 -0
- package/dist/playground/lispAssets.js +74 -0
- package/dist/playground/lldbManifest.d.ts +3 -0
- package/dist/playground/lldbManifest.js +155 -0
- package/dist/playground/lldbSession.d.ts +115 -0
- package/dist/playground/lldbSession.js +1347 -0
- package/dist/playground/loadingProgress.d.ts +16 -0
- package/dist/playground/loadingProgress.js +166 -0
- package/dist/playground/lua.d.ts +44 -0
- package/dist/playground/lua.js +630 -0
- package/dist/playground/nim.d.ts +5 -0
- package/dist/playground/nim.js +76 -0
- package/dist/playground/objectivec.d.ts +39 -0
- package/dist/playground/objectivec.js +288 -0
- package/dist/playground/ocaml.d.ts +28 -10
- package/dist/playground/ocaml.js +815 -253
- package/dist/playground/octave.d.ts +43 -0
- package/dist/playground/octave.js +783 -0
- package/dist/playground/options.d.ts +19 -40
- package/dist/playground/options.js +2 -1
- package/dist/playground/pascal.d.ts +5 -0
- package/dist/playground/pascal.js +60 -0
- package/dist/playground/perl.d.ts +5 -0
- package/dist/playground/perl.js +61 -0
- package/dist/playground/php.d.ts +44 -0
- package/dist/playground/php.js +665 -0
- package/dist/playground/prolog.d.ts +6 -0
- package/dist/playground/prolog.js +75 -0
- package/dist/playground/python.d.ts +20 -14
- package/dist/playground/python.js +445 -101
- package/dist/playground/pythonPackageLock.d.ts +6 -0
- package/dist/playground/pythonPackageLock.js +56 -0
- package/dist/playground/r.d.ts +44 -0
- package/dist/playground/r.js +637 -0
- package/dist/playground/ruby.d.ts +46 -0
- package/dist/playground/ruby.js +732 -0
- package/dist/playground/rubyAssets.d.ts +23 -0
- package/dist/playground/rubyAssets.js +68 -0
- package/dist/playground/rubyTestPreflight.d.ts +2 -0
- package/dist/playground/rubyTestPreflight.js +18 -0
- package/dist/playground/runtimeModule.d.ts +1 -0
- package/dist/playground/runtimeModule.js +5 -0
- package/dist/playground/rust.d.ts +44 -13
- package/dist/playground/rust.js +714 -76
- package/dist/playground/rustExecutableGraph.d.ts +85 -0
- package/dist/playground/rustExecutableGraph.js +946 -0
- package/dist/playground/rustWorkerLimits.d.ts +17 -0
- package/dist/playground/rustWorkerLimits.js +34 -0
- package/dist/playground/sandbox.d.ts +16 -10
- package/dist/playground/sharedBuffer.d.ts +6 -0
- package/dist/playground/sharedBuffer.js +12 -0
- package/dist/playground/sqlite.d.ts +38 -0
- package/dist/playground/sqlite.js +550 -0
- package/dist/playground/staticRuntimeModuleVersion.d.ts +1 -0
- package/dist/playground/staticRuntimeModuleVersion.js +2 -0
- package/dist/playground/staticRuntimePreflight.d.ts +13 -0
- package/dist/playground/staticRuntimePreflight.js +231 -0
- package/dist/playground/staticRuntimePreflightExecute.d.ts +8 -0
- package/dist/playground/staticRuntimePreflightExecute.js +66 -0
- package/dist/playground/staticRuntimePreflightProtocol.d.ts +68 -0
- package/dist/playground/staticRuntimePreflightProtocol.js +339 -0
- package/dist/playground/staticStdinRing.d.ts +45 -0
- package/dist/playground/staticStdinRing.js +158 -0
- package/dist/playground/staticWorkerRuntime.d.ts +154 -0
- package/dist/playground/staticWorkerRuntime.js +1917 -0
- package/dist/playground/stdinBuffer.d.ts +9 -7
- package/dist/playground/stdinBuffer.js +9 -18
- package/dist/playground/swift.d.ts +5 -0
- package/dist/playground/swift.js +17 -0
- package/dist/playground/tcl.d.ts +5 -0
- package/dist/playground/tcl.js +62 -0
- package/dist/playground/teavmConfig.d.ts +1 -1
- package/dist/playground/teavmConfig.js +2 -2
- package/dist/playground/tinygo.d.ts +48 -18
- package/dist/playground/tinygo.js +1202 -329
- package/dist/playground/tinygoExecutableGraph.d.ts +44 -0
- package/dist/playground/tinygoExecutableGraph.js +449 -0
- package/dist/playground/typescript.d.ts +55 -0
- package/dist/playground/typescript.js +924 -0
- package/dist/playground/wasm.d.ts +43 -0
- package/dist/playground/wasm.js +608 -0
- package/dist/playground/wasmAwkVersion.d.ts +59 -0
- package/dist/playground/wasmAwkVersion.js +31 -0
- package/dist/playground/wasmBashVersion.d.ts +63 -0
- package/dist/playground/wasmBashVersion.js +36 -0
- package/dist/playground/wasmBqnVersion.d.ts +24 -0
- package/dist/playground/wasmBqnVersion.js +24 -0
- package/dist/playground/wasmC3Version.d.ts +20 -0
- package/dist/playground/wasmC3Version.js +21 -0
- package/dist/playground/wasmClojureScriptVersion.d.ts +21 -0
- package/dist/playground/wasmClojureScriptVersion.js +21 -0
- package/dist/playground/wasmDIntegrity.d.ts +15 -0
- package/dist/playground/wasmDIntegrity.js +15 -0
- package/dist/playground/wasmDVersion.d.ts +1 -0
- package/dist/playground/wasmDVersion.js +1 -0
- package/dist/playground/wasmDebugVersion.d.ts +6 -0
- package/dist/playground/wasmDebugVersion.js +6 -0
- package/dist/playground/wasmDotnetVersion.d.ts +1 -0
- package/dist/playground/wasmDotnetVersion.js +1 -0
- package/dist/playground/wasmElixirVersion.d.ts +21 -1
- package/dist/playground/wasmElixirVersion.js +21 -1
- package/dist/playground/wasmForthVersion.d.ts +18 -0
- package/dist/playground/wasmForthVersion.js +18 -0
- package/dist/playground/wasmFortranExecutionAssets.d.ts +15 -0
- package/dist/playground/wasmFortranExecutionAssets.js +15 -0
- package/dist/playground/wasmFortranVersion.d.ts +1 -0
- package/dist/playground/wasmFortranVersion.js +1 -0
- package/dist/playground/wasmGleamVersion.d.ts +5 -0
- package/dist/playground/wasmGleamVersion.js +5 -0
- package/dist/playground/wasmGoVersion.d.ts +1 -1
- package/dist/playground/wasmGoVersion.js +1 -1
- package/dist/playground/wasmHaskellVersion.d.ts +1 -0
- package/dist/playground/wasmHaskellVersion.js +1 -0
- package/dist/playground/wasmJVersion.d.ts +24 -0
- package/dist/playground/wasmJVersion.js +24 -0
- package/dist/playground/wasmJanetVersion.d.ts +53 -0
- package/dist/playground/wasmJanetVersion.js +30 -0
- package/dist/playground/wasmJuliaVersion.d.ts +71 -0
- package/dist/playground/wasmJuliaVersion.js +39 -0
- package/dist/playground/wasmLfortranVersion.d.ts +28 -0
- package/dist/playground/wasmLfortranVersion.js +29 -0
- package/dist/playground/wasmLispVersion.d.ts +1 -0
- package/dist/playground/wasmLispVersion.js +1 -0
- package/dist/playground/wasmLuaVersion.d.ts +1 -0
- package/dist/playground/wasmLuaVersion.js +1 -0
- package/dist/playground/wasmNimVersion.d.ts +125 -0
- package/dist/playground/wasmNimVersion.js +66 -0
- package/dist/playground/wasmObjectiveCVersion.d.ts +27 -0
- package/dist/playground/wasmObjectiveCVersion.js +27 -0
- package/dist/playground/wasmOcamlVersion.d.ts +12 -1
- package/dist/playground/wasmOcamlVersion.js +12 -1
- package/dist/playground/wasmOctaveVersion.d.ts +1 -0
- package/dist/playground/wasmOctaveVersion.js +1 -0
- package/dist/playground/wasmPascalVersion.d.ts +61 -0
- package/dist/playground/wasmPascalVersion.js +34 -0
- package/dist/playground/wasmPerlVersion.d.ts +71 -0
- package/dist/playground/wasmPerlVersion.js +39 -0
- package/dist/playground/wasmPrologVersion.d.ts +31 -0
- package/dist/playground/wasmPrologVersion.js +31 -0
- package/dist/playground/wasmRVersion.d.ts +1 -0
- package/dist/playground/wasmRVersion.js +1 -0
- package/dist/playground/wasmRustVersion.d.ts +1306 -1
- package/dist/playground/wasmRustVersion.js +1458 -1
- package/dist/playground/wasmSwiftVersion.d.ts +1 -0
- package/dist/playground/wasmSwiftVersion.js +1 -0
- package/dist/playground/wasmTclVersion.d.ts +85 -0
- package/dist/playground/wasmTclVersion.js +46 -0
- package/dist/playground/wasmTinyGoVersion.d.ts +98 -1
- package/dist/playground/wasmTinyGoVersion.js +107 -1
- package/dist/playground/wasmTypeScriptVersion.d.ts +5 -0
- package/dist/playground/wasmTypeScriptVersion.js +5 -0
- package/dist/playground/wasmWatVersion.d.ts +1 -0
- package/dist/playground/wasmWatVersion.js +1 -0
- package/dist/playground/wasmZigVersion.d.ts +13 -0
- package/dist/playground/wasmZigVersion.js +13 -0
- package/dist/playground/wat.d.ts +44 -0
- package/dist/playground/wat.js +622 -0
- package/dist/playground/worker/assemblyscript.js +339 -0
- package/dist/playground/worker/assets.d.ts +7 -0
- package/dist/playground/worker/assets.js +288 -39
- package/dist/playground/worker/bash.js +338 -0
- package/dist/playground/worker/bashNestedBootstrap.d.ts +6 -0
- package/dist/playground/worker/bashNestedBootstrap.js +59 -0
- package/dist/playground/worker/bashRuntime.d.ts +89 -0
- package/dist/playground/worker/bashRuntime.js +982 -0
- package/dist/playground/worker/clang.js +92 -13
- package/dist/playground/worker/cobol.js +107 -0
- package/dist/playground/worker/d.js +199 -0
- package/dist/playground/worker/dotnet.js +141 -0
- package/dist/playground/worker/duckdb.d.ts +1 -0
- package/dist/playground/worker/duckdb.js +136 -0
- package/dist/playground/worker/elixir.js +307 -41
- package/dist/playground/worker/fortran.d.ts +1 -0
- package/dist/playground/worker/fortran.js +295 -0
- package/dist/playground/worker/go.js +246 -40
- package/dist/playground/worker/haskell.d.ts +7 -0
- package/dist/playground/worker/haskell.js +465 -0
- package/dist/playground/worker/java.js +59 -20
- package/dist/playground/worker/lisp.d.ts +1 -0
- package/dist/playground/worker/lisp.js +195 -0
- package/dist/playground/worker/lua.d.ts +1 -0
- package/dist/playground/worker/lua.js +163 -0
- package/dist/playground/worker/objectivec.d.ts +1 -0
- package/dist/playground/worker/objectivec.js +10 -0
- package/dist/playground/worker/ocaml.js +206 -58
- package/dist/playground/worker/php.d.ts +1 -0
- package/dist/playground/worker/php.js +261 -0
- package/dist/playground/worker/python.js +201 -44
- package/dist/playground/worker/r.d.ts +1 -0
- package/dist/playground/worker/r.js +192 -0
- package/dist/playground/worker/ruby.d.ts +1 -0
- package/dist/playground/worker/ruby.js +248 -0
- package/dist/playground/worker/runtimeAssetFetch.d.ts +15 -0
- package/dist/playground/worker/runtimeAssetFetch.js +375 -0
- package/dist/playground/worker/rust.js +546 -20
- package/dist/playground/worker/sqlite.d.ts +1 -0
- package/dist/playground/worker/sqlite.js +112 -0
- package/dist/playground/worker/staticRuntimePreflight.d.ts +1 -0
- package/dist/playground/worker/staticRuntimePreflight.js +56 -0
- package/dist/playground/worker/tinygo.js +34 -9
- package/dist/playground/worker/typescript.d.ts +1 -0
- package/dist/playground/worker/typescript.js +251 -0
- package/dist/playground/worker/wasm.d.ts +1 -0
- package/dist/playground/worker/wasm.js +273 -0
- package/dist/playground/worker/wat.d.ts +1 -0
- package/dist/playground/worker/wat.js +188 -0
- package/dist/playground/worker/zig.d.ts +8 -0
- package/dist/playground/worker/zig.js +578 -0
- package/dist/playground/workerProgress.d.ts +15 -0
- package/dist/playground/workerProgress.js +72 -0
- package/dist/playground/workerSession.d.ts +28 -0
- package/dist/playground/workerSession.js +164 -0
- package/dist/playground/zig.d.ts +46 -0
- package/dist/playground/zig.js +690 -0
- package/dist/playground/zigAssets.d.ts +6 -0
- package/dist/playground/zigAssets.js +49 -0
- package/package.json +234 -105
- package/dist/clang/app.d.ts +0 -75
- package/dist/clang/app.js +0 -744
- package/dist/clang/apply.d.ts +0 -2
- package/dist/clang/apply.js +0 -11
- package/dist/clang/color.d.ts +0 -3
- package/dist/clang/color.js +0 -3
- package/dist/clang/encode.d.ts +0 -4
- package/dist/clang/encode.js +0 -20
- package/dist/clang/error.d.ts +0 -14
- package/dist/clang/error.js +0 -27
- package/dist/clang/gccCompat.d.ts +0 -15
- package/dist/clang/gccCompat.js +0 -767
- package/dist/clang/index.d.ts +0 -85
- package/dist/clang/index.js +0 -1077
- package/dist/clang/memory/index.d.ts +0 -4
- package/dist/clang/memory/index.js +0 -4
- package/dist/clang/memory/memFs.d.ts +0 -35
- package/dist/clang/memory/memFs.js +0 -132
- package/dist/clang/memory/memory.d.ts +0 -22
- package/dist/clang/memory/memory.js +0 -73
- package/dist/clang/memory/tar.d.ts +0 -2
- package/dist/clang/memory/tar.js +0 -59
- package/dist/clang/url.d.ts +0 -4
- package/dist/clang/url.js +0 -5
- package/dist/clang/wasm.d.ts +0 -4
- package/dist/clang/wasm.js +0 -50
- package/dist/clangd/config.d.ts +0 -18
- package/dist/clangd/config.js +0 -14
- package/dist/clangd/jsonStream.d.ts +0 -9
- package/dist/clangd/jsonStream.js +0 -48
- package/dist/clangd/session.d.ts +0 -18
- package/dist/clangd/session.js +0 -112
- package/dist/clangd/worker.js +0 -131
- package/dist/debug/controller.svelte.d.ts +0 -43
- package/dist/debug/controller.svelte.js +0 -268
- package/dist/debug/editor/index.d.ts +0 -2
- package/dist/debug/editor/index.js +0 -1
- package/dist/debug/editor/monaco.d.ts +0 -26
- package/dist/debug/editor/monaco.js +0 -128
- package/dist/debug/expression.d.ts +0 -26
- package/dist/debug/expression.js +0 -547
- package/dist/debug/index.d.ts +0 -8
- package/dist/debug/index.js +0 -5
- package/dist/debug/language/cpp.d.ts +0 -2
- package/dist/debug/language/cpp.js +0 -7
- package/dist/debug/language/index.d.ts +0 -3
- package/dist/debug/language/index.js +0 -2
- package/dist/debug/language/python.d.ts +0 -2
- package/dist/debug/language/python.js +0 -14
- package/dist/debug/language/types.d.ts +0 -6
- package/dist/debug/locals.d.ts +0 -2
- package/dist/debug/locals.js +0 -8
- package/dist/lsp/cpp/server.d.ts +0 -2
- package/dist/lsp/cpp/server.js +0 -68
- package/dist/lsp/index.d.ts +0 -5
- package/dist/lsp/index.js +0 -4
- package/dist/lsp/python/main.worker.js +0 -92
- package/dist/lsp/python/package/arcturus_python_lsp/__init__.py +0 -3
- package/dist/lsp/python/package/arcturus_python_lsp/server.py +0 -462
- package/dist/lsp/python/server.d.ts +0 -2
- package/dist/lsp/python/server.js +0 -54
- package/dist/lsp/registry.d.ts +0 -2
- package/dist/lsp/registry.js +0 -12
- package/dist/lsp/runtime.d.ts +0 -5
- package/dist/lsp/runtime.js +0 -31
- package/dist/lsp/types.d.ts +0 -17
- package/dist/terminal/Terminal.svelte +0 -422
- package/dist/terminal/Terminal.svelte.d.ts +0 -26
- package/dist/terminal/index.d.ts +0 -7
- package/dist/terminal/index.js +0 -5
- package/dist/terminal/plugin/index.d.ts +0 -9
- package/dist/terminal/plugin/index.js +0 -19
- package/dist/terminal/theme.d.ts +0 -49
- package/dist/terminal/theme.js +0 -49
- package/dist/terminal/types.d.ts +0 -18
- package/dist/utils/vscodeJsonrpcBrowser.d.ts +0 -5
- package/dist/utils/vscodeJsonrpcBrowser.js +0 -4
- /package/dist/{clangd/worker.d.ts → playground/worker/assemblyscript.d.ts} +0 -0
- /package/dist/{debug/language/types.js → playground/worker/bash.d.ts} +0 -0
- /package/dist/{lsp/python/main.worker.d.ts → playground/worker/cobol.d.ts} +0 -0
- /package/dist/{lsp/types.js → playground/worker/d.d.ts} +0 -0
- /package/dist/{terminal/types.js → playground/worker/dotnet.d.ts} +0 -0
package/dist/debug/expression.js
DELETED
|
@@ -1,547 +0,0 @@
|
|
|
1
|
-
const operators = ['&&', '||', '==', '!=', '<=', '>=', '+', '-', '*', '/', '%', '<', '>', '!'];
|
|
2
|
-
const isDebugExpressionIndexedValue = (value) => !!value &&
|
|
3
|
-
typeof value === 'object' &&
|
|
4
|
-
!Array.isArray(value) &&
|
|
5
|
-
value.__debugExpressionKind === 'array';
|
|
6
|
-
const isDebugExpressionObjectValue = (value) => !!value &&
|
|
7
|
-
typeof value === 'object' &&
|
|
8
|
-
!Array.isArray(value) &&
|
|
9
|
-
value.__debugExpressionKind === 'object';
|
|
10
|
-
const parseQuotedValue = (text, start) => {
|
|
11
|
-
const quote = text[start];
|
|
12
|
-
if (quote !== "'" && quote !== '"')
|
|
13
|
-
throw new Error('expected quoted string');
|
|
14
|
-
let index = start + 1;
|
|
15
|
-
let value = '';
|
|
16
|
-
while (index < text.length) {
|
|
17
|
-
const character = text[index];
|
|
18
|
-
if (!character)
|
|
19
|
-
break;
|
|
20
|
-
if (character === '\\') {
|
|
21
|
-
const escaped = text[index + 1];
|
|
22
|
-
if (!escaped)
|
|
23
|
-
throw new Error('unterminated string literal');
|
|
24
|
-
if (escaped === 'n')
|
|
25
|
-
value += '\n';
|
|
26
|
-
else if (escaped === 'r')
|
|
27
|
-
value += '\r';
|
|
28
|
-
else if (escaped === 't')
|
|
29
|
-
value += '\t';
|
|
30
|
-
else
|
|
31
|
-
value += escaped;
|
|
32
|
-
index += 2;
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (character === quote)
|
|
36
|
-
return { value, next: index + 1 };
|
|
37
|
-
value += character;
|
|
38
|
-
index += 1;
|
|
39
|
-
}
|
|
40
|
-
throw new Error('unterminated string literal');
|
|
41
|
-
};
|
|
42
|
-
const tokenizeDebugExpression = (source) => {
|
|
43
|
-
const tokens = [];
|
|
44
|
-
for (let index = 0; index < source.length;) {
|
|
45
|
-
const character = source[index];
|
|
46
|
-
if (!character)
|
|
47
|
-
break;
|
|
48
|
-
if (/\s/.test(character)) {
|
|
49
|
-
index += 1;
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
if (character === '(' || character === ')') {
|
|
53
|
-
tokens.push({ type: 'paren', value: character });
|
|
54
|
-
index += 1;
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (character === '[' || character === ']') {
|
|
58
|
-
tokens.push({ type: 'bracket', value: character });
|
|
59
|
-
index += 1;
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
if (character === '.') {
|
|
63
|
-
tokens.push({ type: 'dot' });
|
|
64
|
-
index += 1;
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
const operator = operators.find((candidate) => source.startsWith(candidate, index));
|
|
68
|
-
if (operator) {
|
|
69
|
-
tokens.push({ type: 'operator', value: operator });
|
|
70
|
-
index += operator.length;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (character === "'" || character === '"') {
|
|
74
|
-
const parsed = parseQuotedValue(source, index);
|
|
75
|
-
tokens.push({ type: 'string', value: parsed.value });
|
|
76
|
-
index = parsed.next;
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
const number = source.slice(index).match(/^\d+(?:\.\d+)?/);
|
|
80
|
-
if (number?.[0]) {
|
|
81
|
-
tokens.push({ type: 'number', value: number[0] });
|
|
82
|
-
index += number[0].length;
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
const identifier = source.slice(index).match(/^[A-Za-z_]\w*/);
|
|
86
|
-
if (identifier?.[0]) {
|
|
87
|
-
if (identifier[0] === 'true' ||
|
|
88
|
-
identifier[0] === 'false' ||
|
|
89
|
-
identifier[0] === 'True' ||
|
|
90
|
-
identifier[0] === 'False') {
|
|
91
|
-
tokens.push({
|
|
92
|
-
type: 'boolean',
|
|
93
|
-
value: identifier[0] === 'true' || identifier[0] === 'True'
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
else if (identifier[0] === 'null' || identifier[0] === 'None') {
|
|
97
|
-
tokens.push({ type: 'null' });
|
|
98
|
-
}
|
|
99
|
-
else if (identifier[0] === 'and') {
|
|
100
|
-
tokens.push({ type: 'operator', value: '&&' });
|
|
101
|
-
}
|
|
102
|
-
else if (identifier[0] === 'or') {
|
|
103
|
-
tokens.push({ type: 'operator', value: '||' });
|
|
104
|
-
}
|
|
105
|
-
else if (identifier[0] === 'not') {
|
|
106
|
-
tokens.push({ type: 'operator', value: '!' });
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
tokens.push({ type: 'identifier', value: identifier[0] });
|
|
110
|
-
}
|
|
111
|
-
index += identifier[0].length;
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
throw new Error(`unsupported token near "${source.slice(index)}"`);
|
|
115
|
-
}
|
|
116
|
-
return tokens;
|
|
117
|
-
};
|
|
118
|
-
const parseDebugPreviewValueAt = (text, start = 0) => {
|
|
119
|
-
let index = start;
|
|
120
|
-
while (/\s/.test(text[index] || ''))
|
|
121
|
-
index += 1;
|
|
122
|
-
const character = text[index];
|
|
123
|
-
if (character === '[') {
|
|
124
|
-
index += 1;
|
|
125
|
-
const items = [];
|
|
126
|
-
while (true) {
|
|
127
|
-
while (/\s/.test(text[index] || ''))
|
|
128
|
-
index += 1;
|
|
129
|
-
if (text[index] === ']')
|
|
130
|
-
return { value: items, next: index + 1 };
|
|
131
|
-
if (text.startsWith('...', index)) {
|
|
132
|
-
items.truncated = true;
|
|
133
|
-
index += 3;
|
|
134
|
-
while (/\s/.test(text[index] || ''))
|
|
135
|
-
index += 1;
|
|
136
|
-
if (text[index] === ']')
|
|
137
|
-
return { value: items, next: index + 1 };
|
|
138
|
-
throw new Error('unsupported array preview');
|
|
139
|
-
}
|
|
140
|
-
const item = parseDebugPreviewValueAt(text, index);
|
|
141
|
-
items.push(item.value);
|
|
142
|
-
index = item.next;
|
|
143
|
-
while (/\s/.test(text[index] || ''))
|
|
144
|
-
index += 1;
|
|
145
|
-
if (text[index] === ',') {
|
|
146
|
-
index += 1;
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
if (text[index] === ']')
|
|
150
|
-
return { value: items, next: index + 1 };
|
|
151
|
-
throw new Error('unsupported array preview');
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (character === '(') {
|
|
155
|
-
index += 1;
|
|
156
|
-
const items = [];
|
|
157
|
-
while (true) {
|
|
158
|
-
while (/\s/.test(text[index] || ''))
|
|
159
|
-
index += 1;
|
|
160
|
-
if (text[index] === ')')
|
|
161
|
-
return { value: items, next: index + 1 };
|
|
162
|
-
if (text.startsWith('...', index)) {
|
|
163
|
-
items.truncated = true;
|
|
164
|
-
index += 3;
|
|
165
|
-
while (/\s/.test(text[index] || ''))
|
|
166
|
-
index += 1;
|
|
167
|
-
if (text[index] === ')')
|
|
168
|
-
return { value: items, next: index + 1 };
|
|
169
|
-
throw new Error('unsupported tuple preview');
|
|
170
|
-
}
|
|
171
|
-
const item = parseDebugPreviewValueAt(text, index);
|
|
172
|
-
items.push(item.value);
|
|
173
|
-
index = item.next;
|
|
174
|
-
while (/\s/.test(text[index] || ''))
|
|
175
|
-
index += 1;
|
|
176
|
-
if (text[index] === ',') {
|
|
177
|
-
index += 1;
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
if (text[index] === ')')
|
|
181
|
-
return { value: items, next: index + 1 };
|
|
182
|
-
throw new Error('unsupported tuple preview');
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (character === '{') {
|
|
186
|
-
index += 1;
|
|
187
|
-
const entries = {};
|
|
188
|
-
while (true) {
|
|
189
|
-
while (/\s/.test(text[index] || ''))
|
|
190
|
-
index += 1;
|
|
191
|
-
if (text[index] === '}')
|
|
192
|
-
return { value: entries, next: index + 1 };
|
|
193
|
-
if (text.startsWith('...', index))
|
|
194
|
-
throw new Error('unavailable');
|
|
195
|
-
let key = '';
|
|
196
|
-
if (text[index] === "'" || text[index] === '"') {
|
|
197
|
-
const parsedKey = parseQuotedValue(text, index);
|
|
198
|
-
key = parsedKey.value;
|
|
199
|
-
index = parsedKey.next;
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
const identifier = text.slice(index).match(/^[A-Za-z_]\w*/)?.[0];
|
|
203
|
-
if (!identifier)
|
|
204
|
-
throw new Error('unsupported object preview');
|
|
205
|
-
key = identifier;
|
|
206
|
-
index += identifier.length;
|
|
207
|
-
}
|
|
208
|
-
while (/\s/.test(text[index] || ''))
|
|
209
|
-
index += 1;
|
|
210
|
-
if (text[index] !== ':')
|
|
211
|
-
throw new Error('unsupported object preview');
|
|
212
|
-
index += 1;
|
|
213
|
-
const entry = parseDebugPreviewValueAt(text, index);
|
|
214
|
-
entries[key] = entry.value;
|
|
215
|
-
index = entry.next;
|
|
216
|
-
while (/\s/.test(text[index] || ''))
|
|
217
|
-
index += 1;
|
|
218
|
-
if (text[index] === ',') {
|
|
219
|
-
index += 1;
|
|
220
|
-
continue;
|
|
221
|
-
}
|
|
222
|
-
if (text[index] === '}')
|
|
223
|
-
return { value: entries, next: index + 1 };
|
|
224
|
-
throw new Error('unsupported object preview');
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
if (character === "'" || character === '"')
|
|
228
|
-
return parseQuotedValue(text, index);
|
|
229
|
-
if (text.startsWith('true', index))
|
|
230
|
-
return { value: true, next: index + 4 };
|
|
231
|
-
if (text.startsWith('false', index))
|
|
232
|
-
return { value: false, next: index + 5 };
|
|
233
|
-
if (text.startsWith('True', index))
|
|
234
|
-
return { value: true, next: index + 4 };
|
|
235
|
-
if (text.startsWith('False', index))
|
|
236
|
-
return { value: false, next: index + 5 };
|
|
237
|
-
if (text.startsWith('null', index))
|
|
238
|
-
return { value: null, next: index + 4 };
|
|
239
|
-
if (text.startsWith('None', index))
|
|
240
|
-
return { value: null, next: index + 4 };
|
|
241
|
-
const number = text.slice(index).match(/^-?\d+(?:\.\d+)?/);
|
|
242
|
-
if (number?.[0])
|
|
243
|
-
return { value: Number(number[0]), next: index + number[0].length };
|
|
244
|
-
throw new Error('unsupported preview');
|
|
245
|
-
};
|
|
246
|
-
export const parseStoredDebugValue = (value) => {
|
|
247
|
-
const source = value.trim();
|
|
248
|
-
if (!source || source === '?')
|
|
249
|
-
throw new Error('unavailable');
|
|
250
|
-
if (source === 'true' || source === 'false' || source === 'True' || source === 'False') {
|
|
251
|
-
return source === 'true' || source === 'True';
|
|
252
|
-
}
|
|
253
|
-
if (source === 'null' || source === 'None')
|
|
254
|
-
return null;
|
|
255
|
-
const numeric = Number(source);
|
|
256
|
-
if (!Number.isNaN(numeric))
|
|
257
|
-
return numeric;
|
|
258
|
-
if (source.startsWith('[') ||
|
|
259
|
-
source.startsWith('(') ||
|
|
260
|
-
source.startsWith('{') ||
|
|
261
|
-
source.startsWith("'") ||
|
|
262
|
-
source.startsWith('"')) {
|
|
263
|
-
const parsed = parseDebugPreviewValueAt(source);
|
|
264
|
-
const trailing = source.slice(parsed.next).trim();
|
|
265
|
-
if (trailing)
|
|
266
|
-
throw new Error('unsupported preview');
|
|
267
|
-
return parsed.value;
|
|
268
|
-
}
|
|
269
|
-
throw new Error('unsupported preview');
|
|
270
|
-
};
|
|
271
|
-
const quoteDebugString = (value) => `'${value
|
|
272
|
-
.replaceAll('\\', '\\\\')
|
|
273
|
-
.replaceAll("'", "\\'")
|
|
274
|
-
.replaceAll('\n', '\\n')
|
|
275
|
-
.replaceAll('\r', '\\r')
|
|
276
|
-
.replaceAll('\t', '\\t')}'`;
|
|
277
|
-
const formatDebugExpressionValueInternal = (value, nested, depth) => {
|
|
278
|
-
if (value === null)
|
|
279
|
-
return 'null';
|
|
280
|
-
if (typeof value === 'number' || typeof value === 'boolean')
|
|
281
|
-
return `${value}`;
|
|
282
|
-
if (typeof value === 'string')
|
|
283
|
-
return nested ? quoteDebugString(value) : value;
|
|
284
|
-
if (depth >= 4)
|
|
285
|
-
return '...';
|
|
286
|
-
if (Array.isArray(value)) {
|
|
287
|
-
const previewLength = Math.min(value.length, 8);
|
|
288
|
-
const items = value
|
|
289
|
-
.slice(0, previewLength)
|
|
290
|
-
.map((entry) => formatDebugExpressionValueInternal(entry, true, depth + 1));
|
|
291
|
-
return `[${items.join(', ')}${value.truncated || value.length > previewLength ? ', ...' : ''}]`;
|
|
292
|
-
}
|
|
293
|
-
if (isDebugExpressionIndexedValue(value)) {
|
|
294
|
-
const indexes = value.keys?.() || [];
|
|
295
|
-
const previewLength = Math.min(indexes.length || value.length || 0, 8);
|
|
296
|
-
const items = [];
|
|
297
|
-
for (let index = 0; index < previewLength; index += 1) {
|
|
298
|
-
const resolvedIndex = indexes[index] ?? index;
|
|
299
|
-
items.push(formatDebugExpressionValueInternal(value.get(resolvedIndex), true, depth + 1));
|
|
300
|
-
}
|
|
301
|
-
const isTruncated = value.truncated || (value.length != null && value.length > previewLength);
|
|
302
|
-
return `[${items.join(', ')}${isTruncated ? ', ...' : ''}]`;
|
|
303
|
-
}
|
|
304
|
-
if (isDebugExpressionObjectValue(value)) {
|
|
305
|
-
const keys = value.keys?.() || [];
|
|
306
|
-
const previewLength = Math.min(keys.length, 8);
|
|
307
|
-
const entries = keys.slice(0, previewLength).map((key) => {
|
|
308
|
-
return `${key}: ${formatDebugExpressionValueInternal(value.get(key), true, depth + 1)}`;
|
|
309
|
-
});
|
|
310
|
-
return `{${entries.join(', ')}${keys.length > previewLength ? ', ...' : ''}}`;
|
|
311
|
-
}
|
|
312
|
-
const keys = Object.keys(value);
|
|
313
|
-
const previewLength = Math.min(keys.length, 8);
|
|
314
|
-
const entries = keys.slice(0, previewLength).map((key) => {
|
|
315
|
-
return `${key}: ${formatDebugExpressionValueInternal(value[key], true, depth + 1)}`;
|
|
316
|
-
});
|
|
317
|
-
return `{${entries.join(', ')}${keys.length > previewLength ? ', ...' : ''}}`;
|
|
318
|
-
};
|
|
319
|
-
export const formatDebugExpressionValue = (value) => formatDebugExpressionValueInternal(value, false, 0);
|
|
320
|
-
export const evaluateDebugExpressionWithResolver = (expression, resolveIdentifier) => {
|
|
321
|
-
const source = expression.trim();
|
|
322
|
-
if (!source)
|
|
323
|
-
throw new Error('empty expression');
|
|
324
|
-
const tokens = tokenizeDebugExpression(source);
|
|
325
|
-
const parsedValues = new Map();
|
|
326
|
-
const resolveIdentifierValue = (name) => {
|
|
327
|
-
if (parsedValues.has(name))
|
|
328
|
-
return parsedValues.get(name);
|
|
329
|
-
const value = resolveIdentifier(name);
|
|
330
|
-
parsedValues.set(name, value);
|
|
331
|
-
return value;
|
|
332
|
-
};
|
|
333
|
-
const readIndexedValue = (value, index) => {
|
|
334
|
-
if (!Number.isInteger(index))
|
|
335
|
-
throw new Error('unsupported index access');
|
|
336
|
-
if (Array.isArray(value)) {
|
|
337
|
-
if (index < 0 || index >= value.length)
|
|
338
|
-
throw new Error('unavailable');
|
|
339
|
-
return value[index];
|
|
340
|
-
}
|
|
341
|
-
if (isDebugExpressionIndexedValue(value)) {
|
|
342
|
-
if (value.length != null && (index < 0 || index >= value.length)) {
|
|
343
|
-
throw new Error('unavailable');
|
|
344
|
-
}
|
|
345
|
-
return value.get(index);
|
|
346
|
-
}
|
|
347
|
-
throw new Error('unsupported index access');
|
|
348
|
-
};
|
|
349
|
-
const readMemberValue = (value, name) => {
|
|
350
|
-
if (Array.isArray(value) || isDebugExpressionIndexedValue(value) || !value) {
|
|
351
|
-
throw new Error('unsupported member access');
|
|
352
|
-
}
|
|
353
|
-
if (isDebugExpressionObjectValue(value)) {
|
|
354
|
-
if (!value.has(name))
|
|
355
|
-
throw new Error('unavailable');
|
|
356
|
-
return value.get(name);
|
|
357
|
-
}
|
|
358
|
-
if (typeof value !== 'object' || !Object.hasOwn(value, name))
|
|
359
|
-
throw new Error('unavailable');
|
|
360
|
-
return value[name];
|
|
361
|
-
};
|
|
362
|
-
let cursor = 0;
|
|
363
|
-
const parsePrimary = () => {
|
|
364
|
-
const token = tokens[cursor];
|
|
365
|
-
if (!token)
|
|
366
|
-
throw new Error('unexpected end of expression');
|
|
367
|
-
if (token.type === 'number') {
|
|
368
|
-
cursor += 1;
|
|
369
|
-
return Number(token.value);
|
|
370
|
-
}
|
|
371
|
-
if (token.type === 'boolean') {
|
|
372
|
-
cursor += 1;
|
|
373
|
-
return token.value;
|
|
374
|
-
}
|
|
375
|
-
if (token.type === 'null') {
|
|
376
|
-
cursor += 1;
|
|
377
|
-
return null;
|
|
378
|
-
}
|
|
379
|
-
if (token.type === 'string') {
|
|
380
|
-
cursor += 1;
|
|
381
|
-
return token.value;
|
|
382
|
-
}
|
|
383
|
-
if (token.type === 'identifier') {
|
|
384
|
-
cursor += 1;
|
|
385
|
-
let resolved = resolveIdentifierValue(token.value);
|
|
386
|
-
while (true) {
|
|
387
|
-
const bracket = tokens[cursor];
|
|
388
|
-
if (bracket?.type === 'bracket' && bracket.value === '[') {
|
|
389
|
-
cursor += 1;
|
|
390
|
-
const index = Number(parseOr());
|
|
391
|
-
const closing = tokens[cursor];
|
|
392
|
-
if (!closing || closing.type !== 'bracket' || closing.value !== ']')
|
|
393
|
-
throw new Error('missing closing bracket');
|
|
394
|
-
cursor += 1;
|
|
395
|
-
resolved = readIndexedValue(resolved, index);
|
|
396
|
-
continue;
|
|
397
|
-
}
|
|
398
|
-
if (bracket?.type === 'dot') {
|
|
399
|
-
cursor += 1;
|
|
400
|
-
const property = tokens[cursor];
|
|
401
|
-
if (!property || property.type !== 'identifier')
|
|
402
|
-
throw new Error('missing property name');
|
|
403
|
-
cursor += 1;
|
|
404
|
-
resolved = readMemberValue(resolved, property.value);
|
|
405
|
-
continue;
|
|
406
|
-
}
|
|
407
|
-
break;
|
|
408
|
-
}
|
|
409
|
-
return resolved;
|
|
410
|
-
}
|
|
411
|
-
if (token.type === 'paren' && token.value === '(') {
|
|
412
|
-
cursor += 1;
|
|
413
|
-
const result = parseOr();
|
|
414
|
-
const closing = tokens[cursor];
|
|
415
|
-
if (!closing || closing.type !== 'paren' || closing.value !== ')')
|
|
416
|
-
throw new Error('missing closing parenthesis');
|
|
417
|
-
cursor += 1;
|
|
418
|
-
return result;
|
|
419
|
-
}
|
|
420
|
-
throw new Error('expected value');
|
|
421
|
-
};
|
|
422
|
-
const parseUnary = () => {
|
|
423
|
-
const token = tokens[cursor];
|
|
424
|
-
if (token?.type === 'operator' && token.value === '!') {
|
|
425
|
-
cursor += 1;
|
|
426
|
-
return !Boolean(parseUnary());
|
|
427
|
-
}
|
|
428
|
-
if (token?.type === 'operator' && token.value === '-') {
|
|
429
|
-
cursor += 1;
|
|
430
|
-
return -Number(parseUnary());
|
|
431
|
-
}
|
|
432
|
-
if (token?.type === 'operator' && token.value === '+') {
|
|
433
|
-
cursor += 1;
|
|
434
|
-
return Number(parseUnary());
|
|
435
|
-
}
|
|
436
|
-
return parsePrimary();
|
|
437
|
-
};
|
|
438
|
-
const parseMul = () => {
|
|
439
|
-
let left = parseUnary();
|
|
440
|
-
while (true) {
|
|
441
|
-
const operator = tokens[cursor];
|
|
442
|
-
if (operator?.type !== 'operator' || !['*', '/', '%'].includes(operator.value)) {
|
|
443
|
-
return left;
|
|
444
|
-
}
|
|
445
|
-
cursor += 1;
|
|
446
|
-
const right = parseUnary();
|
|
447
|
-
if (operator.value === '*')
|
|
448
|
-
left = Number(left) * Number(right);
|
|
449
|
-
if (operator.value === '/')
|
|
450
|
-
left = Number(left) / Number(right);
|
|
451
|
-
if (operator.value === '%')
|
|
452
|
-
left = Number(left) % Number(right);
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
const parseAdd = () => {
|
|
456
|
-
let left = parseMul();
|
|
457
|
-
while (true) {
|
|
458
|
-
const operator = tokens[cursor];
|
|
459
|
-
if (operator?.type !== 'operator' || !['+', '-'].includes(operator.value))
|
|
460
|
-
return left;
|
|
461
|
-
cursor += 1;
|
|
462
|
-
const right = parseMul();
|
|
463
|
-
if (operator.value === '+') {
|
|
464
|
-
if (typeof left === 'string' || typeof right === 'string') {
|
|
465
|
-
left = `${left ?? 'null'}${right ?? 'null'}`;
|
|
466
|
-
}
|
|
467
|
-
else {
|
|
468
|
-
left = Number(left) + Number(right);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
if (operator.value === '-')
|
|
472
|
-
left = Number(left) - Number(right);
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
const parseCompare = () => {
|
|
476
|
-
let left = parseAdd();
|
|
477
|
-
while (true) {
|
|
478
|
-
const operator = tokens[cursor];
|
|
479
|
-
if (operator?.type !== 'operator' || !['<', '<=', '>', '>='].includes(operator.value)) {
|
|
480
|
-
return left;
|
|
481
|
-
}
|
|
482
|
-
cursor += 1;
|
|
483
|
-
const right = parseAdd();
|
|
484
|
-
const leftValue = typeof left === 'string' && typeof right === 'string' ? left : Number(left);
|
|
485
|
-
const rightValue = typeof left === 'string' && typeof right === 'string' ? right : Number(right);
|
|
486
|
-
if (operator.value === '<')
|
|
487
|
-
left = leftValue < rightValue;
|
|
488
|
-
if (operator.value === '<=')
|
|
489
|
-
left = leftValue <= rightValue;
|
|
490
|
-
if (operator.value === '>')
|
|
491
|
-
left = leftValue > rightValue;
|
|
492
|
-
if (operator.value === '>=')
|
|
493
|
-
left = leftValue >= rightValue;
|
|
494
|
-
}
|
|
495
|
-
};
|
|
496
|
-
const parseEquality = () => {
|
|
497
|
-
let left = parseCompare();
|
|
498
|
-
while (true) {
|
|
499
|
-
const operator = tokens[cursor];
|
|
500
|
-
if (operator?.type !== 'operator' || !['==', '!='].includes(operator.value))
|
|
501
|
-
return left;
|
|
502
|
-
cursor += 1;
|
|
503
|
-
const right = parseCompare();
|
|
504
|
-
if (operator.value === '==')
|
|
505
|
-
left = left === right;
|
|
506
|
-
if (operator.value === '!=')
|
|
507
|
-
left = left !== right;
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
const parseAnd = () => {
|
|
511
|
-
let left = parseEquality();
|
|
512
|
-
while (true) {
|
|
513
|
-
const operator = tokens[cursor];
|
|
514
|
-
if (!operator || operator.type !== 'operator' || operator.value !== '&&')
|
|
515
|
-
break;
|
|
516
|
-
cursor += 1;
|
|
517
|
-
left = Boolean(left) && Boolean(parseEquality());
|
|
518
|
-
}
|
|
519
|
-
return left;
|
|
520
|
-
};
|
|
521
|
-
const parseOr = () => {
|
|
522
|
-
let left = parseAnd();
|
|
523
|
-
while (true) {
|
|
524
|
-
const operator = tokens[cursor];
|
|
525
|
-
if (!operator || operator.type !== 'operator' || operator.value !== '||')
|
|
526
|
-
break;
|
|
527
|
-
cursor += 1;
|
|
528
|
-
left = Boolean(left) || Boolean(parseAnd());
|
|
529
|
-
}
|
|
530
|
-
return left;
|
|
531
|
-
};
|
|
532
|
-
const result = parseOr();
|
|
533
|
-
if (cursor !== tokens.length)
|
|
534
|
-
throw new Error('unexpected trailing tokens');
|
|
535
|
-
return formatDebugExpressionValue(result);
|
|
536
|
-
};
|
|
537
|
-
export function evaluateDebugExpression(expression, variables) {
|
|
538
|
-
const values = new Map();
|
|
539
|
-
for (const variable of variables)
|
|
540
|
-
values.set(variable.name, variable.value);
|
|
541
|
-
return evaluateDebugExpressionWithResolver(expression, (name) => {
|
|
542
|
-
const value = values.get(name);
|
|
543
|
-
if (value == null || value === '?')
|
|
544
|
-
throw new Error('unavailable');
|
|
545
|
-
return parseStoredDebugValue(value);
|
|
546
|
-
});
|
|
547
|
-
}
|
package/dist/debug/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { evaluateDebugExpression } from './expression';
|
|
2
|
-
export { selectInlineDebugLocals } from './locals';
|
|
3
|
-
export { cppDebugLanguageAdapter, pythonDebugLanguageAdapter } from './language';
|
|
4
|
-
export { createDebugSessionController } from './controller.svelte';
|
|
5
|
-
export { MonacoDebugView, attachMonacoDebugActions } from './editor';
|
|
6
|
-
export type { DebugLanguageAdapter } from './language';
|
|
7
|
-
export type { DebugSessionController, DebugSessionControllerOptions, DebugWatchValue } from './controller.svelte';
|
|
8
|
-
export type { MonacoDebugActionsOptions } from './editor';
|
package/dist/debug/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { evaluateDebugExpression } from './expression';
|
|
2
|
-
export { selectInlineDebugLocals } from './locals';
|
|
3
|
-
export { cppDebugLanguageAdapter, pythonDebugLanguageAdapter } from './language';
|
|
4
|
-
export { createDebugSessionController } from './controller.svelte';
|
|
5
|
-
export { MonacoDebugView, attachMonacoDebugActions } from './editor';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { evaluateDebugExpression } from '../expression';
|
|
2
|
-
const selectInlinePythonLocals = (lineText, locals) => {
|
|
3
|
-
const sanitized = lineText
|
|
4
|
-
.replace(/#.*$/g, ' ')
|
|
5
|
-
.replace(/"(?:\\.|[^"\\])*"/g, ' ')
|
|
6
|
-
.replace(/'(?:\\.|[^'\\])*'/g, ' ');
|
|
7
|
-
const identifiers = new Set(sanitized.match(/[A-Za-z_]\w*/g) || []);
|
|
8
|
-
return locals.filter((variable) => identifiers.has(variable.name));
|
|
9
|
-
};
|
|
10
|
-
export const pythonDebugLanguageAdapter = {
|
|
11
|
-
id: 'python',
|
|
12
|
-
evaluateExpression: evaluateDebugExpression,
|
|
13
|
-
selectInlineLocals: selectInlinePythonLocals
|
|
14
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DebugVariable } from '../../playground/options';
|
|
2
|
-
export interface DebugLanguageAdapter {
|
|
3
|
-
id: string;
|
|
4
|
-
evaluateExpression: (expression: string, locals: DebugVariable[]) => string;
|
|
5
|
-
selectInlineLocals: (lineText: string, locals: DebugVariable[]) => DebugVariable[];
|
|
6
|
-
}
|
package/dist/debug/locals.d.ts
DELETED
package/dist/debug/locals.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export function selectInlineDebugLocals(lineText, locals) {
|
|
2
|
-
const sanitized = lineText
|
|
3
|
-
.replace(/\/\/.*$/g, ' ')
|
|
4
|
-
.replace(/"(?:\\.|[^"\\])*"/g, ' ')
|
|
5
|
-
.replace(/'(?:\\.|[^'\\])*'/g, ' ');
|
|
6
|
-
const identifiers = new Set(sanitized.match(/[A-Za-z_]\w*/g) || []);
|
|
7
|
-
return locals.filter((variable) => identifiers.has(variable.name));
|
|
8
|
-
}
|
package/dist/lsp/cpp/server.d.ts
DELETED