diff --git a/decompiler/__init__.py b/decompiler/__init__.py index 79f4dc0c..9ed6de13 100644 --- a/decompiler/__init__.py +++ b/decompiler/__init__.py @@ -490,9 +490,9 @@ def print_translatestring(self, ast): self.indent_level += 1 self.indent() - self.write('old "%s"' % escape_string(ast.old)) + self.write('old "%s"' % string_escape(ast.old)) self.indent() - self.write('new "%s"' % escape_string(ast.new)) + self.write('new "%s"' % string_escape(ast.new)) self.indent_level -= 1 dispatch[renpy.ast.TranslateString] = print_translatestring diff --git a/decompiler/sl2decompiler.py b/decompiler/sl2decompiler.py index e630435d..c2fa4be9 100644 --- a/decompiler/sl2decompiler.py +++ b/decompiler/sl2decompiler.py @@ -121,11 +121,22 @@ def _print_if(self, ast, keyword): self.write("%s %s:" % (keyword(), condition)) # Every condition has a block of type slast.SLBlock - self.print_block(block, 1) + self.print_block(block) - def print_block(self, ast, extra_indent=0): - # A block just contains a list of children - self.print_nodes(ast.children, extra_indent) + def print_block(self, ast): + # A block contains possible keyword arguments and a list of child nodes + # this is the reason if doesn't keep a list of children but special Blocks + self.indent_level += 1 + + for key, value in ast.keyword: + if ' ' in value: + value = '(%s)' % value + + self.indent() + self.write("%s %s" % (key, value)) + + self.print_nodes(ast.children) + self.indent_level -= 1 dispatch[sl2.slast.SLBlock] = print_block def print_for(self, ast):