Double -a option show asm before tokenization

This commit is contained in:
rocky
2023-07-04 07:13:54 -04:00
parent 99f054ea9d
commit 227f494fa8
5 changed files with 50 additions and 23 deletions

View File

@@ -17,7 +17,7 @@ import datetime
import os
import py_compile
import sys
from typing import Any, Tuple
from typing import Any, Optional, Tuple
from xdis import iscode
from xdis.load import load_module
@@ -50,7 +50,7 @@ def decompile(
co,
bytecode_version: Tuple[int] = PYTHON_VERSION_TRIPLE,
out=sys.stdout,
showasm=None,
showasm: Optional[str]=None,
showast={},
timestamp=None,
showgrammar=False,
@@ -107,14 +107,11 @@ def decompile(
if source_size:
write("# Size of source mod 2**32: %d bytes" % source_size)
# maybe a second -a will do before as well
asm = "after" if showasm else None
grammar = dict(PARSER_DEFAULT_DEBUG)
if showgrammar:
grammar["reduce"] = True
debug_opts = {"asm": asm, "tree": showast, "grammar": grammar}
debug_opts = {"asm": showasm, "tree": showast, "grammar": grammar}
try:
if mapstream:
@@ -244,7 +241,7 @@ def main(
compiled_files: list,
source_files: list,
outfile=None,
showasm=None,
showasm: Optional[str] = None,
showast={},
do_verify=False,
showgrammar=False,