ganezdragon / tree-sitter-perl

a perl parser for javascript
MIT License
33 stars 9 forks source link

Special variables should include non-constant ones? #5

Closed delphinus closed 3 years ago

delphinus commented 3 years ago

Thank you for great work! I have been waiting eagerly tree-sitter'ing Perl sources! I found here and then tried to contribute immediately, but have some questions.

I found it cannot parse this code below because $/ is not defined in grammar.

local $/;

There are two solutions for this, I think.

  1. Add to $.scalar_variable
  2. Add to $.special_variable

I know $/ is “special”, so 2. is better, and editors such as Neovim should highlight $.special_variable to Constant.

But $/ is not “Constant”. It is variable. Do you think which should I add $/ (and $\, $|, and so on) into 1. or 2.?

And it seems that current grammar.js parse $1 .. $9, $! into $.scalar_variable. Also should it parse them into $.special_variable?