diff --git a/parso/python/grammar310.txt b/parso/python/grammar310.txt index 159da4e..3c39bb5 100644 --- a/parso/python/grammar310.txt +++ b/parso/python/grammar310.txt @@ -52,7 +52,7 @@ small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | nonlocal_stmt | assert_stmt) expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) | ('=' (yield_expr|testlist_star_expr))*) -annassign: ':' test ['=' test] +annassign: ':' test ['=' (yield_expr|testlist_star_expr)] testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [','] augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//=') diff --git a/parso/python/grammar38.txt b/parso/python/grammar38.txt index 40908ed..3e94309 100644 --- a/parso/python/grammar38.txt +++ b/parso/python/grammar38.txt @@ -52,7 +52,7 @@ small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | nonlocal_stmt | assert_stmt) expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) | ('=' (yield_expr|testlist_star_expr))*) -annassign: ':' test ['=' test] +annassign: ':' test ['=' (yield_expr|testlist_star_expr)] testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [','] augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//=') diff --git a/parso/python/grammar39.txt b/parso/python/grammar39.txt index 159da4e..3c39bb5 100644 --- a/parso/python/grammar39.txt +++ b/parso/python/grammar39.txt @@ -52,7 +52,7 @@ small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | nonlocal_stmt | assert_stmt) expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) | ('=' (yield_expr|testlist_star_expr))*) -annassign: ':' test ['=' test] +annassign: ':' test ['=' (yield_expr|testlist_star_expr)] testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [','] augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//=') diff --git a/test/test_parser.py b/test/test_parser.py index dff126a..e9a9dda 100644 --- a/test/test_parser.py +++ b/test/test_parser.py @@ -194,6 +194,9 @@ def test_no_error_nodes(each_version): def test_named_expression(works_ge_py38): works_ge_py38.parse("(a := 1, a + 1)") +def test_extended_rhs_annassign(works_ge_py38): + works_ge_py38.parse("x: y = z,") + works_ge_py38.parse("x: Tuple[int, ...] = z, *q, w") @pytest.mark.parametrize( 'param_code', [