From 93949e822229ff528136f0b18ad965ae4f9e0722 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 2 Dec 2017 10:57:32 -0500 Subject: [PATCH] Small grammar isolation bugs --- uncompyle6/parsers/parse2.py | 5 ++--- uncompyle6/scanners/scanner2.py | 7 +------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/uncompyle6/parsers/parse2.py b/uncompyle6/parsers/parse2.py index 9c4292cf..f20b2ac5 100644 --- a/uncompyle6/parsers/parse2.py +++ b/uncompyle6/parsers/parse2.py @@ -82,8 +82,6 @@ class Python2Parser(PythonParser): raise_stmt2 ::= expr expr RAISE_VARARGS_2 raise_stmt3 ::= expr expr expr RAISE_VARARGS_3 - stmt ::= exec_stmt - del_stmt ::= expr DELETE_SLICE+0 del_stmt ::= expr expr DELETE_SLICE+2 del_stmt ::= expr expr expr DELETE_SLICE+3 @@ -336,9 +334,10 @@ class Python2Parser(PythonParser): continue elif opname == 'EXEC_STMT': self.addRule(""" - exprlist ::= expr+ + stmt ::= exec_stmt exec_stmt ::= expr exprlist DUP_TOP EXEC_STMT exec_stmt ::= expr exprlist EXEC_STMT + exprlist ::= expr+ """, nop_func) continue elif opname == 'JUMP_IF_NOT_DEBUG': diff --git a/uncompyle6/scanners/scanner2.py b/uncompyle6/scanners/scanner2.py index 7e0c32fe..4f28d672 100644 --- a/uncompyle6/scanners/scanner2.py +++ b/uncompyle6/scanners/scanner2.py @@ -1041,15 +1041,10 @@ class Scanner2(Scanner): # or: # RETURN_VALUE POP_TOP .. POP_TOP END_FINALLY skip_come_from = False - if self.version <= 2.5: + if self.version <= 2.6: skip_come_from = (code[offset+3] == self.opc.END_FINALLY or (code[offset+3] == self.opc.POP_TOP and code[offset+4] == self.opc.END_FINALLY)) - else: - skip_come_from = (code[offset+3] == self.opc.END_FINALLY or - (op != self.opc.JUMP_FORWARD - and code[offset+3] == self.opc.POP_TOP - and code[offset+4] == self.opc.END_FINALLY)) if not skip_come_from: # FIXME: rocky: I think we need something like this... if offset not in set(self.ignore_if):