Skip to content

Commit e292927

Browse files
authored
Merge pull request #102 from Gustaf-C/matrix-property-fix
Matrix property fix
2 parents a3e2cf3 + d1affda commit e292927

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2583,7 +2583,7 @@
25832583
<key>name</key>
25842584
<string>constant.numeric.decimal.matlab</string>
25852585
<key>match</key>
2586-
<string>(?&lt;=[\s\+\-\*\/\\=:\[\(\{,^]|^)\d*\.?\d+([eE][+-]?\d)?([0-9&amp;&amp;[^\.]])*(i|j)?\b</string>
2586+
<string>(?&lt;=[\s\+\-\*\/\\=;:\[\(\{,^]|^)\d*\.?\d+([eE][+-]?\d)?([0-9&amp;&amp;[^\.]])*(i|j)?\b</string>
25872587
<key>captures</key>
25882588
<dict>
25892589
<key>3</key>
@@ -2772,7 +2772,7 @@
27722772
<key>comment</key>
27732773
<string>Handle things like arg = val; nextArg</string>
27742774
<key>match</key>
2775-
<string>(=[^;]*)</string>
2775+
<string>(=(?:[^{\[;]+|\[[^\]]*\]|\{[^}]*\})*)</string>
27762776
<key>captures</key>
27772777
<dict>
27782778
<key>1</key>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ Regular expression based grammar for the MATLAB Language
88
This grammar is used by:
99

1010
* [github/linguist](https://github.com/github/linguist) For syntax highlighting of MATLAB files on GitHub
11-
* [Gimly/vscode-matlab](https://github.com/Gimly/vscode-matlab) For syntax highlighting of MATLAB files in VSCode
11+
* [mathworks/MATLAB-extension-for-vscode](https://github.com/mathworks/MATLAB-extension-for-vscode) For syntax highlighting of MATLAB files in VSCode
1212
* [thedavidprice/language-matlab-octave](https://github.com/thedavidprice/language-matlab-octave) For syntax highlighting of MATLAB files in Atom

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"testGrammar": "vscode-tmgrammar-test -s source.matlab -g Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage -t \"./test/*.m\"",
66
"testGrammarSnap": "vscode-tmgrammar-snap -s source.matlab -g Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage -t \"./test/snap/*.m\"",
77
"testLintXML": "xmllint --noout \"Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage\" && echo \"xmllint passed on MATLAB.tmLanguage\"",
8-
"test": "npm run testLintXML && npm run testGrammar && npm run testGrammarSnap",
8+
"test": "(npm run testLintXML && npm run testGrammar && npm run testGrammarSnap && echo \"All grammar tests passed\") || echo \"Error: One or more tests failed\"",
99
"updateGrammarSnap": "vscode-tmgrammar-snap -s source.matlab -g Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage -t \"./test/snap/*.m\" -u"
1010
},
1111
"repository": {

test/t101ArrayProperty.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
% SYNTAX TEST "source.matlab" "Array property parsing: https://github.com/mathworks/MATLAB-Language-grammar/issues/101"
2+
classdef Foo
3+
properties
4+
mat1 = [1 1; 1 1];
5+
% ^ constant.numeric.decimal.matlab
6+
% ^ punctuation.section.brackets.end.matlab
7+
mat2 = [1;1];
8+
% ^ constant.numeric.decimal.matlab
9+
% ^ punctuation.section.brackets.end.matlab
10+
arr1 = {1 1; 1 1};
11+
% ^ constant.numeric.decimal.matlab
12+
% ^ punctuation.section.braces.end.matlab
13+
arr2 = {1;1};
14+
% ^ constant.numeric.decimal.matlab
15+
% ^ punctuation.section.braces.end.matlab
16+
end
17+
end

0 commit comments

Comments
 (0)