Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_parameter_with_default should not have an optional() "default" field #161

Open
DavisVaughan opened this issue Nov 22, 2024 · 0 comments
Open

Comments

@DavisVaughan
Copy link
Member

DavisVaughan commented Nov 22, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant