Skip to content

Commit 0249af4

Browse files
authored
Merge pull request #776 from steffahn/expr_and_blocks
Fix expression and statement grammar.
2 parents e8ba075 + 6b90080 commit 0249af4

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/expressions/block-expr.md

-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ a following semicolon except if its outer expression is a flow control
2828
expression. Furthermore, extra semicolons between statements are allowed, but
2929
these semicolons do not affect semantics.
3030

31-
> Note: The semicolon following a statement is not a part of the statement
32-
> itself. They are invalid when using the `stmt` macro matcher.
33-
3431
When evaluating a block expression, each statement, except for item declaration
3532
statements, is executed sequentially. Then the final expression is executed,
3633
if given.

src/expressions/match-expr.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
>
1010
> _MatchArms_ :\
1111
>    ( _MatchArm_ `=>`
12-
> ( [_BlockExpression_] `,`<sup>?</sup>
13-
> | [_Expression_] `,` )
12+
> ( [_ExpressionWithoutBlock_][_Expression_] `,`
13+
> | [_ExpressionWithBlock_][_Expression_] `,`<sup>?</sup> )
1414
> )<sup>\*</sup>\
15-
> &nbsp;&nbsp; _MatchArm_ `=>` ( [_BlockExpression_] | [_Expression_] ) `,`<sup>?</sup>
15+
> &nbsp;&nbsp; _MatchArm_ `=>` [_Expression_] `,`<sup>?</sup>
1616
>
1717
> _MatchArm_ :\
1818
> &nbsp;&nbsp; [_OuterAttribute_]<sup>\*</sup> _MatchArmPatterns_ _MatchArmGuard_<sup>?</sup>
@@ -146,7 +146,6 @@ expression in the same expression contexts as [attributes on block
146146
expressions].
147147
148148
[_Expression_]: ../expressions.md
149-
[_BlockExpression_]: block-expr.md#block-expressions
150149
[place expression]: ../expressions.md#place-expressions-and-value-expressions
151150
[value expression]: ../expressions.md#place-expressions-and-value-expressions
152151
[_InnerAttribute_]: ../attributes.md

src/statements.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ from the point of declaration until the end of the enclosing block scope.
6969
> **<sup>Syntax</sup>**\
7070
> _ExpressionStatement_ :\
7171
> &nbsp;&nbsp; &nbsp;&nbsp; [_ExpressionWithoutBlock_][expression] `;`\
72-
> &nbsp;&nbsp; | [_ExpressionWithBlock_][expression]
72+
> &nbsp;&nbsp; | [_ExpressionWithBlock_][expression] `;`<sup>?</sup>
7373
7474
An *expression statement* is one that evaluates an [expression] and ignores its
7575
result. As a rule, an expression statement's purpose is to trigger the effects

0 commit comments

Comments
 (0)