Skip to content

Commit

Permalink
Add grammar rule involving RETURN_END_IF
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Jul 13, 2024
1 parent e357946 commit ea36ff9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions test/simple_source/bug35/02_for_else_bug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Adapted 3.5 from _bootstrap_external.py


def spec_from_file_location(loader, location):
if loader:
for _ in __file__:
if location:
break
else:
return None
2 changes: 2 additions & 0 deletions uncompyle6/parsers/parse35.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def p_35on(self, args):
return_if_stmt ::= return_expr RETURN_END_IF POP_BLOCK
return_if_lambda ::= RETURN_END_IF_LAMBDA COME_FROM
return ::= return_expr RETURN_END_IF
jb_else ::= JUMP_BACK ELSE
ifelsestmtc ::= testexpr c_stmts_opt JUMP_FORWARD else_suitec
ifelsestmtl ::= testexpr c_stmts_opt jb_else else_suitel
Expand Down
2 changes: 1 addition & 1 deletion uncompyle6/semantics/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
"mkfuncdeco": ("%|@%c\n%c", (0, "expr"), 1),
# A custom rule in n_function def distinguishes whether to call this or
# function_def_async
"mkfuncdeco0": ("%|def %c\n", (0, "mkfunc")),
"mkfuncdeco0": ("%|def %c\n", (0, ("mkfunc", "mkfunc_annotate"))),

# In cases where we desire an explict new line.
# After docstrings which are followed by a "def" is
Expand Down

0 comments on commit ea36ff9

Please sign in to comment.