@@ -39,7 +39,7 @@ fplist: fpdef (',' fpdef)* [',']
3939stmt: simple_stmt | compound_stmt
4040simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
4141small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt | assert_stmt
42- expr_stmt: testlist (augassign testlist | ('=' testlist)*)
42+ expr_stmt: testlist (augassign (yield_expr| testlist) | ('=' (yield_expr| testlist) )*)
4343augassign: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//='
4444# For normal assignments, additional restrictions enforced by the interpreter
4545print_stmt: 'print' ( [ test (',' test)* [','] ] | '>>' test [ (',' test)+ [','] ] )
@@ -49,7 +49,7 @@ flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt
4949break_stmt: 'break'
5050continue_stmt: 'continue'
5151return_stmt: 'return' [testlist]
52- yield_stmt: 'yield' testlist
52+ yield_stmt: yield_expr
5353raise_stmt: 'raise' [test [',' test [',' test]]]
5454import_stmt: import_name | import_from
5555import_name: 'import' dotted_as_names
@@ -86,7 +86,7 @@ arith_expr: term (('+'|'-') term)*
8686term: factor (('*'|'/'|'%'|'//') factor)*
8787factor: ('+'|'-'|'~') factor | power
8888power: atom trailer* ['**' factor]
89- atom: '(' [testlist_gexp] ')' | '[' [listmaker] ']' | '{' [dictmaker] '}' | '`' testlist1 '`' | NAME | NUMBER | STRING+
89+ atom: '(' [yield_expr| testlist_gexp] ')' | '[' [listmaker] ']' | '{' [dictmaker] '}' | '`' testlist1 '`' | NAME | NUMBER | STRING+
9090listmaker: test ( list_for | (',' test)* [','] )
9191testlist_gexp: test ( gen_for | (',' test)* [','] )
9292lambdef: 'lambda' [varargslist] ':' test
@@ -116,3 +116,6 @@ testlist1: test (',' test)*
116116
117117# not used in grammar, but may appear in "node" passed from Parser to Compiler
118118encoding_decl: NAME
119+
120+ yield_expr: 'yield' [testlist]
121+
0 commit comments