https://github.com/r-lib/tree-sitter-r/blob/a0d3e3307489c3ca54da8c7b5b4e0c5f5fd6953a/grammar.js#L239C5-L243
If we see the = and go down the _parameter_with_default route, then according to the gram.y, a default value is required
https://github.com/wch/r-source/blob/988774e05497bcf2cfac47bfbec59d551432e3fb/src/main/gram.y#L559-L564
For example, this doesn't parse in R parse(text = "function(x = ) {}")
This may be a holdover from when we used optional() more aggressively
I have a feeling removing this will improve error recovery in some places
https://github.com/r-lib/tree-sitter-r/blob/a0d3e3307489c3ca54da8c7b5b4e0c5f5fd6953a/grammar.js#L239C5-L243
If we see the
=and go down the_parameter_with_defaultroute, then according to the gram.y, a default value is requiredhttps://github.com/wch/r-source/blob/988774e05497bcf2cfac47bfbec59d551432e3fb/src/main/gram.y#L559-L564
For example, this doesn't parse in R
parse(text = "function(x = ) {}")This may be a holdover from when we used
optional()more aggressivelyI have a feeling removing this will improve error recovery in some places