mathworks / mathworks/MATLAB-Language-grammar

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

Open
#76 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
MATLAB
Stars
64
Forks
22
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported tokenization difference between a function call such as mean(...) and indexing a variable such as arr(...). Then inspect the repository's regular-expression MATLAB grammar to find the rules assigning function-call scopes. Done means indexed variables receive variable/indexing scopes rather than entity.name.function.matlab and meta.function-call.parens.matlab.

Written by the indexing model from the issue text.

Assessment

Tech stack
matlab
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.