mirror of https://github.com/python/cpython.git
gh-122951: Simplify the grammar of the assignment rule (#124998)
This commit is contained in:
parent
16cd6cc86b
commit
39c859f6ff
|
@ -151,9 +151,9 @@ assignment[stmt_ty]:
|
||||||
| a=('(' b=single_target ')' { b }
|
| a=('(' b=single_target ')' { b }
|
||||||
| single_subscript_attribute_target) ':' b=expression c=['=' d=annotated_rhs { d }] {
|
| single_subscript_attribute_target) ':' b=expression c=['=' d=annotated_rhs { d }] {
|
||||||
CHECK_VERSION(stmt_ty, 6, "Variable annotations syntax is", _PyAST_AnnAssign(a, b, c, 0, EXTRA)) }
|
CHECK_VERSION(stmt_ty, 6, "Variable annotations syntax is", _PyAST_AnnAssign(a, b, c, 0, EXTRA)) }
|
||||||
| a[asdl_expr_seq*]=(z=star_targets '=' { z })+ b=(yield_expr | star_expressions) !'=' tc=[TYPE_COMMENT] {
|
| a[asdl_expr_seq*]=(z=star_targets '=' { z })+ b=annotated_rhs !'=' tc=[TYPE_COMMENT] {
|
||||||
_PyAST_Assign(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
|
_PyAST_Assign(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
|
||||||
| a=single_target b=augassign ~ c=(yield_expr | star_expressions) {
|
| a=single_target b=augassign ~ c=annotated_rhs {
|
||||||
_PyAST_AugAssign(a, b->kind, c, EXTRA) }
|
_PyAST_AugAssign(a, b->kind, c, EXTRA) }
|
||||||
| invalid_assignment
|
| invalid_assignment
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue