Rollup merge of #28202 - matklad:grammar-loop-labels, r=steveklabnik

This adds missing `?` marks to productions for loops and break/continue.

It also adds missing option label to while let loop.


Note that '[' foo ']' means grouping in BNF, and '?' is used for possible missing items.

r? @steveklabnik
This commit is contained in:
Steve Klabnik 2015-09-03 20:10:07 -04:00
commit b96618e18b

View File

@ -636,31 +636,31 @@ lambda_expr : '|' ident_list '|' expr ;
### While loops ### While loops
```antlr ```antlr
while_expr : [ lifetime ':' ] "while" no_struct_literal_expr '{' block '}' ; while_expr : [ lifetime ':' ] ? "while" no_struct_literal_expr '{' block '}' ;
``` ```
### Infinite loops ### Infinite loops
```antlr ```antlr
loop_expr : [ lifetime ':' ] "loop" '{' block '}'; loop_expr : [ lifetime ':' ] ? "loop" '{' block '}';
``` ```
### Break expressions ### Break expressions
```antlr ```antlr
break_expr : "break" [ lifetime ]; break_expr : "break" [ lifetime ] ?;
``` ```
### Continue expressions ### Continue expressions
```antlr ```antlr
continue_expr : "continue" [ lifetime ]; continue_expr : "continue" [ lifetime ] ?;
``` ```
### For expressions ### For expressions
```antlr ```antlr
for_expr : [ lifetime ':' ] "for" pat "in" no_struct_literal_expr '{' block '}' ; for_expr : [ lifetime ':' ] ? "for" pat "in" no_struct_literal_expr '{' block '}' ;
``` ```
### If expressions ### If expressions
@ -694,7 +694,7 @@ else_tail : "else" [ if_expr | if_let_expr | '{' block '}' ] ;
### While let loops ### While let loops
```antlr ```antlr
while_let_expr : "while" "let" pat '=' expr '{' block '}' ; while_let_expr : [ lifetime ':' ] ? "while" "let" pat '=' expr '{' block '}' ;
``` ```
### Return expressions ### Return expressions