disassemble -> ingest where appropriate

As part of tokenization for (de)parsing, we need to do something like a
disassembly, but is is really a little different.

Disassembly, strictly speaking, is done by the xdis module now.
What "ingestion" does is massage the instruction tokens to a form that is
more amenable for parsing.

In sum, ingestion is different than disassembly, although disassembly is
generally the first part of ingestion.
This commit is contained in:
rocky
2016-09-04 11:43:02 -04:00
parent 979bca4fe0
commit c7788e4545
19 changed files with 37 additions and 43 deletions

View File

@@ -110,7 +110,7 @@ class Scanner3(Scanner):
(self.opc.POP_JUMP_IF_TRUE, self.opc.JUMP_ABSOLUTE)]
def disassemble(self, co, classname=None, code_objects={}, show_asm=None):
def ingest(self, co, classname=None, code_objects={}, show_asm=None):
"""
Pick out tokens from an uncompyle6 code object, and transform them,
returning a list of uncompyle6 'Token's.
@@ -837,7 +837,7 @@ if __name__ == "__main__":
import inspect
co = inspect.currentframe().f_code
from uncompyle6 import PYTHON_VERSION
tokens, customize = Scanner3(PYTHON_VERSION).disassemble(co)
tokens, customize = Scanner3(PYTHON_VERSION).ingest(co)
for t in tokens:
print(t)
else: