Separate output into its own module

This commit is contained in:
James Westman 2022-10-14 21:04:37 -05:00
parent 8cf793023d
commit a24f16109f
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
33 changed files with 407 additions and 291 deletions

View file

@ -23,6 +23,7 @@ import difflib
import os
from . import decompiler, tokenizer, parser
from .outputs.xml import XmlOutput
from .errors import MultipleErrors, PrintableError
from .utils import Colors
@ -57,7 +58,8 @@ def decompile_file(in_file, out_file) -> T.Union[str, CouldNotPort]:
if len(ast.errors):
raise MultipleErrors(ast.errors)
ast.generate()
output = XmlOutput()
output.emit(ast)
except PrintableError as e:
e.pretty_print(out_file, decompiled)