@@ -37,8 +37,9 @@ stmt: simple_stmt | compound_stmt
3737simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
3838small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt |
3939 import_stmt | global_stmt | nonlocal_stmt | assert_stmt)
40- expr_stmt: testlist (augassign (yield_expr|testlist) |
41- ('=' (yield_expr|testlist))*)
40+ expr_stmt: testlist_star_expr (augassign (yield_expr|testlist) |
41+ ('=' (yield_expr|testlist_star_expr))*)
42+ testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']
4243augassign: ('+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' |
4344 '<<=' | '>>=' | '**=' | '//=')
4445# For normal assignments, additional restrictions enforced by the interpreter
@@ -86,9 +87,9 @@ lambdef_nocond: 'lambda' [varargslist] ':' test_nocond
8687or_test: and_test ('or' and_test)*
8788and_test: not_test ('and' not_test)*
8889not_test: 'not' not_test | comparison
89- comparison: star_expr (comp_op star_expr )*
90+ comparison: expr (comp_op expr )*
9091comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not'
91- star_expr: [ '*'] expr
92+ star_expr: '*' expr
9293expr: xor_expr ('|' xor_expr)*
9394xor_expr: and_expr ('^' and_expr)*
9495and_expr: shift_expr ('&' shift_expr)*
@@ -101,12 +102,12 @@ atom: ('(' [yield_expr|testlist_comp] ')' |
101102 '[' [testlist_comp] ']' |
102103 '{' [dictorsetmaker] '}' |
103104 NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False')
104- testlist_comp: test ( comp_for | (',' test)* [','] )
105+ testlist_comp: ( test|star_expr) ( comp_for | (',' ( test|star_expr) )* [','] )
105106trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
106107subscriptlist: subscript (',' subscript)* [',']
107108subscript: test | [test] ':' [test] [sliceop]
108109sliceop: ':' [test]
109- exprlist: star_expr (',' star_expr)* [',']
110+ exprlist: (expr| star_expr) (',' (expr| star_expr) )* [',']
110111testlist: test (',' test)* [',']
111112dictorsetmaker: ( (test ':' test (comp_for | (',' test ':' test)* [','])) |
112113 (test (comp_for | (',' test)* [','])) )
@@ -123,8 +124,6 @@ comp_iter: comp_for | comp_if
123124comp_for: 'for' exprlist 'in' or_test [comp_iter]
124125comp_if: 'if' test_nocond [comp_iter]
125126
126- testlist1: test (',' test)*
127-
128127# not used in grammar, but may appear in "node" passed from Parser to Compiler
129128encoding_decl: NAME
130129
0 commit comments