11const PREC = {
2+ statment_conflicting_softkeyword : - 10 ,
23 // this resolves a conflict between the usage of ':' in a lambda vs in a
34 // typed parameter. In the case of a lambda, we don't allow typed parameters.
45 lambda : - 2 ,
@@ -165,7 +166,7 @@ module.exports = grammar({
165166 repeat ( seq ( ',' , field ( 'argument' , $ . expression ) ) ) ,
166167 optional ( ',' ) )
167168 ) ,
168- prec ( - 10 , seq (
169+ prec ( PREC . statment_conflicting_softkeyword , seq (
169170 'print' ,
170171 commaSep1 ( field ( 'argument' , $ . expression ) ) ,
171172 optional ( ',' )
@@ -349,7 +350,7 @@ module.exports = grammar({
349350 ) )
350351 ) ) ,
351352
352- match_statement : $ => seq (
353+ match_statement : $ => prec ( PREC . statment_conflicting_softkeyword , seq (
353354 'match' ,
354355 field ( 'subject' ,
355356 choice (
@@ -359,7 +360,7 @@ module.exports = grammar({
359360 ) ,
360361 ':' ,
361362 field ( 'cases' , $ . cases )
362- ) ,
363+ ) ) ,
363364
364365 cases : $ => repeat1 ( $ . case_block ) ,
365366
@@ -549,7 +550,7 @@ module.exports = grammar({
549550 commaSep1 ( $ . identifier )
550551 ) ,
551552
552- exec_statement : $ => seq (
553+ exec_statement : $ => prec ( PREC . statment_conflicting_softkeyword , seq (
553554 'exec' ,
554555 field ( 'code' , $ . string ) ,
555556 optional (
@@ -558,15 +559,15 @@ module.exports = grammar({
558559 commaSep1 ( $ . expression )
559560 )
560561 )
561- ) ,
562+ ) ) ,
562563
563- type_alias_statement : $ => seq (
564+ type_alias_statement : $ => prec ( PREC . statment_conflicting_softkeyword , seq (
564565 'type' ,
565566 field ( 'name' , $ . identifier ) ,
566567 optional ( field ( 'type_parameters' , $ . type_parameters ) ) ,
567568 '=' ,
568569 field ( 'value' , $ . expression )
569- ) ,
570+ ) ) ,
570571
571572 class_definition : $ => seq (
572573 'class' ,
@@ -1191,7 +1192,7 @@ module.exports = grammar({
11911192
11921193 identifier : $ => / [ _ \p{ XID_Start} ] [ _ \p{ XID_Continue} ] * / ,
11931194
1194- keyword_identifier : $ => prec ( - 3 , alias (
1195+ keyword_identifier : $ => prec ( 11 , alias (
11951196 choice (
11961197 'print' ,
11971198 'exec' ,
@@ -1207,7 +1208,7 @@ module.exports = grammar({
12071208 false : $ => 'False' ,
12081209 none : $ => 'None' ,
12091210
1210- await : $ => prec ( PREC . unary , seq (
1211+ await : $ => prec ( PREC . statment_conflicting_softkeyword , seq (
12111212 'await' ,
12121213 $ . primary_expression
12131214 ) ) ,
0 commit comments