From 2f661a0fcd0dec71da4eb225d0f6214ed3ecc1f2 Mon Sep 17 00:00:00 2001 From: phannebohm Date: Fri, 15 Mar 2024 11:28:22 +0100 Subject: [PATCH 1/4] Fix runaway regex in comment string detection --- syntaxes/modelica.tmGrammar.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntaxes/modelica.tmGrammar.yaml b/syntaxes/modelica.tmGrammar.yaml index 38e9134..d91c403 100644 --- a/syntaxes/modelica.tmGrammar.yaml +++ b/syntaxes/modelica.tmGrammar.yaml @@ -51,7 +51,7 @@ patterns: name: support.type # Class definitions - - begin: \b(model|class|record|block|package|function)\s+(\w+)\s*((? Date: Fri, 15 Mar 2024 13:00:30 +0100 Subject: [PATCH 2/4] Fixing string stuff --- .vscode/tasks.json | 2 +- README.md | 2 +- syntaxes/metamodelica.tmGrammar.yaml | 6 ++++-- syntaxes/modelica.tmGrammar.yaml | 8 +++++--- .../{function.test.mo => Function.test.mo} | 0 test/metamodelica/FunctionDoc.test.mo | 15 +++++++++++++++ test/modelica/Comments.test.mo | 4 ++++ test/modelica/Function.test.mo | 18 ++++++++++++++++++ 8 files changed, 48 insertions(+), 7 deletions(-) rename test/metamodelica/{function.test.mo => Function.test.mo} (100%) create mode 100644 test/metamodelica/FunctionDoc.test.mo create mode 100644 test/modelica/Function.test.mo diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 528bd09..e7272c9 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -20,7 +20,7 @@ "group": "test", "presentation": { "reveal": "always", - "panel": "new", + "panel": "dedicated", }, "problemMatcher": { "owner": "vscode-tmgrammar-test", diff --git a/README.md b/README.md index 7c678be..6a34581 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ for more details on the publishing process. npm install ``` -Translate the `*tmGrammar.yaml` files to `*.tmGrammar.json` JSON files. +Translate the `*.tmGrammar.yaml` files to `*.tmGrammar.json` JSON files. Start build task (Ctrl+Shift+B) ```bash diff --git a/syntaxes/metamodelica.tmGrammar.yaml b/syntaxes/metamodelica.tmGrammar.yaml index 69ba3b0..c11cdc8 100644 --- a/syntaxes/metamodelica.tmGrammar.yaml +++ b/syntaxes/metamodelica.tmGrammar.yaml @@ -92,11 +92,13 @@ patterns: - name: keyword end: \)\s*; - # Strings - - match: (? awesome; +//^^^^^^ source.metamodelica keyword.control +// ^^^^^^^^^^^^^^^^^^^^^^^ source.metamodelica storage.type +// [...] +end foo; diff --git a/test/modelica/Comments.test.mo b/test/modelica/Comments.test.mo index 0cf3578..93eb638 100644 --- a/test/modelica/Comments.test.mo +++ b/test/modelica/Comments.test.mo @@ -1,6 +1,8 @@ // SYNTAX TEST "source.modelica" "Comments" model M "Documentation" +//<-- source.modelica keyword +// ^ source.modelica entity.name.type // ^^^^^^^^^^^^^^^ source.modelica comment.line Real x "Variable \"x\""; // ^^^^^^^^^^^^^^^^ source.modelica comment.line @@ -28,3 +30,5 @@ model M "Documentation" // ^^^ source.modelica string.quoted.double // ^^^ source.modelica string.quoted.double end M; +//<-- source.modelica keyword +// ^ source.modelica entity.name.type diff --git a/test/modelica/Function.test.mo b/test/modelica/Function.test.mo new file mode 100644 index 0000000..fd5e27e --- /dev/null +++ b/test/modelica/Function.test.mo @@ -0,0 +1,18 @@ +// SYNTAX TEST "source.modelica" "Function with doc string" + +public function foo + "Function does crazy stuff --fmiFlags + and creates an awesome record for stuff. + Author: ItIsI" + input Boolean isAwesome = true; +//^^^^^ source.modelica keyword.control +// ^^^^^^^ source.modelica storage.type +// ^^^^ source.modelica constant.language + output MyRecord awesome; +//^^^^^^ source.modelica keyword.control +// [...] +//<--- source.modelica comment.line +//^^^^^^ source.modelica comment.line +end foo; +//<--- source.modelica keyword +// ^^^ source.modelica entity.name.type From 09b38d715c6d68d34407717afa92ca89879b36fa Mon Sep 17 00:00:00 2001 From: AnHeuermann <38031952+AnHeuermann@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:04:42 +0100 Subject: [PATCH 3/4] Update bug release number --- package-lock.json | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5badbd3..874b3be 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "metamodelica", - "version": "1.3.0", + "version": "1.3.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "metamodelica", - "version": "1.3.0", + "version": "1.3.1", "license": "See LICENSE.txt", "devDependencies": { "@vscode/vsce": "^2.21.1", @@ -509,9 +509,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.5", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", - "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index 6461cc3..e7425f8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "metamodelica", "displayName": "MetaModelica", "description": "MetaModelica, Susan and Modelica language support.", - "version": "1.3.0", + "version": "1.3.1", "publisher": "AnHeuermann", "license": "See LICENSE.txt", "engines": { From 287d157a34655fe1155360dc70053babf4e47310 Mon Sep 17 00:00:00 2001 From: AnHeuermann <38031952+AnHeuermann@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:06:45 +0100 Subject: [PATCH 4/4] Fix merge error --- syntaxes/modelica.tmGrammar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntaxes/modelica.tmGrammar.yaml b/syntaxes/modelica.tmGrammar.yaml index d58cd70..ea3f79d 100644 --- a/syntaxes/modelica.tmGrammar.yaml +++ b/syntaxes/modelica.tmGrammar.yaml @@ -80,7 +80,7 @@ patterns: patterns: - include: '#annotations' - # Strings + # Documentation Strings - match: (?