From 83aee74fce004106571cf27c320c117263055cee Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 3 Sep 2015 22:13:50 +0300 Subject: [PATCH] reference grammar: loop label should be optional This adds missing `?` marks to productions for loops and break/continue. It also adds missing option label to while let loop --- src/doc/grammar.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/doc/grammar.md b/src/doc/grammar.md index 3aa89cba031..76f544e1075 100644 --- a/src/doc/grammar.md +++ b/src/doc/grammar.md @@ -636,31 +636,31 @@ lambda_expr : '|' ident_list '|' expr ; ### While loops ```antlr -while_expr : [ lifetime ':' ] "while" no_struct_literal_expr '{' block '}' ; +while_expr : [ lifetime ':' ] ? "while" no_struct_literal_expr '{' block '}' ; ``` ### Infinite loops ```antlr -loop_expr : [ lifetime ':' ] "loop" '{' block '}'; +loop_expr : [ lifetime ':' ] ? "loop" '{' block '}'; ``` ### Break expressions ```antlr -break_expr : "break" [ lifetime ]; +break_expr : "break" [ lifetime ] ?; ``` ### Continue expressions ```antlr -continue_expr : "continue" [ lifetime ]; +continue_expr : "continue" [ lifetime ] ?; ``` ### For expressions ```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 @@ -694,7 +694,7 @@ else_tail : "else" [ if_expr | if_let_expr | '{' block '}' ] ; ### While let loops ```antlr -while_let_expr : "while" "let" pat '=' expr '{' block '}' ; +while_let_expr : [ lifetime ':' ] ? "while" "let" pat '=' expr '{' block '}' ; ``` ### Return expressions