mathworks / mathworks/MATLAB-Language-grammar

Tokenization broken in class after nested function call with anonymous function

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

Nobody has claimed this yet.

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

Description

See the following code:

classdef Foo
    methods
        function test()
            foo(bar(@(x) x));
        end
    end

    methods
    
    end
end

In VS Code, this is syntax highlighted in the following way:

Image

The first end is tokenized as keyword.operator.word.matlab instead of storage.type.function.end.matlab.

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 tokenization of the provided MATLAB class and nested anonymous-function example in the repository's regular-expression-based grammar. Trace how the first end is matched after the nested call, then verify that it receives storage.type.function.end.matlab rather than keyword.operator.word.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
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.