Tighten syntax for try statements
This commit is contained in:
parent
14f43cf5dc
commit
af82141bb6
|
@ -92,7 +92,8 @@ compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
|
|||
if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
|
||||
while_stmt: 'while' test ':' suite ['else' ':' suite]
|
||||
for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
|
||||
try_stmt: 'try' ':' suite (except_clause ':' suite)* ['finally' ':' suite]
|
||||
try_stmt: 'try' ':' suite (except_clause ':' suite)+ | 'try' ':' suite 'finally' ':' suite
|
||||
# NB compile.c makes sure that the default except clause is last
|
||||
except_clause: 'except' [test [',' test]]
|
||||
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
|
||||
|
||||
|
|
Loading…
Reference in New Issue