From d64c39db829e8d6f836048895e596fba92f3aa4a Mon Sep 17 00:00:00 2001 From: Yura Dupyn <2153100+omedusyo@users.noreply.github.com> Date: Mon, 6 Apr 2026 20:34:20 +0200 Subject: [PATCH] Renaming and `source-region` issues --- libs/source-region | 2 +- package-lock.json | 393 +++++++++++++++++- package.json | 2 +- src/lang/debug/repl.ts | 2 +- src/lang/expr.ts | 2 +- src/lang/parser/cursor.test.ts | 10 +- src/lang/parser/cursor.ts | 13 +- src/lang/parser/parser.ts | 2 +- src/lang/parser/scanner.ts | 4 +- src/ui/Component/LineView.tsx | 2 +- src/ui/Component/ParseError.tsx | 2 +- src/ui/Digith/DigithError.tsx | 2 +- src/ui/Digith/Function/FunctionDigith.tsx | 2 +- .../Function/NewFunctionDraftDigith.tsx | 2 +- src/ui/Digith/REPL.tsx | 2 +- src/ui/Digith/Signal/NewSignalDraftDigith.tsx | 2 +- src/ui/Digith/Signal/SignalDigith.tsx | 2 +- src/ui/validation/helpers.ts | 2 +- vite.renderer.config.ts | 3 + 19 files changed, 415 insertions(+), 36 deletions(-) diff --git a/libs/source-region b/libs/source-region index beab541..2f5ead6 160000 --- a/libs/source-region +++ b/libs/source-region @@ -1 +1 @@ -Subproject commit beab541907abc8b204d63050e4d4dab82cc7db50 +Subproject commit 2f5ead6d688379c2393e95e24c3e36d3496c360d diff --git a/package-lock.json b/package-lock.json index 702fd1a..6044d5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "codemirror": "^6.0.2", "electron-squirrel-startup": "^1.0.1", "solid-js": "^1.9.11", - "source-text": "file:libs/source-region" + "source-region": "file:libs/source-region" }, "devDependencies": { "@electron-forge/cli": "^7.11.1", @@ -44,10 +44,10 @@ } }, "libs/source-region": { - "name": "source-region", "version": "0.1.0", "license": "GPL-3.0-or-later", "devDependencies": { + "tsup": "^8.5.1", "typescript": "^5.4.0" } }, @@ -3798,9 +3798,9 @@ "license": "ISC" }, "node_modules/acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", + "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "dev": true, "license": "MIT", "bin": { @@ -3987,6 +3987,13 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -4384,6 +4391,32 @@ "dev": true, "license": "MIT" }, + "node_modules/bundle-require": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-5.1.0.tgz", + "integrity": "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "load-tsconfig": "^0.2.3" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "esbuild": ">=0.18" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/cacache": { "version": "16.1.3", "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.3.tgz", @@ -4598,7 +4631,6 @@ "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", "dev": true, "license": "MIT", - "optional": true, "dependencies": { "readdirp": "^4.0.1" }, @@ -4859,6 +4891,23 @@ "dev": true, "license": "MIT" }, + "node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/consola": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", + "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -6718,6 +6767,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/fix-dts-default-cjs-exports": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz", + "integrity": "sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "magic-string": "^0.30.17", + "mlly": "^1.7.4", + "rollup": "^4.34.8" + } + }, "node_modules/flat-cache": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", @@ -8048,6 +8109,16 @@ "jiti": "lib/jiti-cli.mjs" } }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -8177,6 +8248,26 @@ "node": ">= 0.8.0" } }, + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, "node_modules/listr2": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/listr2/-/listr2-7.0.2.tgz", @@ -8271,6 +8362,16 @@ "node": ">=4" } }, + "node_modules/load-tsconfig": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz", + "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/loader-runner": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.1.tgz", @@ -8469,6 +8570,16 @@ "node": ">=12" } }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -8779,6 +8890,19 @@ "node": ">=10" } }, + "node_modules/mlly": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.2.tgz", + "integrity": "sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.16.0", + "pathe": "^2.0.3", + "pkg-types": "^1.3.1", + "ufo": "^1.6.3" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -8796,6 +8920,18 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, "node_modules/nanoid": { "version": "3.3.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", @@ -8980,6 +9116,16 @@ "node": ">=4" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-inspect": { "version": "1.13.4", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", @@ -9407,6 +9553,13 @@ "node": ">=4" } }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, "node_modules/pe-library": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/pe-library/-/pe-library-1.0.1.tgz", @@ -9459,6 +9612,28 @@ "node": ">=0.10.0" } }, + "node_modules/pirates": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, "node_modules/plist": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", @@ -9513,6 +9688,49 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/postcss-load-config": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", + "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "lilconfig": "^3.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, "node_modules/postject": { "version": "1.0.0-alpha.6", "resolved": "https://registry.npmjs.org/postject/-/postject-1.0.0-alpha.6.tgz", @@ -9797,7 +10015,6 @@ "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", "dev": true, "license": "MIT", - "optional": true, "engines": { "node": ">= 14.18.0" }, @@ -11017,7 +11234,7 @@ "source-map": "^0.6.0" } }, - "node_modules/source-text": { + "node_modules/source-region": { "resolved": "libs/source-region", "link": true }, @@ -11283,6 +11500,39 @@ "integrity": "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==", "license": "MIT" }, + "node_modules/sucrase": { + "version": "3.35.1", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", + "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "tinyglobby": "^0.2.11", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/sucrase/node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, "node_modules/sumchecker": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz", @@ -11493,6 +11743,29 @@ "dev": true, "license": "MIT" }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/tiny-each-async": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/tiny-each-async/-/tiny-each-async-2.0.3.tgz", @@ -11501,6 +11774,13 @@ "license": "MIT", "optional": true }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "dev": true, + "license": "MIT" + }, "node_modules/tinyglobby": { "version": "0.2.15", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", @@ -11604,6 +11884,16 @@ "dev": true, "license": "MIT" }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, "node_modules/trim-repeated": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", @@ -11640,6 +11930,13 @@ "typescript": ">=4.8.4" } }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", @@ -11704,6 +12001,79 @@ "dev": true, "license": "0BSD" }, + "node_modules/tsup": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.5.1.tgz", + "integrity": "sha512-xtgkqwdhpKWr3tKPmCkvYmS9xnQK3m3XgxZHwSUjvfTjp7YfXe5tT3GgWi0F2N+ZSMsOeWeZFh7ZZFg5iPhing==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-require": "^5.1.0", + "cac": "^6.7.14", + "chokidar": "^4.0.3", + "consola": "^3.4.0", + "debug": "^4.4.0", + "esbuild": "^0.27.0", + "fix-dts-default-cjs-exports": "^1.0.0", + "joycon": "^3.1.1", + "picocolors": "^1.1.1", + "postcss-load-config": "^6.0.1", + "resolve-from": "^5.0.0", + "rollup": "^4.34.8", + "source-map": "^0.7.6", + "sucrase": "^3.35.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.11", + "tree-kill": "^1.2.2" + }, + "bin": { + "tsup": "dist/cli-default.js", + "tsup-node": "dist/cli-node.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@microsoft/api-extractor": "^7.36.0", + "@swc/core": "^1", + "postcss": "^8.4.12", + "typescript": ">=4.5.0" + }, + "peerDependenciesMeta": { + "@microsoft/api-extractor": { + "optional": true + }, + "@swc/core": { + "optional": true + }, + "postcss": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/tsup/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/tsup/node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -11822,6 +12192,13 @@ "node": ">=14.17" } }, + "node_modules/ufo": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", + "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "dev": true, + "license": "MIT" + }, "node_modules/unbox-primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", diff --git a/package.json b/package.json index fe37a56..3554a06 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,6 @@ "codemirror": "^6.0.2", "electron-squirrel-startup": "^1.0.1", "solid-js": "^1.9.11", - "source-text": "file:libs/source-region" + "source-region": "file:libs/source-region" } } diff --git a/src/lang/debug/repl.ts b/src/lang/debug/repl.ts index 5e6b7d9..ec3418c 100644 --- a/src/lang/debug/repl.ts +++ b/src/lang/debug/repl.ts @@ -2,7 +2,7 @@ import * as readline from 'readline'; import * as fs from 'fs'; import { parseExpr, ParseError } from '../parser/parser'; -import { SourceRegion, SourceText, renderSpan, sourceText } from 'source-text'; +import { SourceRegion, SourceText, renderSpan, sourceText } from 'source-region'; import { exprToString } from '../debug/expr_show'; import { valueToString } from '../debug/value_show'; import { Program } from '../program'; diff --git a/src/lang/expr.ts b/src/lang/expr.ts index f7b0c7d..104a0c6 100644 --- a/src/lang/expr.ts +++ b/src/lang/expr.ts @@ -1,4 +1,4 @@ -import { Span } from "source-text" +import { Span } from "source-region" // === Identifiers === export type VariableName = string diff --git a/src/lang/parser/cursor.test.ts b/src/lang/parser/cursor.test.ts index 908a90e..8b1ead7 100644 --- a/src/lang/parser/cursor.test.ts +++ b/src/lang/parser/cursor.test.ts @@ -1,5 +1,5 @@ // AI GENERATED -import { SourceText, sourceText } from "source-text"; +import { SourceText, sourceText } from "source-region"; import { Cursor, scanString, scanNumber } from "./cursor"; import { Result } from "../result"; @@ -189,8 +189,8 @@ function test_cursor_tracking() { // Check location after scan (should be after 123, before \r) // Actually r1.value.span tells us where the token WAS. const span1 = (r1 as any).value.span; - assert(span1.line === 1, "Line 1 line# wrong"); - assert(span1.column === 1, "Line 1 col# wrong"); + assert(span1.start.line === 1, "Line 1 line# wrong"); + assert(span1.start.column === 1, "Line 1 col# wrong"); // 2. Skip Whitespace (Scanner logic simulation) // We need to manually skip \r\n @@ -201,7 +201,7 @@ function test_cursor_tracking() { const r2 = scanNumber(cursor); assertOk(r2, 456); const span2 = (r2 as any).value.span; - assert(span2.line === 2, "Line 2 line# wrong"); + assert(span2.start.line === 2, "Line 2 line# wrong"); // 4. Skip \n cursor.next(); @@ -210,7 +210,7 @@ function test_cursor_tracking() { const r3 = scanString(cursor); assertOk(r3, "foo"); const span3 = (r3 as any).value.span; - assert(span3.line === 3, "Line 3 line# wrong"); + assert(span3.start.line === 3, "Line 3 line# wrong"); console.log(`${GREEN}✔ Cursor tracking passed${RESET}`); } diff --git a/src/lang/parser/cursor.ts b/src/lang/parser/cursor.ts index 1bb72c1..87a7867 100644 --- a/src/lang/parser/cursor.ts +++ b/src/lang/parser/cursor.ts @@ -1,5 +1,5 @@ -import { char, NEW_LINE, CARRIAGE_RETURN, DOT, DIGIT_0, DIGIT_9, LOWERCASE_a, LOWERCASE_f, UPPERCASE_A, UPPERCASE_F, SPACE, TAB } from 'source-text'; -import type { SourceRegion, SourceText, Span, SourceLocation, CodePoint, StringIndex, CodePointIndex } from 'source-text'; +import { char, NEW_LINE, CARRIAGE_RETURN, DOT, DIGIT_0, DIGIT_9, LOWERCASE_a, LOWERCASE_f, UPPERCASE_A, UPPERCASE_F, SPACE, TAB } from 'source-region'; +import type { SourceRegion, SourceText, Span, SourceLocation, CodePoint, StringIndex, CodePointIndex } from 'source-region'; import { Result } from '../result'; export type CursorState = { @@ -43,15 +43,14 @@ export class Cursor { peek(n: number = 0): CodePoint | undefined { if (this.index + n >= this.region.span.end.index) return undefined; - return this.text.chars[this.index + n]?.char; + return this.region.codePointAt(this.index + n); } next(): CodePoint | undefined { if (this.eof()) return undefined; - const ref = this.text.chars[this.index]; - if (!ref) return undefined; + const c = this.region.codePointAt(this.index); + if (c === undefined) return undefined; - const c = ref.char; this.index++; if (c === NEW_LINE) { @@ -82,7 +81,7 @@ export class Cursor { // TODO: unicode-index ~> string-offset, make that into a separate function. currentOffset(): StringIndex { - return this.text.chars[this.index]?.offset ?? this.text.source.length; + return this.text.sliceByCp(0, this.index).length; } currentLocation(): SourceLocation { diff --git a/src/lang/parser/parser.ts b/src/lang/parser/parser.ts index 7c024fa..709a8f8 100644 --- a/src/lang/parser/parser.ts +++ b/src/lang/parser/parser.ts @@ -1,6 +1,6 @@ import { Cursor } from './cursor'; import { ExprScanError, exprStart, ExprStartToken, IdentifierKind, identifierScanner, isNextTokenExprStart, isNextTokenProductPatternStart, patternStart, PatternStartToken, signalExprStart, SignalExprStartToken, skipWhitespaceAndComments } from './scanner'; -import { char, CodePoint, SourceRegion, SourceText, Span } from 'source-text'; +import { char, CodePoint, SourceRegion, SourceText, Span } from 'source-region'; import { Result } from '../result'; import { Expr, ExprBinding, FieldAssignment, FieldPattern, FunctionName, MatchBranch, Pattern, ProductPattern, SignalExpr, SignalExprBinding } from '../expr'; diff --git a/src/lang/parser/scanner.ts b/src/lang/parser/scanner.ts index b9c6abe..7030750 100644 --- a/src/lang/parser/scanner.ts +++ b/src/lang/parser/scanner.ts @@ -1,5 +1,5 @@ -import { CARRIAGE_RETURN, char, NEW_LINE } from 'source-text'; -import type { Span, CodePoint } from 'source-text'; +import { CARRIAGE_RETURN, char, NEW_LINE } from 'source-region'; +import type { Span, CodePoint } from 'source-region'; import { isDigit, isWhitespace, scanNumber, scanString } from './cursor'; import type { Cursor, GenericScanError, NumberError, StringError } from './cursor'; diff --git a/src/ui/Component/LineView.tsx b/src/ui/Component/LineView.tsx index a41fe2c..4329fb3 100644 --- a/src/ui/Component/LineView.tsx +++ b/src/ui/Component/LineView.tsx @@ -1,4 +1,4 @@ -import { LineView } from "source-text"; +import { LineView } from "source-region"; import { For, Show } from "solid-js"; export function DisplayLineView(prop: { view: LineView }) { diff --git a/src/ui/Component/ParseError.tsx b/src/ui/Component/ParseError.tsx index dd251ab..6a7331b 100644 --- a/src/ui/Component/ParseError.tsx +++ b/src/ui/Component/ParseError.tsx @@ -1,5 +1,5 @@ import { ParseError } from "src/lang/parser/parser"; -import { renderSpan, SourceRegion } from "source-text"; +import { renderSpan, SourceRegion } from "source-region"; import { DisplayLineViews } from "./LineView"; export function formatErrorMesage(err: ParseError): string { diff --git a/src/ui/Digith/DigithError.tsx b/src/ui/Digith/DigithError.tsx index 266b691..076e423 100644 --- a/src/ui/Digith/DigithError.tsx +++ b/src/ui/Digith/DigithError.tsx @@ -1,6 +1,6 @@ import { For, Match, Show, Switch } from "solid-js"; import { ParseError } from "src/lang/parser/parser"; -import { SourceRegion } from "source-text"; +import { SourceRegion } from "source-region"; import { ShowParseError } from 'src/ui/Component/ParseError'; import { Program } from "src/lang/program"; diff --git a/src/ui/Digith/Function/FunctionDigith.tsx b/src/ui/Digith/Function/FunctionDigith.tsx index 3c59570..773e293 100644 --- a/src/ui/Digith/Function/FunctionDigith.tsx +++ b/src/ui/Digith/Function/FunctionDigith.tsx @@ -2,7 +2,7 @@ import { createSignal, Show } from "solid-js"; import { Digith } from "src/ui/Digith"; import { useProgram } from "src/ui/ProgramProvider"; import { CodeEditor } from "src/ui/Component/CodeEditor"; -import { sourceText } from "source-text"; +import { sourceText } from "source-region"; import { Program } from "src/lang/program"; import { V, Validation, letValidate } from "src/ui/validation"; import { validateExprRaw, validateParamsRaw } from "src/ui/validation/helpers"; diff --git a/src/ui/Digith/Function/NewFunctionDraftDigith.tsx b/src/ui/Digith/Function/NewFunctionDraftDigith.tsx index 8742c6c..4750973 100644 --- a/src/ui/Digith/Function/NewFunctionDraftDigith.tsx +++ b/src/ui/Digith/Function/NewFunctionDraftDigith.tsx @@ -2,7 +2,7 @@ import { createSignal } from "solid-js"; import { Digith } from "src/ui/Digith"; import { useProgram } from "src/ui/ProgramProvider"; import { CodeEditor } from "src/ui/Component/CodeEditor"; -import { sourceText } from "source-text"; +import { sourceText } from "source-region"; import { Program } from "src/lang/program"; import { V, Validation, letValidate } from "src/ui/validation"; import { validateExprRaw, validateNameRaw, validateParamsRaw } from "src/ui/validation/helpers"; diff --git a/src/ui/Digith/REPL.tsx b/src/ui/Digith/REPL.tsx index c10f48a..ef06477 100644 --- a/src/ui/Digith/REPL.tsx +++ b/src/ui/Digith/REPL.tsx @@ -3,7 +3,7 @@ import { useProgram } from 'src/ui/ProgramProvider'; import { eval_start } from 'src/lang/eval/evaluator'; import { Value } from 'src/lang/eval/value'; import { RuntimeError } from 'src/lang/eval/error'; -import { SourceRegion, SourceText, sourceText } from 'source-text'; +import { SourceRegion, SourceText, sourceText } from 'source-region'; import { ParseError, parseExpr } from 'src/lang/parser/parser'; import { ShowParseError } from 'src/ui/Component/ParseError'; import { Val } from 'src/ui/Component/Value'; diff --git a/src/ui/Digith/Signal/NewSignalDraftDigith.tsx b/src/ui/Digith/Signal/NewSignalDraftDigith.tsx index a8a3da7..a025fad 100644 --- a/src/ui/Digith/Signal/NewSignalDraftDigith.tsx +++ b/src/ui/Digith/Signal/NewSignalDraftDigith.tsx @@ -2,7 +2,7 @@ import { createSignal } from "solid-js"; import { Digith } from "src/ui/Digith"; import { useProgram } from "src/ui/ProgramProvider"; import { CodeEditor } from "src/ui/Component/CodeEditor"; -import { sourceText } from "source-text"; +import { sourceText } from "source-region"; import { Program } from "src/lang/program"; import { V, Validation, letValidate } from "src/ui/validation"; import { validateNameRaw, validateSignalExprRaw } from "src/ui/validation/helpers"; diff --git a/src/ui/Digith/Signal/SignalDigith.tsx b/src/ui/Digith/Signal/SignalDigith.tsx index 179b46c..ee56741 100644 --- a/src/ui/Digith/Signal/SignalDigith.tsx +++ b/src/ui/Digith/Signal/SignalDigith.tsx @@ -2,7 +2,7 @@ import { createEffect, createSignal, onCleanup, Show } from "solid-js"; import { Digith } from "src/ui/Digith"; import { useProgram } from "src/ui/ProgramProvider"; import { CodeEditor } from "src/ui/Component/CodeEditor"; -import { sourceText } from "source-text"; +import { sourceText } from "source-region"; import { Program } from "src/lang/program"; import { V, Validation, letValidate } from "src/ui/validation"; import { validateSignalExprRaw } from "src/ui/validation/helpers"; diff --git a/src/ui/validation/helpers.ts b/src/ui/validation/helpers.ts index 151805b..ef0dc99 100644 --- a/src/ui/validation/helpers.ts +++ b/src/ui/validation/helpers.ts @@ -1,5 +1,5 @@ import { ParseError, parseExpr, parseFunctionName, parseFunctionParameters, parseSignalExpr } from "src/lang/parser/parser"; -import { sourceText } from "source-text"; +import { sourceText } from "source-region"; import { Expr, FunctionName, ProductPattern, SignalExpr } from "src/lang/expr"; import { V } from "./"; diff --git a/vite.renderer.config.ts b/vite.renderer.config.ts index eab9705..2e20938 100644 --- a/vite.renderer.config.ts +++ b/vite.renderer.config.ts @@ -9,6 +9,9 @@ export default defineConfig({ 'src': path.resolve(__dirname, './src'), }, }, + optimizeDeps: { + exclude: ['source-region'], + }, plugins: [ solidPlugin(), ],