summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorDavid Rubin <87927264+Rexicon226@users.noreply.github.com>2024-04-24 17:16:06 (GMT)
committerGitHub <noreply@github.com>2024-04-24 17:16:06 (GMT)
commit9b280ab0ab97902d55ea3bde66b2e23f8b23959f (patch)
tree41f9ffb192f2ebd6cfe5dad37581892f52502a3b /Grammar
parent1acd2497983f1a78dffd6e5b3e0f5dd0920a550f (diff)
downloadcpython-9b280ab0ab97902d55ea3bde66b2e23f8b23959f.zip
cpython-9b280ab0ab97902d55ea3bde66b2e23f8b23959f.tar.gz
cpython-9b280ab0ab97902d55ea3bde66b2e23f8b23959f.tar.bz2
gh-116988: Remove duplicates of `annotated_rhs` in the Grammar (#117004)
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/python.gram18
1 files changed, 9 insertions, 9 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram
index 11438e5..3943d7f 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -915,7 +915,7 @@ fstring_middle[expr_ty]:
| fstring_replacement_field
| t=FSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }
fstring_replacement_field[expr_ty]:
- | '{' a=(yield_expr | star_expressions) debug_expr='='? conversion=[fstring_conversion] format=[fstring_full_format_spec] rbrace='}' {
+ | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] format=[fstring_full_format_spec] rbrace='}' {
_PyPegen_formatted_value(p, a, debug_expr, conversion, format, rbrace, EXTRA) }
| invalid_replacement_field
fstring_conversion[ResultTokenWithMetadata*]:
@@ -1201,7 +1201,7 @@ invalid_assignment:
| (star_targets '=')* a=star_expressions '=' {
RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }
| (star_targets '=')* a=yield_expr '=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "assignment to yield expression not possible") }
- | a=star_expressions augassign (yield_expr | star_expressions) {
+ | a=star_expressions augassign annotated_rhs {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
a,
"'%s' is an illegal expression for augmented assignment",
@@ -1407,17 +1407,17 @@ invalid_replacement_field:
| '{' a='!' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: valid expression required before '!'") }
| '{' a=':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: valid expression required before ':'") }
| '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: valid expression required before '}'") }
- | '{' !(yield_expr | star_expressions) { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting a valid expression after '{'")}
- | '{' (yield_expr | star_expressions) !('=' | '!' | ':' | '}') {
+ | '{' !annotated_rhs { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting a valid expression after '{'")}
+ | '{' annotated_rhs !('=' | '!' | ':' | '}') {
PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '=', or '!', or ':', or '}'") }
- | '{' (yield_expr | star_expressions) '=' !('!' | ':' | '}') {
+ | '{' annotated_rhs '=' !('!' | ':' | '}') {
PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '!', or ':', or '}'") }
- | '{' (yield_expr | star_expressions) '='? invalid_conversion_character
- | '{' (yield_expr | star_expressions) '='? ['!' NAME] !(':' | '}') {
+ | '{' annotated_rhs '='? invalid_conversion_character
+ | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') {
PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting ':' or '}'") }
- | '{' (yield_expr | star_expressions) '='? ['!' NAME] ':' fstring_format_spec* !'}' {
+ | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' {
PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '}', or format specs") }
- | '{' (yield_expr | star_expressions) '='? ['!' NAME] !'}' {
+ | '{' annotated_rhs '='? ['!' NAME] !'}' {
PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '}'") }
invalid_conversion_character: