@@ -127,11 +127,11 @@ simple_stmt[stmt_ty] (memo):
127
127
| &'nonlocal' nonlocal_stmt
128
128
129
129
compound_stmt[stmt_ty]:
130
- | &('def' | '@' | ASYNC ) function_def
130
+ | &('def' | '@' | 'async' ) function_def
131
131
| &'if' if_stmt
132
132
| &('class' | '@') class_def
133
- | &('with' | ASYNC ) with_stmt
134
- | &('for' | ASYNC ) for_stmt
133
+ | &('with' | 'async' ) with_stmt
134
+ | &('for' | 'async' ) for_stmt
135
135
| &'try' try_stmt
136
136
| &'while' while_stmt
137
137
| match_stmt
@@ -272,7 +272,7 @@ function_def_raw[stmt_ty]:
272
272
_PyAST_FunctionDef(n->v.Name.id,
273
273
(params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)),
274
274
b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA) }
275
- | ASYNC 'def' n=NAME t=[type_params] &&'(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[func_type_comment] b=block {
275
+ | 'async' 'def' n=NAME t=[type_params] &&'(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[func_type_comment] b=block {
276
276
CHECK_VERSION(
277
277
stmt_ty,
278
278
5,
@@ -385,7 +385,7 @@ for_stmt[stmt_ty]:
385
385
| invalid_for_stmt
386
386
| 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] b=block el=[else_block] {
387
387
_PyAST_For(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA) }
388
- | ASYNC 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] b=block el=[else_block] {
388
+ | 'async' 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] b=block el=[else_block] {
389
389
CHECK_VERSION(stmt_ty, 5, "Async for loops are", _PyAST_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
390
390
| invalid_for_target
391
391
@@ -398,9 +398,9 @@ with_stmt[stmt_ty]:
398
398
CHECK_VERSION(stmt_ty, 9, "Parenthesized context managers are", _PyAST_With(a, b, NULL, EXTRA)) }
399
399
| 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
400
400
_PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
401
- | ASYNC 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block {
401
+ | 'async' 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block {
402
402
CHECK_VERSION(stmt_ty, 5, "Async with statements are", _PyAST_AsyncWith(a, b, NULL, EXTRA)) }
403
- | ASYNC 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
403
+ | 'async' 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
404
404
CHECK_VERSION(stmt_ty, 5, "Async with statements are", _PyAST_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
405
405
| invalid_with_stmt
406
406
@@ -814,7 +814,7 @@ power[expr_ty]:
814
814
# Primary elements are things like "obj.something.something", "obj[something]", "obj(something)", "obj" ...
815
815
816
816
await_primary[expr_ty] (memo):
817
- | AWAIT a=primary { CHECK_VERSION(expr_ty, 5, "Await expressions are", _PyAST_Await(a, EXTRA)) }
817
+ | 'await' a=primary { CHECK_VERSION(expr_ty, 5, "Await expressions are", _PyAST_Await(a, EXTRA)) }
818
818
| primary
819
819
820
820
primary[expr_ty]:
@@ -966,7 +966,7 @@ for_if_clauses[asdl_comprehension_seq*]:
966
966
| a[asdl_comprehension_seq*]=for_if_clause+ { a }
967
967
968
968
for_if_clause[comprehension_ty]:
969
- | ASYNC 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' z=disjunction { z })* {
969
+ | 'async' 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' z=disjunction { z })* {
970
970
CHECK_VERSION(comprehension_ty, 6, "Async comprehensions are", _PyAST_comprehension(a, b, c, 1, p->arena)) }
971
971
| 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' z=disjunction { z })* {
972
972
_PyAST_comprehension(a, b, c, 0, p->arena) }
@@ -1284,7 +1284,7 @@ invalid_with_item:
1284
1284
RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }
1285
1285
1286
1286
invalid_for_target:
1287
- | ASYNC ? 'for' a=star_expressions {
1287
+ | 'async' ? 'for' a=star_expressions {
1288
1288
RAISE_SYNTAX_ERROR_INVALID_TARGET(FOR_TARGETS, a) }
1289
1289
1290
1290
invalid_group:
@@ -1301,12 +1301,12 @@ invalid_import_from_targets:
1301
1301
RAISE_SYNTAX_ERROR("trailing comma not allowed without surrounding parentheses") }
1302
1302
1303
1303
invalid_with_stmt:
1304
- | [ASYNC ] 'with' ','.(expression ['as' star_target])+ NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
1305
- | [ASYNC ] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
1304
+ | ['async' ] 'with' ','.(expression ['as' star_target])+ NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
1305
+ | ['async' ] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
1306
1306
invalid_with_stmt_indent:
1307
- | [ASYNC ] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT {
1307
+ | ['async' ] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT {
1308
1308
RAISE_INDENTATION_ERROR("expected an indented block after 'with' statement on line %d", a->lineno) }
1309
- | [ASYNC ] a='with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT {
1309
+ | ['async' ] a='with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT {
1310
1310
RAISE_INDENTATION_ERROR("expected an indented block after 'with' statement on line %d", a->lineno) }
1311
1311
1312
1312
invalid_try_stmt:
@@ -1367,11 +1367,11 @@ invalid_while_stmt:
1367
1367
| a='while' named_expression ':' NEWLINE !INDENT {
1368
1368
RAISE_INDENTATION_ERROR("expected an indented block after 'while' statement on line %d", a->lineno) }
1369
1369
invalid_for_stmt:
1370
- | [ASYNC ] 'for' star_targets 'in' star_expressions NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
1371
- | [ASYNC ] a='for' star_targets 'in' star_expressions ':' NEWLINE !INDENT {
1370
+ | ['async' ] 'for' star_targets 'in' star_expressions NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
1371
+ | ['async' ] a='for' star_targets 'in' star_expressions ':' NEWLINE !INDENT {
1372
1372
RAISE_INDENTATION_ERROR("expected an indented block after 'for' statement on line %d", a->lineno) }
1373
1373
invalid_def_raw:
1374
- | [ASYNC ] a='def' NAME '(' [params] ')' ['->' expression] ':' NEWLINE !INDENT {
1374
+ | ['async' ] a='def' NAME '(' [params] ')' ['->' expression] ':' NEWLINE !INDENT {
1375
1375
RAISE_INDENTATION_ERROR("expected an indented block after function definition on line %d", a->lineno) }
1376
1376
invalid_class_def_raw:
1377
1377
| 'class' NAME ['(' [arguments] ')'] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
0 commit comments