File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -48,17 +48,26 @@ module.exports = grammar({
4848 word : $ => $ . ident ,
4949
5050 supertypes : $ => [
51- $ . _expr ,
51+ $ . expr ,
5252 $ . _pattern ,
5353 $ . _type ,
5454 ] ,
5555
5656 rules : {
5757 trans_unit : $ => listSepBy ( ';' , $ . _expr ) ,
5858
59+ expr : $ => choice (
60+ $ . _expr ,
61+ $ . semi_expr ,
62+ ) ,
63+
64+ _expr_or_semi : $ => choice (
65+ $ . semi_expr ,
66+ $ . _expr ,
67+ ) ,
68+
5969 _expr : $ => choice (
6070 $ . ident ,
61- $ . semi_expr ,
6271 $ . assign_expr ,
6372 $ . call_expr ,
6473 $ . paren_expr ,
@@ -152,7 +161,7 @@ module.exports = grammar({
152161 ) ,
153162
154163 semi_expr : $ => prec . left ( PREC . semi , seq (
155- field ( 'lhs' , $ . _expr ) ,
164+ field ( 'lhs' , $ . _expr_or_semi ) ,
156165 ';' ,
157166 field ( 'rhs' , optional ( $ . _expr ) ) ,
158167 ) ) ,
@@ -170,8 +179,7 @@ module.exports = grammar({
170179
171180 args : $ => seq (
172181 '(' ,
173- sepBy ( ',' , $ . _expr ) ,
174- optional ( ',' ) ,
182+ listSepBy ( ',' , $ . _expr ) ,
175183 ')' ,
176184 ) ,
177185
@@ -332,7 +340,7 @@ module.exports = grammar({
332340
333341 block : $ => seq (
334342 '{' ,
335- optional ( $ . _expr ) ,
343+ optional ( $ . _expr_or_semi ) ,
336344 '}' ,
337345 ) ,
338346
You can’t perform that action at this time.
0 commit comments