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

Class Attribute parsing is broken when using cell arrays etc. #87

Closed apozharski closed 3 months ago

apozharski commented 3 months ago
classdef (AllowedSubclasses = {?SubClass1,?SubClass2}) SuperClass
end

Even the basic class above is currently parsed extremely incorrectly. See https://github.com/watermarkhu/textmate-grammar-python/issues/67 for details of output in this case.

Fully correctly parsing the class definition section is neigh on impossible due to line continuations and the limitations of textmate grammars (regex based, lack of support for multi-line regex, etc.) however it would be good to limit errors to types of formatting that is unlikely to occur in any reasonably formatted code, e.g.:

classdef  (AllowedSubclasses = {?SubClass1,?SubClass2}) ...
                 SuperClass
end