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

indexing_curly_brackets has a pattern that is never matched. #70

Closed watermarkhu closed 11 months ago

watermarkhu commented 11 months ago

The indexing_curly_brackets grammar includes a pattern that has a positive lookahead in its expression.

https://github.com/mathworks/MATLAB-Language-grammar/blob/74c8f75a04d72a8f8acaf26cdfd5bfedd47a53e9/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage#L2073-L2080

This pattern is never used since the capture group of indexing_curly_brackets does not include the {.

https://github.com/mathworks/MATLAB-Language-grammar/blob/74c8f75a04d72a8f8acaf26cdfd5bfedd47a53e9/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage#L2066

Removing this pattern does not affect the tokenization result, as the injected grammar readwrite_operations includes the readwrite_variable grammar with name variable.other.readwrite.matlab.