Skip to content

Wrong grammar for match. #774

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.

Activity

  1. ehuss commented on Mar 4, 2020

    @ehuss
    Contributor

    This all sounds like good changes to me.

  2. added a commit that references this issue on Aug 25, 2020
    027f10a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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