On 17 Oct 2018, at 17:36, Jacob Carlborg wrote:

This is exactly according to the specified grammar [3] and it seems to be working as expected. Not sure if the optional group workaround causes some performance implications.

This technique seems like it could be a viable alternative to supporting variables in the TextMate grammar as has been discussed before.

Just to be clear, you are talking about variables from the parsed language and highlighting them later in the scope, right?

So something like: let foo = 42 in … something_with foo … and here the latter instance of foo would be marked as a variable?

To be honest, I don’t follow this 100%; it seems highly impractical to have one big regular expression for the language because then we cannot save parser state and restart parser on the line that got edited, which would be a major performance issue.

I am also not sure how this variable thing would work in a typical language where you can define an arbitrary number of variables on basically any given line.