Skip to content

Commit 075a6ab

Browse files
committed
Get the parser working with "async yield from".
1 parent 46491ba commit 075a6ab

File tree

8 files changed

+2162
-1933
lines changed

8 files changed

+2162
-1933
lines changed

Grammar/python.gram

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ simple_stmt[stmt_ty] (memo):
127127
| &'raise' raise_stmt
128128
| &'pass' pass_stmt
129129
| &'del' del_stmt
130-
| &'yield' yield_stmt
130+
| &('yield' | 'async') yield_stmt
131131
| &'assert' assert_stmt
132132
| &'break' break_stmt
133133
| &'continue' continue_stmt
@@ -724,6 +724,7 @@ if_expression[expr_ty]:
724724
yield_expr[expr_ty]:
725725
| 'yield' 'from' a=expression { _PyAST_YieldFrom(a, EXTRA) }
726726
| 'yield' a=[star_expressions] { _PyAST_Yield(a, EXTRA) }
727+
| 'async' 'yield' 'from' a=expression { _PyAST_AsyncYieldFrom(a, EXTRA) }
727728

728729
star_expressions[expr_ty]:
729730
| a=star_expression b=(',' c=star_expression { c })+ [','] {

Include/internal/pycore_ast.h

Lines changed: 11 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_ast_state.h

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Parser/Python.asdl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ module Python
7373
| Await(expr value)
7474
| Yield(expr? value)
7575
| YieldFrom(expr value)
76+
| AsyncYieldFrom(expr value)
7677
-- need sequences for compare to distinguish between
7778
-- x < 4 < 3 and (x < 4) < 3
7879
| Compare(expr left, cmpop* ops, expr* comparators)

0 commit comments

Comments
 (0)