From 982a2b51326527122bd757173ae667e99a24b3f5 Mon Sep 17 00:00:00 2001 From: Isaac Yonemoto Date: Thu, 6 Mar 2025 14:50:21 -0600 Subject: [PATCH 1/3] adds labeled switch to the grammar.y documentation --- doc/langref.html.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index d190d195e237..61f18469e89b 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -7954,7 +7954,7 @@ PrimaryExpr / KEYWORD_continue BreakLabel? / KEYWORD_resume Expr / KEYWORD_return Expr? - / BlockLabel? LoopExpr + / BlockLabel? (LoopExpr / SwitchExpr) / Block / CurlySuffixExpr From 3eca94c6c36ee91770cfac10a65bfa30e9d5e53e Mon Sep 17 00:00:00 2001 From: Isaac Yonemoto Date: Thu, 6 Mar 2025 16:43:47 -0600 Subject: [PATCH 2/3] Separate out Switch Expr with no block label case. This must be separate as otherwise, SwitchExpr can not be followed by dot dereferencing, in the same way that if statements can. --- doc/langref.html.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index 61f18469e89b..e683ea1182a8 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -7954,7 +7954,8 @@ PrimaryExpr / KEYWORD_continue BreakLabel? / KEYWORD_resume Expr / KEYWORD_return Expr? - / BlockLabel? (LoopExpr / SwitchExpr) + / BlockLabel? LoopExpr + / BlockLabel SwitchExpr / Block / CurlySuffixExpr From 68851a05ad0038eab1c9032870bd660525870e9d Mon Sep 17 00:00:00 2001 From: Isaac Yonemoto Date: Thu, 6 Mar 2025 17:29:36 -0600 Subject: [PATCH 3/3] also enables parsing of a switch statment that is a loop. --- doc/langref.html.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index e683ea1182a8..7639b85eac59 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -7886,7 +7886,7 @@ Statement / KEYWORD_errdefer Payload? BlockExprStatement / IfStatement / LabeledStatement - / SwitchExpr + / BlockLabel? SwitchExpr / VarDeclExprStatement ComptimeStatement