From b62752eca13d9dd6389748eaa1324a0eb19f79ce Mon Sep 17 00:00:00 2001 From: x0ret Date: Tue, 14 May 2019 17:51:51 +0430 Subject: [PATCH] 2 more 3.7 chained comparison rule --- uncompyle6/parsers/parse37.py | 8 ++++++-- uncompyle6/semantics/customize37.py | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/uncompyle6/parsers/parse37.py b/uncompyle6/parsers/parse37.py index 269ed980a..73b92acec 100644 --- a/uncompyle6/parsers/parse37.py +++ b/uncompyle6/parsers/parse37.py @@ -88,6 +88,7 @@ def p_37misc(self, args): compare_chained37 ::= expr compare_chained1a_37 compare_chained37 ::= expr compare_chained1b_37 + compare_chained37 ::= expr compare_chained1c_37 compare_chained37_false ::= expr compare_chained1_false_37 compare_chained37_false ::= expr compare_chained2_false_37 @@ -97,13 +98,16 @@ def p_37misc(self, args): compare_chained2a_37 ELSE POP_TOP COME_FROM compare_chained1b_37 ::= expr DUP_TOP ROT_THREE COMPARE_OP POP_JUMP_IF_FALSE compare_chained2b_37 POP_TOP JUMP_FORWARD COME_FROM + compare_chained1c_37 ::= expr DUP_TOP ROT_THREE COMPARE_OP POP_JUMP_IF_FALSE + compare_chained2a_37 POP_TOP compare_chained1_false_37 ::= expr DUP_TOP ROT_THREE COMPARE_OP POP_JUMP_IF_FALSE compare_chained2c_37 POP_TOP JUMP_FORWARD COME_FROM - compare_chained2_false_37 ::= expr DUP_TOP ROT_THREE COMPARE_OP POP_JUMP_IF_FALSE + compare_chained2_false_37 ::= expr DUP_TOP ROT_THREE COMPARE_OP POP_JUMP_IF_FALSE compare_chained2a_false_37 ELSE POP_TOP JUMP_BACK COME_FROM compare_chained2a_37 ::= expr COMPARE_OP POP_JUMP_IF_TRUE JUMP_FORWARD + compare_chained2a_37 ::= expr COMPARE_OP POP_JUMP_IF_TRUE JUMP_BACK compare_chained2a_false_37 ::= expr COMPARE_OP POP_JUMP_IF_FALSE jf_cfs compare_chained2b_37 ::= expr COMPARE_OP come_from_opt POP_JUMP_IF_FALSE JUMP_FORWARD ELSE @@ -114,7 +118,7 @@ def p_37misc(self, args): compare_chained2c_37 ::= expr DUP_TOP ROT_THREE COMPARE_OP come_from_opt POP_JUMP_IF_FALSE compare_chained2a_false_37 - jf_cfs ::= JUMP_FORWARD come_froms + jf_cfs ::= JUMP_FORWARD _come_froms ifelsestmt ::= testexpr c_stmts_opt jf_cfs else_suite opt_come_from_except jmp_false37 ::= POP_JUMP_IF_FALSE COME_FROM diff --git a/uncompyle6/semantics/customize37.py b/uncompyle6/semantics/customize37.py index 71d84dc44..7d97d4a13 100644 --- a/uncompyle6/semantics/customize37.py +++ b/uncompyle6/semantics/customize37.py @@ -51,6 +51,9 @@ def customize_for_version37(self, version): 'compare_chained1b_37': ( ' %[3]{pattr.replace("-", " ")} %p %p', (0, 19), (-4, 19)), + 'compare_chained1c_37': ( + ' %[3]{pattr.replace("-", " ")} %p %p', + (0, 19), (-2, 19)), 'compare_chained2a_37': ( '%[1]{pattr.replace("-", " ")} %p', (0, 19) ),