diff --git a/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage b/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage index a5486ef..b6b7e0d 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 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 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": { 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