pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/9b280ab0ab97902d55ea3bde66b2e23f8b23959f

97560d244c08.css" /> gh-116988: Remove duplicates of `annotated_rhs` in the Grammar (#117004) · python/cpython@9b280ab · GitHub
Skip to content

Commit 9b280ab

Browse files
authored
gh-116988: Remove duplicates of annotated_rhs in the Grammar (#117004)
1 parent 1acd249 commit 9b280ab

File tree

3 files changed

+1626
-2157
lines changed

3 files changed

+1626
-2157
lines changed

Grammar/python.gram

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ fstring_middle[expr_ty]:
915915
| fstring_replacement_field
916916
| t=FSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }
917917
fstring_replacement_field[expr_ty]:
918-
| '{' a=(yield_expr | star_expressions) debug_expr='='? conversion=[fstring_conversion] format=[fstring_full_format_spec] rbrace='}' {
918+
| '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] format=[fstring_full_format_spec] rbrace='}' {
919919
_PyPegen_formatted_value(p, a, debug_expr, conversion, format, rbrace, EXTRA) }
920920
| invalid_replacement_field
921921
fstring_conversion[ResultTokenWithMetadata*]:
@@ -1201,7 +1201,7 @@ invalid_assignment:
12011201
| (star_targets '=')* a=star_expressions '=' {
12021202
RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }
12031203
| (star_targets '=')* a=yield_expr '=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "assignment to yield expression not possible") }
1204-
| a=star_expressions augassign (yield_expr | star_expressions) {
1204+
| a=star_expressions augassign annotated_rhs {
12051205
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
12061206
a,
12071207
"'%s' is an illegal expression for augmented assignment",
@@ -1407,17 +1407,17 @@ invalid_replacement_field:
14071407
| '{' a='!' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: valid expression required before '!'") }
14081408
| '{' a=':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: valid expression required before ':'") }
14091409
| '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: valid expression required before '}'") }
1410-
| '{' !(yield_expr | star_expressions) { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting a valid expression after '{'")}
1411-
| '{' (yield_expr | star_expressions) !('=' | '!' | ':' | '}') {
1410+
| '{' !annotated_rhs { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting a valid expression after '{'")}
1411+
| '{' annotated_rhs !('=' | '!' | ':' | '}') {
14121412
PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '=', or '!', or ':', or '}'") }
1413-
| '{' (yield_expr | star_expressions) '=' !('!' | ':' | '}') {
1413+
| '{' annotated_rhs '=' !('!' | ':' | '}') {
14141414
PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '!', or ':', or '}'") }
1415-
| '{' (yield_expr | star_expressions) '='? invalid_conversion_character
1416-
| '{' (yield_expr | star_expressions) '='? ['!' NAME] !(':' | '}') {
1415+
| '{' annotated_rhs '='? invalid_conversion_character
1416+
| '{' annotated_rhs '='? ['!' NAME] !(':' | '}') {
14171417
PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting ':' or '}'") }
1418-
| '{' (yield_expr | star_expressions) '='? ['!' NAME] ':' fstring_format_spec* !'}' {
1418+
| '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' {
14191419
PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '}', or format specs") }
1420-
| '{' (yield_expr | star_expressions) '='? ['!' NAME] !'}' {
1420+
| '{' annotated_rhs '='? ['!' NAME] !'}' {
14211421
PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '}'") }
14221422

14231423
invalid_conversion_character:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy