@@ -127,11 +127,11 @@ simple_stmt[stmt_ty] (memo):
127127 | &'nonlocal' nonlocal_stmt
128128
129129compound_stmt[stmt_ty]:
130- | &('def' | '@' | ASYNC ) function_def
130+ | &('def' | '@' | 'async' ) function_def
131131 | &'if' if_stmt
132132 | &('class' | '@') class_def
133- | &('with' | ASYNC ) with_stmt
134- | &('for' | ASYNC ) for_stmt
133+ | &('with' | 'async' ) with_stmt
134+ | &('for' | 'async' ) for_stmt
135135 | &'try' try_stmt
136136 | &'while' while_stmt
137137 | match_stmt
@@ -272,7 +272,7 @@ function_def_raw[stmt_ty]:
272272 _PyAST_FunctionDef(n->v.Name.id,
273273 (params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)),
274274 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 {
276276 CHECK_VERSION(
277277 stmt_ty,
278278 5,
@@ -385,7 +385,7 @@ for_stmt[stmt_ty]:
385385 | invalid_for_stmt
386386 | 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] b=block el=[else_block] {
387387 _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] {
389389 CHECK_VERSION(stmt_ty, 5, "Async for loops are", _PyAST_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
390390 | invalid_for_target
391391
@@ -398,9 +398,9 @@ with_stmt[stmt_ty]:
398398 CHECK_VERSION(stmt_ty, 9, "Parenthesized context managers are", _PyAST_With(a, b, NULL, EXTRA)) }
399399 | 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
400400 _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 {
402402 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 {
404404 CHECK_VERSION(stmt_ty, 5, "Async with statements are", _PyAST_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
405405 | invalid_with_stmt
406406
@@ -814,7 +814,7 @@ power[expr_ty]:
814814# Primary elements are things like "obj.something.something", "obj[something]", "obj(something)", "obj" ...
815815
816816await_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)) }
818818 | primary
819819
820820primary[expr_ty]:
@@ -966,7 +966,7 @@ for_if_clauses[asdl_comprehension_seq*]:
966966 | a[asdl_comprehension_seq*]=for_if_clause+ { a }
967967
968968for_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 })* {
970970 CHECK_VERSION(comprehension_ty, 6, "Async comprehensions are", _PyAST_comprehension(a, b, c, 1, p->arena)) }
971971 | 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' z=disjunction { z })* {
972972 _PyAST_comprehension(a, b, c, 0, p->arena) }
@@ -1284,7 +1284,7 @@ invalid_with_item:
12841284 RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }
12851285
12861286invalid_for_target:
1287- | ASYNC ? 'for' a=star_expressions {
1287+ | 'async' ? 'for' a=star_expressions {
12881288 RAISE_SYNTAX_ERROR_INVALID_TARGET(FOR_TARGETS, a) }
12891289
12901290invalid_group:
@@ -1301,12 +1301,12 @@ invalid_import_from_targets:
13011301 RAISE_SYNTAX_ERROR("trailing comma not allowed without surrounding parentheses") }
13021302
13031303invalid_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 ':'") }
13061306invalid_with_stmt_indent:
1307- | [ASYNC ] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT {
1307+ | ['async' ] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT {
13081308 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 {
13101310 RAISE_INDENTATION_ERROR("expected an indented block after 'with' statement on line %d", a->lineno) }
13111311
13121312invalid_try_stmt:
@@ -1367,11 +1367,11 @@ invalid_while_stmt:
13671367 | a='while' named_expression ':' NEWLINE !INDENT {
13681368 RAISE_INDENTATION_ERROR("expected an indented block after 'while' statement on line %d", a->lineno) }
13691369invalid_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 {
13721372 RAISE_INDENTATION_ERROR("expected an indented block after 'for' statement on line %d", a->lineno) }
13731373invalid_def_raw:
1374- | [ASYNC ] a='def' NAME '(' [params] ')' ['->' expression] ':' NEWLINE !INDENT {
1374+ | ['async' ] a='def' NAME '(' [params] ')' ['->' expression] ':' NEWLINE !INDENT {
13751375 RAISE_INDENTATION_ERROR("expected an indented block after function definition on line %d", a->lineno) }
13761376invalid_class_def_raw:
13771377 | 'class' NAME ['(' [arguments] ')'] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
0 commit comments