From 92b0c229c034b35779475f48bc7af3f10de39e8b Mon Sep 17 00:00:00 2001 From: Gustaf Carefall <106698658+Gustaf-C@users.noreply.github.com> Date: Mon, 23 Mar 2026 23:25:22 +0100 Subject: [PATCH 1/6] Added failing test --- test/t101MatrixProperty.m | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/t101MatrixProperty.m diff --git a/test/t101MatrixProperty.m b/test/t101MatrixProperty.m new file mode 100644 index 0000000..faff906 --- /dev/null +++ b/test/t101MatrixProperty.m @@ -0,0 +1,11 @@ +% SYNTAX TEST "source.matlab" "Property etc. attribute parsing: https://github.com/mathworks/MATLAB-Language-grammar/issues/101" +classdef Foo + properties + mat1 = [1 1; 1 1]; +% ^ constant.numeric.decimal.matlab +% ^ punctuation.section.brackets.end.matlab + mat2 = [1;1]; +% ^ constant.numeric.decimal.matlab +% ^ punctuation.section.brackets.end.matlab + end +end From 54456f2947541cbaf1848c56e567ac899d1b6416 Mon Sep 17 00:00:00 2001 From: Gustaf Carefall <106698658+Gustaf-C@users.noreply.github.com> Date: Mon, 23 Mar 2026 23:25:45 +0100 Subject: [PATCH 2/6] Added print to say whether tests failed or passed --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a660bb6..10089fd 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "testGrammar": "vscode-tmgrammar-test -s source.matlab -g Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage -t \"./test/*.m\"", "testGrammarSnap": "vscode-tmgrammar-snap -s source.matlab -g Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage -t \"./test/snap/*.m\"", "testLintXML": "xmllint --noout \"Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage\" && echo \"xmllint passed on MATLAB.tmLanguage\"", - "test": "npm run testLintXML && npm run testGrammar && npm run testGrammarSnap", + "test": "(npm run testLintXML && npm run testGrammar && npm run testGrammarSnap && echo \"All grammar tests passed\") || echo \"Error: One or more tests failed\"", "updateGrammarSnap": "vscode-tmgrammar-snap -s source.matlab -g Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage -t \"./test/snap/*.m\" -u" }, "repository": { From fc62c696a41ad7b01a85141516af99baf2242163 Mon Sep 17 00:00:00 2001 From: Gustaf Carefall <106698658+Gustaf-C@users.noreply.github.com> Date: Mon, 23 Mar 2026 23:26:57 +0100 Subject: [PATCH 3/6] Fixed highlight error --- Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage b/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage index a5486ef..95451fc 100644 --- a/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage +++ b/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage @@ -2583,7 +2583,7 @@ name constant.numeric.decimal.matlab match - (?<=[\s\+\-\*\/\\=:\[\(\{,^]|^)\d*\.?\d+([eE][+-]?\d)?([0-9&&[^\.]])*(i|j)?\b + (?<=[\s\+\-\*\/\\=;:\[\(\{,^]|^)\d*\.?\d+([eE][+-]?\d)?([0-9&&[^\.]])*(i|j)?\b captures 3 @@ -2772,7 +2772,7 @@ comment Handle things like arg = val; nextArg match - (=[^;]*) + (=(?:[^\[;]+|\[[^\]]*\])*) captures 1 From 01cb5d0ea1c7dc3564198f5407a1ea769a84c7de Mon Sep 17 00:00:00 2001 From: Gustaf Carefall <106698658+Gustaf-C@users.noreply.github.com> Date: Wed, 25 Mar 2026 21:35:19 +0100 Subject: [PATCH 4/6] Updated test for braces --- test/t101ArrayProperty.m | 17 +++++++++++++++++ test/t101MatrixProperty.m | 11 ----------- 2 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 test/t101ArrayProperty.m delete mode 100644 test/t101MatrixProperty.m diff --git a/test/t101ArrayProperty.m b/test/t101ArrayProperty.m new file mode 100644 index 0000000..acd173b --- /dev/null +++ b/test/t101ArrayProperty.m @@ -0,0 +1,17 @@ +% SYNTAX TEST "source.matlab" "Array property parsing: https://github.com/mathworks/MATLAB-Language-grammar/issues/101" +classdef Foo + properties + mat1 = [1 1; 1 1]; +% ^ constant.numeric.decimal.matlab +% ^ punctuation.section.brackets.end.matlab + mat2 = [1;1]; +% ^ constant.numeric.decimal.matlab +% ^ punctuation.section.brackets.end.matlab + arr1 = {1 1; 1 1}; +% ^ constant.numeric.decimal.matlab +% ^ punctuation.section.braces.end.matlab + arr2 = {1;1}; +% ^ constant.numeric.decimal.matlab +% ^ punctuation.section.braces.end.matlab + end +end diff --git a/test/t101MatrixProperty.m b/test/t101MatrixProperty.m deleted file mode 100644 index faff906..0000000 --- a/test/t101MatrixProperty.m +++ /dev/null @@ -1,11 +0,0 @@ -% SYNTAX TEST "source.matlab" "Property etc. attribute parsing: https://github.com/mathworks/MATLAB-Language-grammar/issues/101" -classdef Foo - properties - mat1 = [1 1; 1 1]; -% ^ constant.numeric.decimal.matlab -% ^ punctuation.section.brackets.end.matlab - mat2 = [1;1]; -% ^ constant.numeric.decimal.matlab -% ^ punctuation.section.brackets.end.matlab - end -end From 6dfa0e0a0ad4b74841781685fca66b26bba4ea15 Mon Sep 17 00:00:00 2001 From: Gustaf Carefall <106698658+Gustaf-C@users.noreply.github.com> Date: Wed, 25 Mar 2026 23:06:58 +0100 Subject: [PATCH 5/6] Fix for arrays --- Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage b/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage index 95451fc..b6b7e0d 100644 --- a/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage +++ b/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage @@ -2772,7 +2772,7 @@ comment Handle things like arg = val; nextArg match - (=(?:[^\[;]+|\[[^\]]*\])*) + (=(?:[^{\[;]+|\[[^\]]*\]|\{[^}]*\})*) captures 1 From d1affda23b62b9049f483d47816b773f74daedbd Mon Sep 17 00:00:00 2001 From: Gustaf Carefall <106698658+Gustaf-C@users.noreply.github.com> Date: Thu, 26 Mar 2026 18:18:10 +0100 Subject: [PATCH 6/6] Update README with current vscode extension --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a550ae3..076372b 100644 --- a/README.md +++ b/README.md @@ -8,5 +8,5 @@ Regular expression based grammar for the MATLAB Language This grammar is used by: * [github/linguist](https://github.com/github/linguist) For syntax highlighting of MATLAB files on GitHub -* [Gimly/vscode-matlab](https://github.com/Gimly/vscode-matlab) For syntax highlighting of MATLAB files in VSCode +* [mathworks/MATLAB-extension-for-vscode](https://github.com/mathworks/MATLAB-extension-for-vscode) For syntax highlighting of MATLAB files in VSCode * [thedavidprice/language-matlab-octave](https://github.com/thedavidprice/language-matlab-octave) For syntax highlighting of MATLAB files in Atom