mathworks / MATLAB-Language-grammar

This repository contains a regular expression based language grammar for MATLAB to be used by GitHub Linguist for highlighting MATLAB code on GitHub
50 stars 17 forks source link

Incorrect handling of semicolon after command syntax #7

Closed rlivings39 closed 3 years ago

rlivings39 commented 5 years ago

From https://github.com/thedavidprice/language-matlab-octave/issues/19

Consider he code:

x = 1;
someCommand arg1; x = 1;

should treat x = 1; in the second line as typical code not as a string as part of the command. Notice that the 1 is not highlighted in the second line.

The difference is more pronounced in Atom with the language-matlab-octave extension: atomCommandSemicolon

ghost commented 3 years ago

https://github.com/mathworks/MATLAB-Language-grammar/blob/69dbf20c1eb19efd629c0438a2a493e60617e8de/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage#L908-L932

Looking at the help page, this seems overcomplicated. Dual command syntax is simple.. there's a keyword.other/support.function word and a char vector option at the end (terminated by [\n;%]). A check for missing = or ( after the "word" is the only thing needed.

I'll see what comes of hacking at it

ghost commented 3 years ago

Bugfix @ PR https://github.com/mathworks/MATLAB-Language-grammar/pull/37.

ghost commented 3 years ago

Could you ping your colleague about the PR on Slack? I've corrected this issue and added enhancements: https://github.com/mathworks/MATLAB-Language-grammar/pull/37#issuecomment-843723493

ghost commented 3 years ago

Resolved by #37. This issue needs closing

dklilley commented 3 years ago

Closing - resolved by https://github.com/mathworks/MATLAB-Language-grammar/pull/37