Skip to content

Commit b8152d6

Browse files
committed
fix: semicolon can be combined with expr_ending_with_block
1 parent 60cbbb0 commit b8152d6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

grammar.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ module.exports = grammar({
165165
stmt: $ => $._stmt,
166166
_stmt: $ => choice(
167167
$.expr_stmt,
168+
$._expr_ending_with_block,
168169
$._global_stmt,
169170
),
170171

@@ -180,13 +181,10 @@ module.exports = grammar({
180181
),
181182

182183
expr_stmt: $ => $._expr_stmt,
183-
_expr_stmt: $ => choice(
184-
seq($._expr, ';'),
185-
prec(1, $._expr_ending_with_block),
186-
),
184+
_expr_stmt: $ => seq($._expr, ';'),
187185

188186
expr: $ => $._expr,
189-
_expr: $ => choice(
187+
_expr: $ => prec(1, choice(
190188
$.ident,
191189
$.assign_expr,
192190
$.call_expr,
@@ -195,7 +193,7 @@ module.exports = grammar({
195193
$.break_expr,
196194
$.cont_expr,
197195
$._expr_ending_with_block,
198-
),
196+
)),
199197

200198
assign_expr: $ => $._assign_expr,
201199
_assign_expr: $ => prec.left(PREC.assign, seq(

0 commit comments

Comments
 (0)