gh-122951: Simplify the grammar of the assignment rule (#124998)

This commit is contained in:
Rigel Di Scala 2024-10-06 11:55:56 +02:00 committed by GitHub
parent 16cd6cc86b
commit 39c859f6ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2149 additions and 2208 deletions

View File

@ -151,9 +151,9 @@ assignment[stmt_ty]:
| a=('(' b=single_target ')' { b }
| 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)) }
| 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) }
| 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) }
| invalid_assignment

4353
Parser/parser.c generated

File diff suppressed because it is too large Load Diff