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/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