You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
NT passtmt -> pass to match AST
This commit is contained in:
@@ -220,7 +220,7 @@ class PythonParser(GenericASTBuilder):
|
||||
|
||||
def p_stmt(self, args):
|
||||
"""
|
||||
passstmt ::=
|
||||
pass ::=
|
||||
|
||||
_stmts ::= stmt+
|
||||
|
||||
@@ -235,7 +235,7 @@ class PythonParser(GenericASTBuilder):
|
||||
lastc_stmt ::= ifelsestmtc
|
||||
|
||||
c_stmts_opt ::= c_stmts
|
||||
c_stmts_opt ::= passstmt
|
||||
c_stmts_opt ::= pass
|
||||
|
||||
l_stmts ::= _stmts
|
||||
l_stmts ::= return_stmts
|
||||
@@ -249,7 +249,7 @@ class PythonParser(GenericASTBuilder):
|
||||
lastl_stmt ::= tryelsestmtl
|
||||
|
||||
l_stmts_opt ::= l_stmts
|
||||
l_stmts_opt ::= passstmt
|
||||
l_stmts_opt ::= pass
|
||||
|
||||
suite_stmts ::= _stmts
|
||||
suite_stmts ::= return_stmts
|
||||
@@ -258,7 +258,7 @@ class PythonParser(GenericASTBuilder):
|
||||
suite_stmts_opt ::= suite_stmts
|
||||
|
||||
# passtmt is needed for semantic actions to add "pass"
|
||||
suite_stmts_opt ::= passstmt
|
||||
suite_stmts_opt ::= pass
|
||||
|
||||
else_suite ::= suite_stmts
|
||||
else_suitel ::= l_stmts
|
||||
|
@@ -152,7 +152,7 @@ class Python3Parser(PythonParser):
|
||||
else_suite _come_froms
|
||||
|
||||
# ifelsestmt ::= testexpr c_stmts_opt jump_forward_else
|
||||
# passstmt _come_froms
|
||||
# pass _come_froms
|
||||
|
||||
ifelsestmtc ::= testexpr c_stmts_opt JUMP_ABSOLUTE else_suitec
|
||||
ifelsestmtc ::= testexpr c_stmts_opt jump_absolute_else else_suitec
|
||||
|
@@ -77,7 +77,7 @@ class Python35Parser(Python34Parser):
|
||||
LOAD_GLOBAL COMPARE_OP POP_JUMP_IF_FALSE
|
||||
POP_TOP POP_TOP POP_TOP POP_EXCEPT POP_BLOCK
|
||||
JUMP_ABSOLUTE END_FINALLY JUMP_BACK
|
||||
passstmt POP_BLOCK JUMP_ABSOLUTE
|
||||
pass POP_BLOCK JUMP_ABSOLUTE
|
||||
COME_FROM_LOOP
|
||||
|
||||
stmt ::= async_forelse_stmt
|
||||
|
@@ -32,7 +32,7 @@ RETURN_NONE = AST('stmt',
|
||||
PASS = AST('stmts',
|
||||
[ AST('sstmt',
|
||||
[ AST('stmt',
|
||||
[ AST('passstmt', [])])])])
|
||||
[ AST('pass', [])])])])
|
||||
|
||||
ASSIGN_DOC_STRING = lambda doc_string: \
|
||||
AST('stmt',
|
||||
@@ -276,7 +276,7 @@ TABLE_DIRECT = {
|
||||
'except_cond1': ( '%|except %c:\n', 1 ),
|
||||
'except_suite': ( '%+%c%-%C', 0, (1, maxint, '') ),
|
||||
'except_suite_finalize': ( '%+%c%-%C', 1, (3, maxint, '') ),
|
||||
'passstmt': ( '%|pass\n', ),
|
||||
'pass': ( '%|pass\n', ),
|
||||
'STORE_FAST': ( '%{pattr}', ),
|
||||
'kv': ( '%c: %c', 3, 1 ),
|
||||
'kv2': ( '%c: %c', 1, 2 ),
|
||||
|
@@ -86,7 +86,7 @@ ExtractInfo = namedtuple("ExtractInfo",
|
||||
TABLE_DIRECT_FRAGMENT = {
|
||||
'break': ( '%|%rbreak\n', ),
|
||||
'continue ': ( '%|%rcontinue\n', ),
|
||||
'passstmt': ( '%|%rpass\n', ),
|
||||
'pass': ( '%|%rpass\n', ),
|
||||
'raise_stmt0': ( '%|%rraise\n', ),
|
||||
'import': ( '%|import %c%x\n', 2, (2, (0, 1)), ),
|
||||
'importfrom': ( '%|from %[2]{pattr}%x import %c\n', (2, (0, 1)), 3),
|
||||
@@ -850,7 +850,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
||||
def n__ifstmts_jump_exit(self, node):
|
||||
if len(node) > 1:
|
||||
if (node[0] == 'c_stmts_opt' and
|
||||
node[0][0] == 'passstmt' and
|
||||
node[0][0] == 'pass' and
|
||||
node[1].kind.startswith('JUMP_FORWARD')):
|
||||
self.set_pos_info(node[1], node[0][0].start, node[0][0].finish)
|
||||
|
||||
|
Reference in New Issue
Block a user