Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit883ada9

Browse files
committed
Special syntax error forelif block afterelse
Previously, having an elif block after an else block would raise a standard syntax error.
1 parenta29a9c0 commit883ada9

File tree

2 files changed

+107
-73
lines changed

2 files changed

+107
-73
lines changed

‎Grammar/python.gram‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,7 @@ invalid_elif_stmt:
13961396
invalid_else_stmt:
13971397
| a='else' ':' NEWLINE !INDENT {
13981398
RAISE_INDENTATION_ERROR("expected an indented block after 'else' statement on line %d", a->lineno) }
1399+
| 'else' ':' block 'elif' { RAISE_SYNTAX_ERROR("elif not allowed after else")}
13991400
invalid_while_stmt:
14001401
| 'while' named_expression NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
14011402
| a='while' named_expression ':' NEWLINE !INDENT {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp