You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Two 3.0 rules ...
- ifstmtlastl - ifnotstmt30
This commit is contained in:
@@ -53,6 +53,8 @@ class Python30Parser(Python31Parser):
|
|||||||
ifelsestmtc ::= testexpr c_stmts_opt jump_cf_pop else_suitec
|
ifelsestmtc ::= testexpr c_stmts_opt jump_cf_pop else_suitec
|
||||||
|
|
||||||
iflaststmtl ::= testexpr c_stmts_opt jb_pop_top
|
iflaststmtl ::= testexpr c_stmts_opt jb_pop_top
|
||||||
|
iflaststmtl ::= testexpr c_stmts_opt COME_FROM JUMP_BACK COME_FROM POP_TOP
|
||||||
|
|
||||||
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE COME_FROM POP_TOP
|
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE COME_FROM POP_TOP
|
||||||
|
|
||||||
|
|
||||||
@@ -111,6 +113,7 @@ class Python30Parser(Python31Parser):
|
|||||||
# The below rules in fact are the same or similar.
|
# The below rules in fact are the same or similar.
|
||||||
|
|
||||||
jmp_true ::= JUMP_IF_TRUE POP_TOP
|
jmp_true ::= JUMP_IF_TRUE POP_TOP
|
||||||
|
jmp_true_then ::= JUMP_IF_TRUE _come_froms POP_TOP
|
||||||
jmp_false ::= JUMP_IF_FALSE _come_froms POP_TOP
|
jmp_false ::= JUMP_IF_FALSE _come_froms POP_TOP
|
||||||
jmp_false_then ::= JUMP_IF_FALSE POP_TOP
|
jmp_false_then ::= JUMP_IF_FALSE POP_TOP
|
||||||
|
|
||||||
@@ -118,10 +121,12 @@ class Python30Parser(Python31Parser):
|
|||||||
# in the grammar below which is also somewhat hacky.
|
# in the grammar below which is also somewhat hacky.
|
||||||
|
|
||||||
stmt ::= ifstmt30
|
stmt ::= ifstmt30
|
||||||
ifstmt30 ::= testexpr_then _ifstmts_jump30
|
stmt ::= ifnotstmt30
|
||||||
|
ifstmt30 ::= testfalse_then _ifstmts_jump30
|
||||||
|
ifnotstmt30 ::= testtrue_then _ifstmts_jump30
|
||||||
|
|
||||||
testexpr_then ::= testfalse_then
|
|
||||||
testfalse_then ::= expr jmp_false_then
|
testfalse_then ::= expr jmp_false_then
|
||||||
|
testtrue_then ::= expr jmp_true_then
|
||||||
call_stmt ::= expr COME_FROM
|
call_stmt ::= expr COME_FROM
|
||||||
_ifstmts_jump30 ::= c_stmts POP_TOP
|
_ifstmts_jump30 ::= c_stmts POP_TOP
|
||||||
|
|
||||||
|
@@ -183,7 +183,10 @@ def customize_for_version3(self, version):
|
|||||||
# we definitely don't include in the source _[dd].
|
# we definitely don't include in the source _[dd].
|
||||||
TABLE_DIRECT.update({
|
TABLE_DIRECT.update({
|
||||||
'ifstmt30': ( "%|if %c:\n%+%c%-",
|
'ifstmt30': ( "%|if %c:\n%+%c%-",
|
||||||
(0, "testexpr_then"),
|
(0, "testfalse_then"),
|
||||||
|
(1, "_ifstmts_jump30") ),
|
||||||
|
'ifnotstmt30': ( "%|if not %c:\n%+%c%-",
|
||||||
|
(0, "testtrue_then"),
|
||||||
(1, "_ifstmts_jump30") ),
|
(1, "_ifstmts_jump30") ),
|
||||||
"or30": ( "%c or %c",
|
"or30": ( "%c or %c",
|
||||||
(0, "expr"),
|
(0, "expr"),
|
||||||
|
Reference in New Issue
Block a user