From b333d7afc22b4ab9a9e3d9305e7af28cda981c9c Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 17 Jan 2020 10:47:38 -0500 Subject: [PATCH] If statement in loop isolation --- test/run-and-email.sh | 18 +++++++++--------- uncompyle6/parser.py | 2 +- uncompyle6/parsers/parse3.py | 10 +++++++--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/test/run-and-email.sh b/test/run-and-email.sh index cfe80f14..e48fb372 100755 --- a/test/run-and-email.sh +++ b/test/run-and-email.sh @@ -35,21 +35,21 @@ for VERSION in $PYVERSIONS ; do MAX_TESTS=237 # We start failing on "mailbox" at 238 ;; 3.2.6 ) - MAX_TESTS=800 + MAX_TESTS=750 # zipfile fails? ;; 3.3.7 ) - MAX_TESTS=800 # We start failing on pkgutil.py + MAX_TESTS=1300 # About 1256 exist ;; 3.4.10 ) MAX_TESTS=800 ;; - 3.6.9 ) - MAX_TESTS=92 # We start failing on cgiltb.py - ;; - 2.6.9 ) - MAX_TESTS=1300 - ;; - * ) + 3.6.9 ) + MAX_TESTS=900 + ;; + 2.6.9 ) + MAX_TESTS=1300 + ;; + * ) MAX_TESTS=800 ;; esac diff --git a/uncompyle6/parser.py b/uncompyle6/parser.py index 9fc394ff..7767a612 100644 --- a/uncompyle6/parser.py +++ b/uncompyle6/parser.py @@ -52,7 +52,7 @@ class PythonParser(GenericASTBuilder): # stmts -> stmts stmt -> stmts stmt stmt ... # collect as stmts -> stmt stmt ... nt_list = [ - 'stmts', 'except_stmts', '_stmts', 'attributes', + 'stmts', 'except_stmts', '_stmts', 'attributes', "l_stmts", 'exprlist', 'kvlist', 'kwargs', 'come_froms', '_come_froms', 'importlist', # Python < 3 diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 9491a6e5..181a9abb 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -156,10 +156,10 @@ class Python3Parser(PythonParser): _ifstmts_jump ::= return_if_stmts _ifstmts_jump ::= c_stmts_opt come_froms - _ifstmts_jumpl ::= return_if_stmts - _ifstmts_jumpl ::= c_stmts_opt come_froms - iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE + + # ifstmts where we are in a loop + _ifstmts_jumpl ::= _ifstmts_jump iflaststmtl ::= testexpr c_stmts_opt JUMP_BACK iflaststmtl ::= testexpr _ifstmts_jumpl @@ -365,6 +365,10 @@ class Python3Parser(PythonParser): lastc_stmt ::= iflaststmtl lastc_stmt ::= forelselaststmt lastc_stmt ::= ifelsestmtc + + # Statements in a loop + lstmt ::= stmt + l_stmts ::= lstmt+ """ def p_loop_stmt3(self, args):