@@ -65,16 +65,11 @@ module.exports = grammar({
65
65
conflicts : $ => [
66
66
[ $ . tuple_type , $ . parameter_types ] ,
67
67
[ $ . binding , $ . _simple_expression ] ,
68
- [ $ . binding , $ . ascription_expression ] ,
69
68
[ $ . binding , $ . _type_identifier ] ,
70
- [ $ . if_expression , $ . expression ] ,
71
69
[ $ . while_expression , $ . _simple_expression ] ,
72
- [ $ . for_expression , $ . infix_expression ] ,
73
- [ $ . _indentable_expression , $ . do_while_expression ] ,
74
70
[ $ . if_expression ] ,
75
71
[ $ . match_expression ] ,
76
72
[ $ . _function_constructor , $ . _type_identifier ] ,
77
- [ $ . _type_identifier , $ . identifier ] ,
78
73
[ $ . instance_expression ] ,
79
74
// In case of: 'extension' _indent '{' 'case' operator_identifier 'if' operator_identifier • '=>' …
80
75
// we treat `operator_identifier` as `simple_expression`
@@ -91,7 +86,10 @@ module.exports = grammar({
91
86
[ $ . _full_enum_def ] ,
92
87
// _start_val identifier ',' identifier • ':' …
93
88
[ $ . identifiers , $ . val_declaration ] ,
89
+ // 'enum' operator_identifier _automatic_semicolon '(' ')' • ':' …
94
90
[ $ . class_parameters ] ,
91
+ // 'for' operator_identifier ':' _annotated_type • ':' …
92
+ [ $ . _type , $ . compound_type ]
95
93
] ,
96
94
97
95
word : $ => $ . _alpha_identifier ,
@@ -375,19 +373,19 @@ module.exports = grammar({
375
373
*/
376
374
template_body : $ =>
377
375
choice (
378
- prec . left ( PREC . control , $ . _indented_template_body ) ,
379
- prec . left ( PREC . control , $ . _braced_template_body ) ,
376
+ $ . _indented_template_body ,
377
+ $ . _braced_template_body ,
380
378
) ,
381
379
382
380
_indented_template_body : $ =>
383
- seq ( ":" , $ . _indent , optional ( $ . self_type ) , $ . _block , $ . _outdent ) ,
381
+ prec . left ( PREC . control , seq ( ":" , $ . _indent , optional ( $ . self_type ) , $ . _block , $ . _outdent ) ) ,
384
382
385
383
_braced_template_body : $ =>
386
- seq (
384
+ prec . left ( PREC . control , seq (
387
385
"{" ,
388
386
optional ( choice ( $ . _braced_template_body1 , $ . _braced_template_body2 ) ) ,
389
387
"}" ,
390
- ) ,
388
+ ) ) ,
391
389
392
390
_braced_template_body1 : $ => seq ( optional ( $ . self_type ) , $ . _block ) ,
393
391
_braced_template_body2 : $ =>
@@ -812,7 +810,7 @@ module.exports = grammar({
812
810
repeat1 ( seq ( "with" , field ( "extra" , $ . _annotated_type ) ) ) ,
813
811
) ,
814
812
) ,
815
- prec . left ( - 1 , seq ( field ( "base" , $ . _annotated_type ) , $ . _refinement ) ) ,
813
+ prec . left ( seq ( field ( "base" , $ . _annotated_type ) , $ . _refinement ) ) ,
816
814
prec . left (
817
815
- 1 ,
818
816
seq (
0 commit comments