@@ -69,7 +69,7 @@ assert_stmt: 'assert' test [',' test]
69697070compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt
7171async_stmt: 'async' (funcdef | with_stmt | for_stmt)
72-if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
72+if_stmt: 'if' namedexpr_test ':' suite ('elif' namedexpr_test ':' suite)* ['else' ':' suite]
7373while_stmt: 'while' test ':' suite ['else' ':' suite]
7474for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
7575try_stmt: ('try' ':' suite
@@ -83,6 +83,7 @@ with_item: test ['as' expr]
8383except_clause: 'except' [test ['as' NAME]]
8484suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
858586+namedexpr_test: test [':=' test]
8687test: or_test ['if' or_test 'else' test] | lambdef
8788test_nocond: or_test | lambdef_nocond
8889lambdef: 'lambda' [varargslist] ':' test
@@ -108,7 +109,7 @@ atom: ('(' [yield_expr|testlist_comp] ')' |
108109 '[' [testlist_comp] ']' |
109110 '{' [dictorsetmaker] '}' |
110111 NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False')
111-testlist_comp: (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] )
112+testlist_comp: (namedexpr_test|star_expr) ( comp_for | (',' (namedexpr_test|star_expr))* [','] )
112113trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
113114subscriptlist: subscript (',' subscript)* [',']
114115subscript: test | [test] ':' [test] [sliceop]
@@ -134,6 +135,7 @@ arglist: argument (',' argument)* [',']
134135# multiple (test comp_for) arguments are blocked; keyword unpackings
135136# that precede iterable unpackings are blocked; etc.
136137argument: ( test [comp_for] |
138+ test ':=' test |
137139 test '=' test |
138140 '**' test |
139141 '*' test )