@@ -194,7 +194,7 @@ yield_stmt[stmt_ty]: y=yield_expr { _PyAST_Expr(y, EXTRA) }
194194
195195assert_stmt[stmt_ty]: 'assert' a=expression b=[',' z=expression { z }] { _PyAST_Assert(a, b, EXTRA) }
196196
197- import_stmt[stmt_ty]:
197+ import_stmt[stmt_ty]:
198198 | invalid_import
199199 | import_name
200200 | import_from
@@ -415,8 +415,8 @@ try_stmt[stmt_ty]:
415415 | invalid_try_stmt
416416 | 'try' &&':' b=block f=finally_block { _PyAST_Try(b, NULL, NULL, f, EXTRA) }
417417 | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, EXTRA) }
418- | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ el=[else_block] f=[finally_block] {
419- CHECK_VERSION(stmt_ty, 11, "Exception groups are",
418+ | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ el=[else_block] f=[finally_block] {
419+ CHECK_VERSION(stmt_ty, 11, "Exception groups are",
420420 _PyAST_TryStar(b, ex, el, f, EXTRA)) }
421421
422422
@@ -1263,7 +1263,7 @@ invalid_group:
12631263invalid_import:
12641264 | a='import' dotted_name 'from' dotted_name {
12651265 RAISE_SYNTAX_ERROR_STARTING_FROM(a, "Did you mean to use 'from ... import ...' instead?") }
1266-
1266+
12671267invalid_import_from_targets:
12681268 | import_from_as_names ',' NEWLINE {
12691269 RAISE_SYNTAX_ERROR("trailing comma not allowed without surrounding parentheses") }
@@ -1362,3 +1362,7 @@ invalid_replacement_field:
13621362 | '{' a=':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: expression required before ':'") }
13631363 | '{' a='!' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: expression required before '!'") }
13641364 | '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: empty expression not allowed") }
1365+ | '{' (yield_expr | star_expressions) "="? invalid_conversion_character
1366+ invalid_conversion_character:
1367+ | a="!" &(':'|'}') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: missed conversion character") }
1368+ | a="!" !NAME { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: invalid conversion character") }
0 commit comments