Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    def do_print(self, context: PrintContext) -> str:
        components = [
            printer.print(context.create_child())
            for printer in self.children()
        ]

        return ", ".join(components)
Ejemplo n.º 3
0
    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()
        ])
Ejemplo n.º 4
0
 def do_print(self, context: PrintContext) -> str:
     return "{0} = {1};".format(*[
         printer.print(context.create_child())
         for printer in self.children()
     ])
Ejemplo n.º 5
0
 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()
     ])
Ejemplo n.º 6
0
 def do_print(self, context: PrintContext) -> str:
     return "\n".join(
         printer.print(context.create_child())
         for printer in self.children())
Ejemplo n.º 7
0
 def print_fn(printer: Printer, context: PrintContext) -> str:
     components = [
         child.print(context.create_child())
         for child in printer.children()
     ]
     return "\n".join(components)
Ejemplo n.º 8
0
    def do_print(self, context: PrintContext) -> str:
        block_printer = self.children()[0]

        return block_printer.print(context.create_child())
Ejemplo n.º 9
0
    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()))
Ejemplo n.º 10
0
 def do_print(self, context: PrintContext) -> str:
     parameter_printers = self.children()
     return ", ".join([
         printer.print(context.create_child())
         for printer in parameter_printers
     ])
Ejemplo n.º 11
0
    def do_print(self, context: PrintContext) -> str:
        evaluation_printer = self.children()[0]

        return evaluation_printer.print(context.create_child())
Ejemplo n.º 12
0
    def do_print(self, context: PrintContext) -> str:
        eval_printer = self.children()[0]

        return "return {0};".format(eval_printer.print(context.create_child()))
Ejemplo n.º 13
0
 def do_print(self, context: PrintContext) -> str:
     components = [
         printer.print(context.create_child())
         for printer in self.children()
     ]
     return "{0}: {1}".format(*components)