diff --git a/langium-config.json b/langium-config.json index d3b0e7c..ca80091 100644 --- a/langium-config.json +++ b/langium-config.json @@ -6,6 +6,9 @@ "fileExtensions": [".lox"], "textMate": { "out": "syntaxes/lox.tmLanguage.json" + }, + "monarch": { + "out": "syntaxes/lox.monarch.ts" } }], "out": "src/language-server/generated" diff --git a/package-lock.json b/package-lock.json index 23283e7..8bad440 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,16 +5,14 @@ "requires": true, "packages": { "": { + "name": "langium-lox", "version": "0.0.1", "dependencies": { - "chevrotain": "^9.1.0", "colors": "^1.4.0", "commander": "^8.0.0", - "langium": "1.0.1", + "langium": "~1.2.1", "uuid": "^9.0.0", - "vscode-languageclient": "8.0.2", - "vscode-languageserver": "8.0.2", - "vscode-uri": "^3.0.2" + "vscode-languageclient": "^8.1.0" }, "bin": { "lox-cli": "bin/cli" @@ -26,7 +24,8 @@ "@typescript-eslint/eslint-plugin": "^4.14.1", "@typescript-eslint/parser": "^4.14.1", "eslint": "^7.19.0", - "langium-cli": "1.0.0", + "langium-cli": "~1.2.1", + "shx": "^0.3.4", "typescript": "^4.6.2" }, "engines": { @@ -204,16 +203,6 @@ "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-10.4.2.tgz", "integrity": "sha512-QzSCjg6G4MvIoLeIgOiMR0IgzkGEQqrNJJIr3T5ETRa7l4Av4AMIiEctV99mvDr57iXwwk0/kr3RJxiU36Nevw==" }, - "node_modules/@chevrotain/types": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-9.1.0.tgz", - "integrity": "sha512-3hbCD1CThkv9gnaSIPq0GUXwKni68e0ph6jIHwCvcWiQ4JB2xi8bFxBain0RF04qHUWuDjgnZLj4rLgimuGO+g==" - }, - "node_modules/@chevrotain/utils": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-9.1.0.tgz", - "integrity": "sha512-llLJZ8OAlZrjGlBvamm6Zdo/HmGAcCLq5gx7cSwUX8No+n/8ip+oaC4x33IdZIif8+Rh5dQUIZXmfbSghiOmNQ==" - }, "node_modules/@eslint/eslintrc": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", @@ -576,15 +565,6 @@ "node": ">=8" } }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -594,6 +574,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -636,16 +617,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/chevrotain": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-9.1.0.tgz", - "integrity": "sha512-A86/55so63HCfu0dgGg3j9u8uuuBOrSqly1OhBZxRu2x6sAKILLzfVjbGMw45kgier6lz45EzcjjWtTRgoT84Q==", - "dependencies": { - "@chevrotain/types": "^9.1.0", - "@chevrotain/utils": "^9.1.0", - "regexp-to-ast": "0.5.0" - } - }, "node_modules/chevrotain-allstar": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/chevrotain-allstar/-/chevrotain-allstar-0.1.4.tgz", @@ -715,7 +686,8 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "node_modules/cross-spawn": { "version": "7.0.3", @@ -1121,18 +1093,17 @@ "dev": true }, "node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", "dev": true, "dependencies": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" }, "engines": { - "node": ">=10" + "node": ">=14.14" } }, "node_modules/fs.realpath": { @@ -1141,6 +1112,12 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "node_modules/functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -1215,11 +1192,23 @@ } }, "node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1279,6 +1268,27 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-core-module": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -1377,38 +1387,47 @@ } }, "node_modules/langium": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/langium/-/langium-1.0.1.tgz", - "integrity": "sha512-9w5NRsspYOOXV56q1EhXeFJWkboAVKZDzIEqPLraMQPQy6fvq104wlVwgvF6w9H4IcCpDHCsHJLsfzQMWBsjAA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/langium/-/langium-1.2.1.tgz", + "integrity": "sha512-tpUa1r47pxuUBNqX5X4GAB08qhWpVwWhxjwOV+948skElHO9OV6emngfY3jOYzchJS4H6UZwyKalsOb8GGPsnQ==", "dependencies": { - "chevrotain": "^10.4.1", - "chevrotain-allstar": "^0.1.1", - "vscode-languageserver": "^8.0.2", - "vscode-languageserver-textdocument": "^1.0.7", - "vscode-uri": "^3.0.2" + "chevrotain": "~10.4.2", + "chevrotain-allstar": "~0.1.4", + "vscode-languageserver": "~8.0.2", + "vscode-languageserver-textdocument": "~1.0.8", + "vscode-uri": "~3.0.7" }, "engines": { "node": ">=14.0.0" } }, "node_modules/langium-cli": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/langium-cli/-/langium-cli-1.0.0.tgz", - "integrity": "sha512-F5RZu3/PrlRfebMM6irtHDk2cj5PdUzM4y3M5kNu8k5IC3gIhc4QN+aDD2XHYz8hQSA+bCRUIDwCdhy/7VN4cg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/langium-cli/-/langium-cli-1.2.1.tgz", + "integrity": "sha512-sbGucMXqfDfLmF6bvFsyv7f4/y2dNivVKpXD5j//OxMrBsF+N8fATVqq8bopUvAxxvb0dmaV0xpIxYr7b7Efjg==", "dev": true, "dependencies": { - "chalk": "^4.1.2", - "commander": "^8.0.0", - "fs-extra": "^9.1.0", - "jsonschema": "^1.4.0", - "langium": "~1.0.0", - "lodash": "^4.17.21" + "chalk": "~4.1.2", + "commander": "~10.0.0", + "fs-extra": "~11.1.0", + "jsonschema": "~1.4.1", + "langium": "~1.2.0", + "lodash": "~4.17.21" }, "bin": { "langium": "bin/langium.js" }, "engines": { - "node": ">=12.0.0" + "node": ">=14.0.0" + } + }, + "node_modules/langium-cli/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" } }, "node_modules/langium/node_modules/@chevrotain/types": { @@ -1501,6 +1520,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -1508,6 +1528,15 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -1576,6 +1605,12 @@ "node": ">=8" } }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -1644,6 +1679,18 @@ } ] }, + "node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dev": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/regexp-to-ast": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/regexp-to-ast/-/regexp-to-ast-0.5.0.tgz", @@ -1670,6 +1717,23 @@ "node": ">=0.10.0" } }, + "node_modules/resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "dev": true, + "dependencies": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -1762,6 +1826,39 @@ "node": ">=8" } }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dev": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/shx": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", + "dev": true, + "dependencies": { + "minimist": "^1.2.3", + "shelljs": "^0.8.5" + }, + "bin": { + "shx": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -1844,6 +1941,18 @@ "node": ">=8" } }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/table": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", @@ -1999,18 +2108,59 @@ } }, "node_modules/vscode-languageclient": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-8.0.2.tgz", - "integrity": "sha512-lHlthJtphG9gibGb/y72CKqQUxwPsMXijJVpHEC2bvbFqxmkj9LwQ3aGU9dwjBLqsX1S4KjShYppLvg1UJDF/Q==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-8.1.0.tgz", + "integrity": "sha512-GL4QdbYUF/XxQlAsvYWZRV3V34kOkpRlvV60/72ghHfsYFnS/v2MANZ9P6sHmxFcZKOse8O+L9G7Czg0NUWing==", "dependencies": { - "minimatch": "^3.0.4", - "semver": "^7.3.5", - "vscode-languageserver-protocol": "3.17.2" + "minimatch": "^5.1.0", + "semver": "^7.3.7", + "vscode-languageserver-protocol": "3.17.3" }, "engines": { "vscode": "^1.67.0" } }, + "node_modules/vscode-languageclient/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/vscode-languageclient/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/vscode-languageclient/node_modules/vscode-jsonrpc": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.1.0.tgz", + "integrity": "sha512-6TDy/abTQk+zDGYazgbIPc+4JoXdwC8NHU9Pbn4UJP1fehUyZmM4RHp5IthX7A6L5KS30PRui+j+tbbMMMafdw==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/vscode-languageclient/node_modules/vscode-languageserver-protocol": { + "version": "3.17.3", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.3.tgz", + "integrity": "sha512-924/h0AqsMtA5yK22GgMtCYiMdCOtWTSGgUOkgEDX+wk2b0x4sAfLiO4NxBxqbiVtz7K7/1/RgVrVI0NClZwqA==", + "dependencies": { + "vscode-jsonrpc": "8.1.0", + "vscode-languageserver-types": "3.17.3" + } + }, + "node_modules/vscode-languageclient/node_modules/vscode-languageserver-types": { + "version": "3.17.3", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.3.tgz", + "integrity": "sha512-SYU4z1dL0PyIMd4Vj8YOqFvHu7Hz/enbWtpfnVbJHU4Nd1YNYx8u0ennumc6h48GQNeOLxmwySmnADouT/AuZA==" + }, "node_modules/vscode-languageserver": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-8.0.2.tgz", @@ -2032,9 +2182,9 @@ } }, "node_modules/vscode-languageserver-textdocument": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.7.tgz", - "integrity": "sha512-bFJH7UQxlXT8kKeyiyu41r22jCZXG8kuuVVA33OEJn1diWOZK5n8zBSPZFHVBOu8kXZ6h0LIRhf5UnCo61J4Hg==" + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.8.tgz", + "integrity": "sha512-1bonkGqQs5/fxGT5UchTgjGVnfysL0O8v1AYMBjqTbWQTFn721zaPGDYFkOKtfDgFiSgXM3KwaG3FMGfW4Ed9Q==" }, "node_modules/vscode-languageserver-types": { "version": "3.17.2", @@ -2042,9 +2192,9 @@ "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==" }, "node_modules/vscode-uri": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.3.tgz", - "integrity": "sha512-EcswR2S8bpR7fD0YPeS7r2xXExrScVMxg4MedACaWHEtx9ftCF/qHG1xGkolzTPcEmjTavCQgbVzHUIdTMzFGA==" + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.7.tgz", + "integrity": "sha512-eOpPHogvorZRobNqJGhapa0JdwaxpjVvyBp0QIUMRMSf8ZAlqOdEquKuRmw9Qwu0qXtJIWqFtMkmvJjUZmMjVA==" }, "node_modules/which": { "version": "2.0.2", @@ -2200,16 +2350,6 @@ } } }, - "@chevrotain/types": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-9.1.0.tgz", - "integrity": "sha512-3hbCD1CThkv9gnaSIPq0GUXwKni68e0ph6jIHwCvcWiQ4JB2xi8bFxBain0RF04qHUWuDjgnZLj4rLgimuGO+g==" - }, - "@chevrotain/utils": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-9.1.0.tgz", - "integrity": "sha512-llLJZ8OAlZrjGlBvamm6Zdo/HmGAcCLq5gx7cSwUX8No+n/8ip+oaC4x33IdZIif8+Rh5dQUIZXmfbSghiOmNQ==" - }, "@eslint/eslintrc": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", @@ -2452,12 +2592,6 @@ "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, - "at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true - }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -2467,6 +2601,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2497,16 +2632,6 @@ "supports-color": "^7.1.0" } }, - "chevrotain": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-9.1.0.tgz", - "integrity": "sha512-A86/55so63HCfu0dgGg3j9u8uuuBOrSqly1OhBZxRu2x6sAKILLzfVjbGMw45kgier6lz45EzcjjWtTRgoT84Q==", - "requires": { - "@chevrotain/types": "^9.1.0", - "@chevrotain/utils": "^9.1.0", - "regexp-to-ast": "0.5.0" - } - }, "chevrotain-allstar": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/chevrotain-allstar/-/chevrotain-allstar-0.1.4.tgz", @@ -2569,7 +2694,8 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "cross-spawn": { "version": "7.0.3", @@ -2880,12 +3006,11 @@ "dev": true }, "fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", "dev": true, "requires": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" @@ -2897,6 +3022,12 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -2950,11 +3081,20 @@ } }, "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2999,6 +3139,21 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true + }, + "is-core-module": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -3077,15 +3232,15 @@ "dev": true }, "langium": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/langium/-/langium-1.0.1.tgz", - "integrity": "sha512-9w5NRsspYOOXV56q1EhXeFJWkboAVKZDzIEqPLraMQPQy6fvq104wlVwgvF6w9H4IcCpDHCsHJLsfzQMWBsjAA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/langium/-/langium-1.2.1.tgz", + "integrity": "sha512-tpUa1r47pxuUBNqX5X4GAB08qhWpVwWhxjwOV+948skElHO9OV6emngfY3jOYzchJS4H6UZwyKalsOb8GGPsnQ==", "requires": { - "chevrotain": "^10.4.1", - "chevrotain-allstar": "^0.1.1", - "vscode-languageserver": "^8.0.2", - "vscode-languageserver-textdocument": "^1.0.7", - "vscode-uri": "^3.0.2" + "chevrotain": "~10.4.2", + "chevrotain-allstar": "~0.1.4", + "vscode-languageserver": "~8.0.2", + "vscode-languageserver-textdocument": "~1.0.8", + "vscode-uri": "~3.0.7" }, "dependencies": { "@chevrotain/types": { @@ -3114,17 +3269,25 @@ } }, "langium-cli": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/langium-cli/-/langium-cli-1.0.0.tgz", - "integrity": "sha512-F5RZu3/PrlRfebMM6irtHDk2cj5PdUzM4y3M5kNu8k5IC3gIhc4QN+aDD2XHYz8hQSA+bCRUIDwCdhy/7VN4cg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/langium-cli/-/langium-cli-1.2.1.tgz", + "integrity": "sha512-sbGucMXqfDfLmF6bvFsyv7f4/y2dNivVKpXD5j//OxMrBsF+N8fATVqq8bopUvAxxvb0dmaV0xpIxYr7b7Efjg==", "dev": true, "requires": { - "chalk": "^4.1.2", - "commander": "^8.0.0", - "fs-extra": "^9.1.0", - "jsonschema": "^1.4.0", - "langium": "~1.0.0", - "lodash": "^4.17.21" + "chalk": "~4.1.2", + "commander": "~10.0.0", + "fs-extra": "~11.1.0", + "jsonschema": "~1.4.1", + "langium": "~1.2.0", + "lodash": "~4.17.21" + }, + "dependencies": { + "commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true + } } }, "levn": { @@ -3182,10 +3345,17 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -3242,6 +3412,12 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, "path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -3278,6 +3454,15 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, "regexp-to-ast": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/regexp-to-ast/-/regexp-to-ast-0.5.0.tgz", @@ -3295,6 +3480,17 @@ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, + "resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "dev": true, + "requires": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -3348,6 +3544,27 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, + "shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "shx": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", + "dev": true, + "requires": { + "minimist": "^1.2.3", + "shelljs": "^0.8.5" + } + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -3406,6 +3623,12 @@ "has-flag": "^4.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "table": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", @@ -3522,13 +3745,50 @@ "integrity": "sha512-RY7HwI/ydoC1Wwg4gJ3y6LpU9FJRZAUnTYMXthqhFXXu77ErDd/xkREpGuk4MyYkk4a+XDWAMqe0S3KkelYQEQ==" }, "vscode-languageclient": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-8.0.2.tgz", - "integrity": "sha512-lHlthJtphG9gibGb/y72CKqQUxwPsMXijJVpHEC2bvbFqxmkj9LwQ3aGU9dwjBLqsX1S4KjShYppLvg1UJDF/Q==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-8.1.0.tgz", + "integrity": "sha512-GL4QdbYUF/XxQlAsvYWZRV3V34kOkpRlvV60/72ghHfsYFnS/v2MANZ9P6sHmxFcZKOse8O+L9G7Czg0NUWing==", "requires": { - "minimatch": "^3.0.4", - "semver": "^7.3.5", - "vscode-languageserver-protocol": "3.17.2" + "minimatch": "^5.1.0", + "semver": "^7.3.7", + "vscode-languageserver-protocol": "3.17.3" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "vscode-jsonrpc": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.1.0.tgz", + "integrity": "sha512-6TDy/abTQk+zDGYazgbIPc+4JoXdwC8NHU9Pbn4UJP1fehUyZmM4RHp5IthX7A6L5KS30PRui+j+tbbMMMafdw==" + }, + "vscode-languageserver-protocol": { + "version": "3.17.3", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.3.tgz", + "integrity": "sha512-924/h0AqsMtA5yK22GgMtCYiMdCOtWTSGgUOkgEDX+wk2b0x4sAfLiO4NxBxqbiVtz7K7/1/RgVrVI0NClZwqA==", + "requires": { + "vscode-jsonrpc": "8.1.0", + "vscode-languageserver-types": "3.17.3" + } + }, + "vscode-languageserver-types": { + "version": "3.17.3", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.3.tgz", + "integrity": "sha512-SYU4z1dL0PyIMd4Vj8YOqFvHu7Hz/enbWtpfnVbJHU4Nd1YNYx8u0ennumc6h48GQNeOLxmwySmnADouT/AuZA==" + } } }, "vscode-languageserver": { @@ -3549,9 +3809,9 @@ } }, "vscode-languageserver-textdocument": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.7.tgz", - "integrity": "sha512-bFJH7UQxlXT8kKeyiyu41r22jCZXG8kuuVVA33OEJn1diWOZK5n8zBSPZFHVBOu8kXZ6h0LIRhf5UnCo61J4Hg==" + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.8.tgz", + "integrity": "sha512-1bonkGqQs5/fxGT5UchTgjGVnfysL0O8v1AYMBjqTbWQTFn721zaPGDYFkOKtfDgFiSgXM3KwaG3FMGfW4Ed9Q==" }, "vscode-languageserver-types": { "version": "3.17.2", @@ -3559,9 +3819,9 @@ "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==" }, "vscode-uri": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.3.tgz", - "integrity": "sha512-EcswR2S8bpR7fD0YPeS7r2xXExrScVMxg4MedACaWHEtx9ftCF/qHG1xGkolzTPcEmjTavCQgbVzHUIdTMzFGA==" + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.7.tgz", + "integrity": "sha512-eOpPHogvorZRobNqJGhapa0JdwaxpjVvyBp0QIUMRMSf8ZAlqOdEquKuRmw9Qwu0qXtJIWqFtMkmvJjUZmMjVA==" }, "which": { "version": "2.0.2", diff --git a/package.json b/package.json index e133faa..6329d70 100644 --- a/package.json +++ b/package.json @@ -10,26 +10,37 @@ "Programming Languages" ], "contributes": { - "languages": [{ - "id": "lox", - "aliases": ["Lox", "lox"], - "extensions": [".lox"], - "configuration": "./language-configuration.json" - }], - "grammars": [{ - "language": "lox", - "scopeName": "source.lox", - "path": "./syntaxes/lox.tmLanguage.json" - }], - "notebooks": [{ - "type": "lox-notebook", - "displayName": "Lox Notebook", - "selector": [ - { - "filenamePattern": "*.loxnb" - } - ] - }] + "languages": [ + { + "id": "lox", + "aliases": [ + "Lox", + "lox" + ], + "extensions": [ + ".lox" + ], + "configuration": "./language-configuration.json" + } + ], + "grammars": [ + { + "language": "lox", + "scopeName": "source.lox", + "path": "./syntaxes/lox.tmLanguage.json" + } + ], + "notebooks": [ + { + "type": "lox-notebook", + "displayName": "Lox Notebook", + "selector": [ + { + "filenamePattern": "*.loxnb" + } + ] + } + ] }, "activationEvents": [ "onLanguage:lox" @@ -49,18 +60,16 @@ "build": "tsc -b tsconfig.json", "watch": "tsc -b tsconfig.json --watch", "lint": "eslint src --ext ts", + "clean": "shx rm -rf out node_modules", "langium:generate": "langium generate", "langium:watch": "langium generate --watch" }, "dependencies": { - "chevrotain": "^9.1.0", "colors": "^1.4.0", "commander": "^8.0.0", - "langium": "1.0.1", + "langium": "~1.2.1", "uuid": "^9.0.0", - "vscode-languageclient": "8.0.2", - "vscode-languageserver": "8.0.2", - "vscode-uri": "^3.0.2" + "vscode-languageclient": "^8.1.0" }, "devDependencies": { "@types/node": "^14.17.3", @@ -69,7 +78,8 @@ "@typescript-eslint/eslint-plugin": "^4.14.1", "@typescript-eslint/parser": "^4.14.1", "eslint": "^7.19.0", - "langium-cli": "1.0.0", + "langium-cli": "~1.2.1", + "shx": "^0.3.4", "typescript": "^4.6.2" } } diff --git a/src/interpreter/runner.ts b/src/interpreter/runner.ts index 76a8b2e..299d58e 100644 --- a/src/interpreter/runner.ts +++ b/src/interpreter/runner.ts @@ -3,14 +3,18 @@ import { BinaryExpression, Expression, isBinaryExpression, isBooleanExpression, import { createLoxServices } from "../language-server/lox-module"; import { v4 } from 'uuid'; import { URI } from "vscode-uri"; -import { CancellationToken } from "vscode-languageclient"; +import { CancellationToken, CancellationTokenSource } from "vscode-languageserver"; export interface InterpreterContext { - log: (value: unknown) => MaybePromise + log: (value: unknown) => MaybePromise, + onStart?: () => void, } const services = createLoxServices(EmptyFileSystem); +// after 5 seconds, the interpreter will be interrupted and call onTimeout +const TIMEOUT_MS = 1000 * 5; + export async function runInterpreter(program: string, context: InterpreterContext): Promise { const buildResult = await buildDocument(program); try { @@ -25,7 +29,10 @@ type ReturnFunction = (value: unknown) => void; interface RunnerContext { variables: Variables, - log: (value: unknown) => MaybePromise + cancellationToken: CancellationToken, + timeout: NodeJS.Timeout, + log: (value: unknown) => MaybePromise, + onStart?: () => void, } class Variables { @@ -88,17 +95,38 @@ async function buildDocument(program: string): Promise { } } -async function runProgram(program: LoxProgram, outerContext: InterpreterContext): Promise { +export async function runProgram(program: LoxProgram, outerContext: InterpreterContext): Promise { + const cancellationTokenSource = new CancellationTokenSource(); + const cancellationToken = cancellationTokenSource.token; + + const timeout = setTimeout(async () => { + cancellationTokenSource.cancel(); + }, TIMEOUT_MS); + const context: RunnerContext = { variables: new Variables(), - log: outerContext.log + cancellationToken, + timeout, + log: outerContext.log, + onStart: outerContext.onStart, }; - context.variables.enter(); + let end = false; + + context.variables.enter(); + if (context.onStart) { + context.onStart(); + } + for (const statement of program.elements) { + await interruptAndCheck(context.cancellationToken); + if (!isClass(statement) && !isFunctionDeclaration(statement)) { await runLoxElement(statement, context, () => { end = true }); } + else if (isClass(statement)) { + throw new AstNodeError(statement, 'Classes are currently unsupported'); + } if (end) { break; } @@ -107,6 +135,8 @@ async function runProgram(program: LoxProgram, outerContext: InterpreterContext) } async function runLoxElement(element: LoxElement, context: RunnerContext, returnFn: ReturnFunction): Promise { + await interruptAndCheck(context.cancellationToken); + if (isExpressionBlock(element)) { await interruptAndCheck(CancellationToken.None); context.variables.enter(); @@ -164,6 +194,9 @@ async function runLoxElement(element: LoxElement, context: RunnerContext, return } async function runExpression(expression: Expression, context: RunnerContext): Promise { + await interruptAndCheck(context.cancellationToken); + + if (isBinaryExpression(expression)) { const { left, right, operator } = expression; const rightValue = await runExpression(right, context); @@ -244,6 +277,8 @@ async function setExpressionValue(left: Expression, right: unknown, context: Run } async function runMemberCall(memberCall: MemberCall, context: RunnerContext): Promise { + await interruptAndCheck(context.cancellationToken); + let previous: unknown = undefined; if (memberCall.previous) { previous = await runExpression(memberCall.previous, context); @@ -255,7 +290,7 @@ async function runMemberCall(memberCall: MemberCall, context: RunnerContext): Pr } else if (isVariableDeclaration(ref) || isParameter(ref)) { value = context.variables.get(memberCall, ref.name); } else if (isClass(ref)) { - throw new AstNodeError(memberCall, 'Classes are current unsupported'); + throw new AstNodeError(memberCall, 'Classes are currently unsupported'); } else { value = previous; } @@ -317,6 +352,7 @@ function applyOperator(node: BinaryExpression, operator: string, left: unknown, } } + function isNumber(value: unknown): value is number { return typeof value === 'number'; } diff --git a/src/language-server/lox-validator.ts b/src/language-server/lox-validator.ts index 0e643bd..80bb44c 100644 --- a/src/language-server/lox-validator.ts +++ b/src/language-server/lox-validator.ts @@ -1,5 +1,5 @@ import { AstNode, streamAllContents, ValidationAcceptor, ValidationChecks, ValidationRegistry } from 'langium'; -import { BinaryExpression, ExpressionBlock, FunctionDeclaration, isReturnStatement, LoxAstType, MethodMember, TypeReference, UnaryExpression, VariableDeclaration } from './generated/ast'; +import { BinaryExpression, Class, ExpressionBlock, FunctionDeclaration, isReturnStatement, LoxAstType, MethodMember, TypeReference, UnaryExpression, VariableDeclaration } from './generated/ast'; import type { LoxServices } from './lox-module'; import { isAssignable } from './type-system/assignment'; import { isVoidType, TypeDescription, typeToString } from './type-system/descriptions'; @@ -18,6 +18,7 @@ export class LoxValidationRegistry extends ValidationRegistry { UnaryExpression: validator.checkUnaryOperationAllowed, VariableDeclaration: validator.checkVariableDeclaration, MethodMember: validator.checkMethodReturnType, + Class: validator.checkClassDeclaration, FunctionDeclaration: validator.checkFunctionReturnType }; this.register(checks, validator); @@ -37,6 +38,14 @@ export class LoxValidator { this.checkFunctionReturnTypeInternal(method.body, method.returnType, accept); } + // TODO: implement classes + checkClassDeclaration(declaration: Class, accept: ValidationAcceptor): void { + accept('error', 'Classes are currently unsupported.', { + node: declaration, + property: 'name' + }); + } + private checkFunctionReturnTypeInternal(body: ExpressionBlock, returnType: TypeReference, accept: ValidationAcceptor): void { const map = this.getTypeCache(); const returnStatements = streamAllContents(body).filter(isReturnStatement).toArray(); diff --git a/src/language-server/main-browser.ts b/src/language-server/main-browser.ts new file mode 100644 index 0000000..4d51979 --- /dev/null +++ b/src/language-server/main-browser.ts @@ -0,0 +1,66 @@ +/****************************************************************************** + * Copyright 2022 TypeFox GmbH + * This program and the accompanying materials are made available under the + * terms of the MIT License, which is available in the project root. + ******************************************************************************/ + +import { startLanguageServer, EmptyFileSystem, DocumentState, LangiumDocument, OperationCancelled } from 'langium'; +import { BrowserMessageReader, BrowserMessageWriter, Diagnostic, NotificationType, createConnection } from 'vscode-languageserver/browser'; +import { runInterpreter } from '../interpreter/runner'; +import { createLoxServices } from './lox-module'; + +declare const self: DedicatedWorkerGlobalScope; + +/* browser specific setup code */ +const messageReader = new BrowserMessageReader(self); +const messageWriter = new BrowserMessageWriter(self); + +const connection = createConnection(messageReader, messageWriter); + +// Inject the shared services and language-specific services +const { shared } = createLoxServices({ connection, ...EmptyFileSystem }); + +// Start the language server with the shared services +startLanguageServer(shared); + +// Send a notification with the serialized AST after every document change +type DocumentChange = { uri: string, content: string, diagnostics: Diagnostic[] }; +const documentChangeNotification = new NotificationType('browser/DocumentChange'); + + +shared.workspace.DocumentBuilder.onBuildPhase(DocumentState.Validated, async documents => { + for (const document of documents) { + if (document.diagnostics === undefined || document.diagnostics.filter((i) => i.severity === 1).length === 0) { + try { + await runInterpreter(document.textDocument.getText(), { + log: (message) => { + sendMessage(document, "output", message); + }, + onStart: () => { + sendMessage(document, "notification", "startInterpreter"); + }, + }); + } catch (e: any) { + if (e === OperationCancelled) { + sendMessage(document, "error", "Interpreter timed out"); + } else { + sendMessage(document, "error", e.message); + } + } finally { + sendMessage(document, "notification", "endInterpreter"); + } + + } + else { + sendMessage(document, "error", document.diagnostics) + } + } +}); + +function sendMessage(document: LangiumDocument, type: string, content: unknown): void { + connection.sendNotification(documentChangeNotification, { + uri: document.uri.toString(), + content: JSON.stringify({ type, content }), + diagnostics: document.diagnostics ?? [] + }); +} diff --git a/syntaxes/lox.monarch.ts b/syntaxes/lox.monarch.ts new file mode 100644 index 0000000..a0d530e --- /dev/null +++ b/syntaxes/lox.monarch.ts @@ -0,0 +1,30 @@ +// Monarch syntax highlighting for the lox language. +export default { + keywords: [ + 'and','boolean','class','else','false','for','fun','if','nil','number','or','print','return','string','super','this','true','var','void','while' + ], + operators: [ + '!','!=','*','+',',','-','.','/',':',';','<','<=','=','==','=>','>','>=' + ], + symbols: /!|!=|\(|\)|\*|\+|,|-|\.|/|:|;|<|<=|=|==|=>|>|>=|\{|\}/, + + tokenizer: { + initial: [ + { regex: /[_a-zA-Z][\w_]*/, action: { cases: { '@keywords': {"token":"keyword"}, '@default': {"token":"ID"} }} }, + { regex: /[0-9]+(\.[0-9]+)?/, action: {"token":"number"} }, + { regex: /"[^"]*"/, action: {"token":"string"} }, + { include: '@whitespace' }, + { regex: /@symbols/, action: { cases: { '@operators': {"token":"operator"}, '@default': {"token":""} }} }, + ], + whitespace: [ + { regex: /\s+/, action: {"token":"white"} }, + { regex: /\/\*/, action: {"token":"comment","next":"@comment"} }, + { regex: /\/\/[^\n\r]*/, action: {"token":"comment"} }, + ], + comment: [ + { regex: /[^\/\*]+/, action: {"token":"comment"} }, + { regex: /\*\//, action: {"token":"comment","next":"@pop"} }, + { regex: /[\/\*]/, action: {"token":"comment"} }, + ], + } +}; diff --git a/syntaxes/lox.tmLanguage.json b/syntaxes/lox.tmLanguage.json index 90040d6..eb21ca7 100644 --- a/syntaxes/lox.tmLanguage.json +++ b/syntaxes/lox.tmLanguage.json @@ -15,7 +15,12 @@ { "name": "string.quoted.double.lox", "begin": "\"", - "end": "\"" + "end": "\"", + "patterns": [ + { + "include": "#string-character-escape" + } + ] } ], "repository": { @@ -47,6 +52,10 @@ "name": "comment.line.lox" } ] + }, + "string-character-escape": { + "name": "constant.character.escape.lox", + "match": "\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\\{[0-9A-Fa-f]+\\}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)" } } -} \ No newline at end of file +} diff --git a/tsconfig.json b/tsconfig.json index ca965e3..529ca88 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "ES6", "module": "commonjs", - "lib": ["ESNext"], + "lib": ["ESNext", "WebWorker"], "sourceMap": true, "outDir": "out", "strict": true,