summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorT. Wouters <thomas@python.org>2024-06-04 06:36:16 (GMT)
committerGitHub <noreply@github.com>2024-06-04 06:36:16 (GMT)
commit6be55f1bedcd076c12d00bf061bbcffc4ed8073a (patch)
tree1dafe40cef6dbbbf2d849df4eba80b5f3a183bb8 /Grammar
parente5fb3a2385809f6cbdba2061b40fecf5b234f549 (diff)
downloadcpython-6be55f1bedcd076c12d00bf061bbcffc4ed8073a.zip
cpython-6be55f1bedcd076c12d00bf061bbcffc4ed8073a.tar.gz
cpython-6be55f1bedcd076c12d00bf061bbcffc4ed8073a.tar.bz2
[3.13] gh-119724: Revert "bpo-45759: Better error messages for non-matching 'elif'/'else' statements (GH-29513)" (GH-119974) (GH-120013)
This reverts commit 1c8f912ebdfdb146cd7dd2d7a3a67d2c5045ddb0. (cherry picked from commit 31a4fb3c74a0284436343858803b54471e2dc9c7)
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/python.gram5
1 files changed, 0 insertions, 5 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram
index c04bc64..5a181dc 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -127,7 +127,6 @@ simple_stmt[stmt_ty] (memo):
| &'nonlocal' nonlocal_stmt
compound_stmt[stmt_ty]:
- | invalid_compound_stmt
| &('def' | '@' | 'async') function_def
| &'if' if_stmt
| &('class' | '@') class_def
@@ -1317,10 +1316,6 @@ invalid_import_from_targets:
| token=NEWLINE {
RAISE_SYNTAX_ERROR_STARTING_FROM(token, "Expected one or more names after 'import'") }
-invalid_compound_stmt:
- | a='elif' named_expression ':' { RAISE_SYNTAX_ERROR_STARTING_FROM(a, "'elif' must match an if-statement here") }
- | a='else' ':' { RAISE_SYNTAX_ERROR_STARTING_FROM(a, "'else' must match a valid statement here") }
-
invalid_with_stmt:
| ['async'] 'with' ','.(expression ['as' star_target])+ NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
| ['async'] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }