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

Fix expression and statement grammar. #776

Merged
merged 1 commit into from
Mar 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/expressions/block-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ a following semicolon except if its outer expression is a flow control
expression. Furthermore, extra semicolons between statements are allowed, but
these semicolons do not affect semantics.

> Note: The semicolon following a statement is not a part of the statement
> itself. They are invalid when using the `stmt` macro matcher.

When evaluating a block expression, each statement, except for item declaration
statements, is executed sequentially. Then the final expression is executed,
if given.
Expand Down
7 changes: 3 additions & 4 deletions src/expressions/match-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
>
> _MatchArms_ :\
>    ( _MatchArm_ `=>`
> ( [_BlockExpression_] `,`<sup>?</sup>
> | [_Expression_] `,` )
> ( [_ExpressionWithoutBlock_][_Expression_] `,`
> | [_ExpressionWithBlock_][_Expression_] `,`<sup>?</sup> )
> )<sup>\*</sup>\
> &nbsp;&nbsp; _MatchArm_ `=>` ( [_BlockExpression_] | [_Expression_] ) `,`<sup>?</sup>
> &nbsp;&nbsp; _MatchArm_ `=>` [_Expression_] `,`<sup>?</sup>
>
> _MatchArm_ :\
> &nbsp;&nbsp; [_OuterAttribute_]<sup>\*</sup> _MatchArmPatterns_ _MatchArmGuard_<sup>?</sup>
Expand Down Expand Up @@ -146,7 +146,6 @@ expression in the same expression contexts as [attributes on block
expressions].

[_Expression_]: ../expressions.md
[_BlockExpression_]: block-expr.md#block-expressions
[place expression]: ../expressions.md#place-expressions-and-value-expressions
[value expression]: ../expressions.md#place-expressions-and-value-expressions
[_InnerAttribute_]: ../attributes.md
Expand Down
2 changes: 1 addition & 1 deletion src/statements.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ from the point of declaration until the end of the enclosing block scope.
> **<sup>Syntax</sup>**\
> _ExpressionStatement_ :\
> &nbsp;&nbsp; &nbsp;&nbsp; [_ExpressionWithoutBlock_][expression] `;`\
> &nbsp;&nbsp; | [_ExpressionWithBlock_][expression]
> &nbsp;&nbsp; | [_ExpressionWithBlock_][expression] `;`<sup>?</sup>

An *expression statement* is one that evaluates an [expression] and ignores its
result. As a rule, an expression statement's purpose is to trigger the effects
Expand Down