You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Towards syncing with decompyle3
This commit is contained in:
@@ -58,6 +58,10 @@ class Python37Parser(Python37BaseParser):
|
||||
lastc_stmt ::= forelselaststmt
|
||||
lastc_stmt ::= ifelsestmtc
|
||||
|
||||
# Statements in a loop
|
||||
lstmt ::= stmt
|
||||
l_stmts ::= lstmt+
|
||||
|
||||
c_stmts_opt ::= c_stmts
|
||||
c_stmts_opt ::= pass
|
||||
|
||||
@@ -425,10 +429,11 @@ class Python37Parser(Python37BaseParser):
|
||||
|
||||
subscript2 ::= expr expr DUP_TOP_TWO BINARY_SUBSCR
|
||||
|
||||
# Python 3.2+ has more loop optimization that removes
|
||||
# JUMP_FORWARD in some cases, and hence we also don't
|
||||
# see COME_FROM
|
||||
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_froms
|
||||
# FIXME: The below rule was in uncompyle6.
|
||||
# In decompyle6 though "_ifstmts_jump" is part of an "ifstmt"
|
||||
# where as the below rule is appropriate for an "ifelsesmt"
|
||||
# Investigate and reconcile
|
||||
# _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_froms
|
||||
|
||||
kv3 ::= expr expr STORE_MAP
|
||||
"""
|
||||
@@ -511,6 +516,11 @@ class Python37Parser(Python37BaseParser):
|
||||
ifelsestmtc ::= testexpr c_stmts_opt JUMP_FORWARD else_suitec
|
||||
ifelsestmtl ::= testexpr c_stmts_opt jb_else else_suitel
|
||||
|
||||
# We want to keep the positions of the "then" and
|
||||
# "else" statements in "ifelstmtl" similar to others of this ilk.
|
||||
testexpr_cf ::= testexpr come_froms
|
||||
ifelsestmtl ::= testexpr_cf c_stmts_opt jb_else else_suitel
|
||||
|
||||
# 3.5 Has jump optimization which can route the end of an
|
||||
# "if/then" back to to a loop just before an else.
|
||||
jump_absolute_else ::= jb_else
|
||||
@@ -763,8 +773,15 @@ class Python37Parser(Python37BaseParser):
|
||||
stmt ::= assert2
|
||||
assert2 ::= expr jmp_true LOAD_GLOBAL expr CALL_FUNCTION_1 RAISE_VARARGS_1
|
||||
|
||||
# "assert_invert" tests on the negative of the condition given
|
||||
stmt ::= assert_invert
|
||||
assert_invert ::= testtrue LOAD_GLOBAL RAISE_VARARGS_1
|
||||
|
||||
expr ::= LOAD_ASSERT
|
||||
|
||||
# FIXME: add this:
|
||||
# expr ::= assert_expr_or
|
||||
|
||||
ifstmt ::= testexpr _ifstmts_jump
|
||||
|
||||
testexpr ::= testfalse
|
||||
|
Reference in New Issue
Block a user