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
49 stars 17 forks source link

Variables being tokenized as functions when indexing (i.e. using parens) #76

Open goldrik opened 6 months ago

goldrik commented 6 months ago

Pretty simple, if you create a variable (var and arr in the video), they are tokenized as variables (both tokens variable.other.readwrite.matlab, meta.assignment.variable.single.matlab).

If you call a function (mean), it is tokenized as a function call (entity.name.function.matlab, meta.function-call.parens.matlab).

However, if you index into the array variable from earlier (arr), it is also tokenized like a function call (entity.name.function.matlab, meta.function-call.parens.matlab).

https://github.com/mathworks/MATLAB-Language-grammar/assets/8674612/9c146fb1-59d9-4ad0-93d4-05c0e652a848