Adapt for recent options changes in

-T option structure changed.
This commit is contained in:
rocky
2022-01-09 16:01:32 -05:00
parent 2fda52bf45
commit a381b4663b
3 changed files with 4 additions and 2 deletions

View File

@@ -136,7 +136,8 @@ def main_bin():
elif opt in ('--tree+', '-T'): elif opt in ('--tree+', '-T'):
if 'showast' not in options: if 'showast' not in options:
options['showast'] = {} options['showast'] = {}
options['showast']['Full'] = True options['showast']['after'] = True
options['showast']['before'] = True
options['do_verify'] = None options['do_verify'] = None
elif opt in ('--grammar', '-g'): elif opt in ('--grammar', '-g'):
options['showgrammar'] = True options['showgrammar'] = True

View File

@@ -111,6 +111,7 @@ def decompile(
grammar = dict(PARSER_DEFAULT_DEBUG) grammar = dict(PARSER_DEFAULT_DEBUG)
if showgrammar: if showgrammar:
grammar["reduce"] = True grammar["reduce"] = True
debug_opts = {"asm": asm, "tree": showast, "grammar": grammar} debug_opts = {"asm": asm, "tree": showast, "grammar": grammar}
try: try:

View File

@@ -49,7 +49,7 @@ def maybe_show_tree(walker, ast):
stream = sys.stdout stream = sys.stdout
if ( if (
isinstance(walker.showast, dict) isinstance(walker.showast, dict)
and walker.showast.get("Full", False) and walker.showast.get("after", False)
and hasattr(walker, "str_with_template") and hasattr(walker, "str_with_template")
): ):
walker.str_with_template(ast) walker.str_with_template(ast)