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

Wrong grammar for match. #774

Closed
steffahn opened this issue Mar 4, 2020 · 1 comment · Fixed by #776
Closed

Wrong grammar for match. #774

steffahn opened this issue Mar 4, 2020 · 1 comment · Fixed by #776
Labels
A-grammar Area: Syntax and parsing

Comments

@steffahn
Copy link
Member

steffahn commented Mar 4, 2020

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.

@ehuss
Copy link
Contributor

ehuss commented Mar 4, 2020

This all sounds like good changes to me.

@ehuss ehuss added the A-grammar Area: Syntax and parsing label Mar 4, 2020
Havvy pushed a commit to Havvy/reference that referenced this issue Aug 25, 2020
Semicolon or comma in expression statements or match arms, respectively, are optional, but part of the statement / match arm.
Also remove a note about proc-macros from the page about BlockExpression.
Closes rust-lang#773 and closes rust-lang#774.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-grammar Area: Syntax and parsing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants