Open rien opened 10 months ago
of course the Node bindings should be able to cope with arbitrary text in token names, whatever is supported by the regular library.
I partially disagree - rules shouldn't be named like that, it makes no sense and it would be correct to abstract those rules to a node containing the special character text. I would argue R's grammar is not exactly written in the "standard" tree-sitter way of writing grammars
I've encountered this issue when trying to load the node bindings of the
tree-sitter-r
parser with their 'next' branch. This grammar contains a lot of special symbols and as the node bindingsgenerate a new class for each rule with its name
, this causes anUncaught SyntaxError
when the class definition iseval
ed.Now I've tried to fix this by creating a PR (https://github.com/r-lib/tree-sitter-r/pull/64) renaming all rules with special characters, but this is not as desired since it renames most of the original grammar.
What do you recommend a a good solution here? Should rule names with special characters be disallowed in grammars? Or should the node bindings be able to cope with these special characters as token names?