Skip to content

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

@DavisVaughan

Description

@DavisVaughan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions