Skip to content

Wrong grammar for match. #774

Closed
Closed
@steffahn

Description

@steffahn

In the grammar for match, i.e. for the nonterminal MatchExpression, in MatchArms the right-hand side of the non-last arms only allows skipping the , for BlockExpression. However it seems to be the case that any ExpressionWithBlock works without the ,. Is this correct?

Furthermore, currently the case of a BlockExpression followed by , matches both alternatives of the BlockExpression ,? | Expression ,. Perhaps a nicer rule would use ExpressionWithoutBlock , | ExpressionWithBlock ,?, in effect being similar to my proposed rule for ExpressionStatement in #773, but with comma instead of semicolon.

Finally, in the last arm, the BlockExpression | Expression part seems a bit redundant as a BlockExpression is an Expression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: Syntax and parsing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions