You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Fragment fixes (and workarounds)
fragments.py: add more parent offsets. blacken buffer parser3.py: additional grammar rules for fragment parser Misc small typos and corrections
This commit is contained in:
@@ -68,6 +68,11 @@ class Python3Parser(PythonParser):
|
||||
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
||||
JUMP_BACK RETURN_VALUE RETURN_LAST
|
||||
|
||||
# FIXME: This is used only in the fragment parser
|
||||
# Fix the fragment parser so that it adds RETURN_LAST
|
||||
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
||||
JUMP_BACK RETURN_VALUE
|
||||
|
||||
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
||||
COME_FROM JUMP_BACK RETURN_VALUE RETURN_LAST
|
||||
|
||||
@@ -341,6 +346,10 @@ class Python3Parser(PythonParser):
|
||||
stmt ::= return_closure
|
||||
return_closure ::= LOAD_CLOSURE RETURN_VALUE RETURN_LAST
|
||||
|
||||
# FIXME: This is used only in the fragment parser
|
||||
# Fix the fragment parser so that it adds RETURN_LAST
|
||||
return_closure ::= LOAD_CLOSURE RETURN_VALUE
|
||||
|
||||
stmt ::= whileTruestmt
|
||||
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite _come_froms
|
||||
"""
|
||||
|
@@ -418,7 +418,6 @@ TABLE_DIRECT = {
|
||||
'except_suite_finalize': ( '%+%c%-%C', 1, (3, maxint, '') ),
|
||||
|
||||
'pass': ( '%|pass\n', ),
|
||||
'STORE_FAST': ( '%{pattr}', ),
|
||||
'kv': ( '%c: %c', 3, 1 ),
|
||||
'kv2': ( '%c: %c', 1, 2 ),
|
||||
'import': ( '%|import %c\n', 2),
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1443,7 +1443,7 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
list_if = None
|
||||
assert n == "comp_iter"
|
||||
|
||||
# find innermost node
|
||||
# find inner-most node
|
||||
while n == "comp_iter":
|
||||
n = n[0] # recurse one step
|
||||
# FIXME: adjust for set comprehension
|
||||
|
Reference in New Issue
Block a user