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

Function handle accessor not colored after 4 whitespaces, cannot be separated from anonymous function in case of line continuations #58

Open watermarkhu opened 1 year ago

watermarkhu commented 1 year ago

There can be an arbitrary number of whitespaces after the function handle.

image

But in the tmLanguage there is a limit on 4 whitespace characters. Also \s includes newlines, which is not allowed.

image

https://github.com/mathworks/MATLAB-Language-grammar/blob/4f1c0c8e8eac1494ee9c2bac18605aca08b08806/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage#L2491

watermarkhu commented 1 year ago

In case of excessive use of line continuations, anonymous functions cannot be differentiated from function accessors. image

The scope of these two should for this reason be combined, sharing the same scope for @.