8000 gh-122951: Simplify the grammar of the assignment rule (#124998) · python/cpython@39c859f · GitHub
[go: up one dir, main page]

Skip to content

Commit 39c859f

Browse files
authored
gh-122951: Simplify the grammar of the assignment rule (#124998)
1 parent 16cd6cc commit 39c859f

File tree

2 files changed

+1652
-1711
lines changed

2 files changed

+1652
-1711
lines changed

Grammar/python.gram

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ assignment[stmt_ty]:
151151
| a=('(' b=single_target ')' { b }
152152
| single_subscript_attribute_target) ':' b=expression c=['=' d=annotated_rhs { d }] {
153153
CHECK_VERSION(stmt_ty, 6, "Variable annotations syntax is", _PyAST_AnnAssign(a, b, c, 0, EXTRA)) }
154-
| a[asdl_expr_seq*]=(z=star_targets '=' { z })+ b=(yield_expr | star_expressions) !'=' tc=[TYPE_COMMENT] {
154+
| a[asdl_expr_seq*]=(z=star_targets '=' { z })+ b=annotated_rhs !'=' tc=[TYPE_COMMENT] {
155155
_PyAST_Assign(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
156-
| a=single_target b=augassign ~ c=(yield_expr | star_expressions) {
156+
| a=single_target b=augassign ~ c=annotated_rhs {
157157
_PyAST_AugAssign(a, b->kind, c, EXTRA) }
158158
| invalid_assignment
159159

0 commit comments

Comments
 (0)
0