From 8b9e0eca426d9482b7e18ebbd55c1cbd892dd177 Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 9 May 2016 11:55:38 -0400 Subject: [PATCH] Some grammar cleanup --- HISTORY.md | 3 ++- uncompyle6/parser.py | 3 +-- uncompyle6/parsers/parse2.py | 1 - uncompyle6/parsers/parse3.py | 2 +- uncompyle6/scanners/scanner27.py | 2 ++ 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index c04c0a53..c07b0257 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -85,7 +85,8 @@ Starnberger got the code to where uncompyle2 was around 2012. This project, uncompyle6, however owes its existence to the fork of uncompyle2 by Myst herie (Mysterie) whose first commit seems to goes back to 2012. I chose this since it seemed to have been at that time -the most actively, if briefly, worked on. +the most actively, if briefly, worked on. I also looked at Dark Fenx's +uncompyle3 for inspiration for Python3. Over the many years, code styles and Python features have changed. However brilliant the code was and still is, it hasn't really diff --git a/uncompyle6/parser.py b/uncompyle6/parser.py index 462f1251..0c2c12cf 100644 --- a/uncompyle6/parser.py +++ b/uncompyle6/parser.py @@ -484,12 +484,11 @@ def get_python_parser(version, debug_parser, compile_mode='exec'): return p class PythonParserSingle(PythonParser): - def p_call_stmt(self, args): + def p_call_stmt_single(self, args): ''' # single-mode compilation. Eval-mode interactive compilation # drops the last rule. - call_stmt ::= expr POP_TOP call_stmt ::= expr PRINT_EXPR ''' diff --git a/uncompyle6/parsers/parse2.py b/uncompyle6/parsers/parse2.py index 4c8e7b1b..64709855 100644 --- a/uncompyle6/parsers/parse2.py +++ b/uncompyle6/parsers/parse2.py @@ -144,7 +144,6 @@ class Python2Parser(PythonParser): stmt ::= classdef stmt ::= call_stmt - call_stmt ::= expr POP_TOP stmt ::= return_stmt return_stmt ::= ret_expr RETURN_VALUE diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index b12f3b30..6fcf06c6 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -261,7 +261,7 @@ class Python3Parser(PythonParser): # COME_FROM targets from the wrong places trystmt ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK - try_middle _come_from _come_from + try_middle _come_from # this is nested inside a trystmt tryfinallystmt ::= SETUP_FINALLY suite_stmts_opt diff --git a/uncompyle6/scanners/scanner27.py b/uncompyle6/scanners/scanner27.py index 18863f87..546a9acd 100755 --- a/uncompyle6/scanners/scanner27.py +++ b/uncompyle6/scanners/scanner27.py @@ -31,6 +31,8 @@ class Scanner27(scan.Scanner): The main part of this procedure is modelled after dis.disassemble(). """ + + # dis.disassemble(co) # DEBUG rv = [] customize = {} Token = self.Token # shortcut