def do_print(self, context: PrintContext) -> str: access_modifier = self.node().access_modifier().represent() static_modifier = " static" if self.node().is_static() else "" identifier = self.node().identifier().represent() argument_list = self.children()[0].print(context.create_child()) body = self.children()[1].print(context.create_child()) return "{0}{1} function {2}({3}) {{\n{4}\n}}".format( access_modifier, static_modifier, identifier, argument_list, body)
def do_print(self, context: PrintContext) -> str: components = [ printer.print(context.create_child()) for printer in self.children() ] return ", ".join(components)
def do_print(self, context: PrintContext) -> str: def configure(ctx: PrintContext): ctx.state().set_indent_size(1) return "class {0} {{\n{1}\n}}".format(*[ printer.print(context.create_child(configure)) for printer in self.children() ])
def do_print(self, context: PrintContext) -> str: return "{0} = {1};".format(*[ printer.print(context.create_child()) for printer in self.children() ])
def do_print(self, context: PrintContext) -> str: return "{0} {1}({2}): {3} {{\n{4}\n}}".format(*[ printer.print(context.create_child()) for printer in self.children() ])
def do_print(self, context: PrintContext) -> str: return "\n".join( printer.print(context.create_child()) for printer in self.children())
def print_fn(printer: Printer, context: PrintContext) -> str: components = [ child.print(context.create_child()) for child in printer.children() ] return "\n".join(components)
def do_print(self, context: PrintContext) -> str: block_printer = self.children()[0] return block_printer.print(context.create_child())
def do_print(self, context: PrintContext) -> str: fn_printer, parameter_list_printer = self.children() return "{0}({1})".format( fn_printer.print(context.create_child()), parameter_list_printer.print(context.create_child()))
def do_print(self, context: PrintContext) -> str: parameter_printers = self.children() return ", ".join([ printer.print(context.create_child()) for printer in parameter_printers ])
def do_print(self, context: PrintContext) -> str: evaluation_printer = self.children()[0] return evaluation_printer.print(context.create_child())
def do_print(self, context: PrintContext) -> str: eval_printer = self.children()[0] return "return {0};".format(eval_printer.print(context.create_child()))
def do_print(self, context: PrintContext) -> str: components = [ printer.print(context.create_child()) for printer in self.children() ] return "{0}: {1}".format(*components)