summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2024-06-04 01:10:15 (GMT)
committerGitHub <noreply@github.com>2024-06-04 01:10:15 (GMT)
commit31a4fb3c74a0284436343858803b54471e2dc9c7 (patch)
tree09111b884347a0563f5eaec2a3e7024c427d9277 /Grammar
parent105f22ea46ac16866e6df18ebae2a8ba422b7f45 (diff)
downloadcpython-31a4fb3c74a0284436343858803b54471e2dc9c7.zip
cpython-31a4fb3c74a0284436343858803b54471e2dc9c7.tar.gz
cpython-31a4fb3c74a0284436343858803b54471e2dc9c7.tar.bz2
gh-119724: Revert "bpo-45759: Better error messages for non-matching 'elif'/'else' statements (#29513)" (#119974)
This reverts commit 1c8f912ebdfdb146cd7dd2d7a3a67d2c5045ddb0.
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 1734479..b14e5dd 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
@@ -1323,10 +1322,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 ':'") }