Exemplo n.º 1
0
    def print_atl_rawmulti(self, ast):
        warp_words = WordConcatenator(False)

        # warpers
        if ast.warp_function:
            warp_words.append("warp", ast.warp_function, ast.duration)
        elif ast.warper:
            warp_words.append(ast.warper, ast.duration)
        elif ast.duration != "0":
            warp_words.append("pause", ast.duration)

        warp = warp_words.join()
        words = WordConcatenator(warp and warp[-1] != ' ', True)

        # revolution
        if ast.revolution:
            words.append(ast.revolution)

        # circles
        if ast.circles != "0":
            words.append("circles %s" % ast.circles)

        # splines
        spline_words = WordConcatenator(False)
        for name, expressions in ast.splines:
            spline_words.append(name, expressions[-1])
            for expression in expressions[:-1]:
                spline_words.append("knot", expression)
        words.append(spline_words.join())

        # properties
        property_words = WordConcatenator(False)
        for key, value in ast.properties:
            property_words.append(key, value)
        words.append(property_words.join())

        # with
        expression_words = WordConcatenator(False)
        # TODO There's a lot of cases where pass isn't needed, since we could
        # reorder stuff so there's never 2 expressions in a row. (And it's never
        # necessary for the last one, but we don't know what the last one is
        # since it could get reordered.)
        needs_pass = len(ast.expressions) > 1
        for (expression, with_expression) in ast.expressions:
            expression_words.append(expression)
            if with_expression:
                expression_words.append("with", with_expression)
            if needs_pass:
                expression_words.append("pass")
        words.append(expression_words.join())

        to_write = warp + words.join()
        if to_write:
            self.indent()
            self.write(to_write)
        else:
            # A trailing comma results in an empty RawMultipurpose being
            # generated on the same line as the last real one.
            self.write(",")
Exemplo n.º 2
0
    def print_atl_rawmulti(self, ast):
        warp_words = WordConcatenator(False)

        # warpers
        if ast.warp_function:
            warp_words.append("warp", ast.warp_function, ast.duration)
        elif ast.warper:
            warp_words.append(ast.warper, ast.duration)
        elif ast.duration != "0":
            warp_words.append("pause", ast.duration)

        warp = warp_words.join()
        words = WordConcatenator(warp and warp[-1] != ' ', True)

        # revolution
        if ast.revolution:
            words.append(ast.revolution)

        # circles
        if ast.circles != "0":
            words.append("circles %s" % ast.circles)

        # splines
        spline_words = WordConcatenator(False)
        for name, expressions in ast.splines:
            spline_words.append(name)
            for expression in expressions:
                spline_words.append("knot", expression)
        words.append(spline_words.join())

        # properties
        property_words = WordConcatenator(False)
        for key, value in ast.properties:
            property_words.append(key, value)
        words.append(property_words.join())

        # with
        expression_words = WordConcatenator(False)
        # TODO There's a lot of cases where pass isn't needed, since we could
        # reorder stuff so there's never 2 expressions in a row. (And it's never
        # necessary for the last one, but we don't know what the last one is
        # since it could get reordered.)
        needs_pass = len(ast.expressions) > 1
        for (expression, with_expression) in ast.expressions:
            expression_words.append(expression)
            if with_expression:
                expression_words.append("with", with_expression)
            if needs_pass:
                expression_words.append("pass")
        words.append(expression_words.join())

        to_write = warp + words.join()
        if to_write:
            self.indent()
            self.write(to_write)
        else:
            # A trailing comma results in an empty RawMultipurpose being
            # generated on the same line as the last real one.
            self.write(",")
Exemplo n.º 3
0
    def print_call_location(self, ast):
        self.indent()
        self.write("call location %s" % ast.location)

        if self.label_inside_call_location is not None:
            self.write(" %s" % self.label_inside_call_location.name)
            self.label_inside_call_location = None

        self.write(":")

        with self.increase_indent():
            for zone, props, condition, show, block in ast.zones:
                self.indent()
                words = WordConcatenator(False)
                if isinstance(zone, tuple):
                    zone, image_name, zorder, behind = zone
                    words.append(zone)
                    words.append(*image_name)
                    if zorder is not None:
                        words.append("zorder %s" % zorder)
                    if behind:
                        words.append("behind %s" % ','.join(behind))
                else:
                    words.append(zone)
                if props is not None:
                    words.append("pass %s" % reconstruct_arginfo(props))
                if isinstance(show, renpy.ast.PyExpr):
                    words.append("showif %s" % show)
                if isinstance(condition, renpy.ast.PyExpr):
                    words.append("if %s" % condition)
                self.write("%s:" % words.join())
                self.print_nodes(block, 1)
Exemplo n.º 4
0
    def print_call(self, ast):
        self.indent()
        words = WordConcatenator(False)
        words.append("call")
        if ast.expression:
            words.append("expression")
        words.append(ast.label)

        if hasattr(ast, 'arguments') and ast.arguments is not None:
            if ast.expression:
                words.append("pass")
            words.append(reconstruct_arginfo(ast.arguments))

        # We don't have to check if there's enough elements here,
        # since a Label or a Pass is always emitted after a Call.
        next_block = self.block[self.index + 1]
        if isinstance(next_block, renpy.ast.Label):
            words.append("from %s" % next_block.name)

        self.write(words.join())
Exemplo n.º 5
0
    def print_call(self, ast):
        self.indent()
        words = WordConcatenator(False)
        words.append("call")
        if ast.expression:
            words.append("expression")
        words.append(ast.label)

        if ast.arguments is not None:
            if ast.expression:
                words.append("pass")
            words.append(reconstruct_arginfo(ast.arguments))

        # We don't have to check if there's enough elements here,
        # since a Label or a Pass is always emitted after a Call.
        next_block = self.block[self.index + 1]
        if isinstance(next_block, renpy.ast.Label):
            words.append("from %s" % next_block.name)

        self.write(words.join())
Exemplo n.º 6
0
    def print_atl_rawmulti(self, ast):
        self.indent()
        words = WordConcatenator(False)  # TODO: Make this allow reordering too

        # warpers
        if ast.warp_function:
            words.append("warp", ast.warp_function, ast.duration)
        elif ast.warper:
            words.append(ast.warper, ast.duration)
        elif ast.duration != "0":
            words.append("pause", ast.duration)

        # revolution
        if ast.revolution:
            words.append(ast.revolution)

        # circles
        if ast.circles != "0":
            words.append("circles", ast.circles)

        # splines
        for name, expressions in ast.splines:
            words.append(name)
            for expression in expressions:
                words.append("knot", expression)

        # properties
        for key, value in ast.properties:
            words.append(key, value)

        # with
        for (expression, with_expression) in ast.expressions:
            words.append(expression)
            if with_expression:
                words.append("with", with_expression)

        self.write(words.join())
Exemplo n.º 7
0
    def print_atl_rawmulti(self, ast):
        self.indent()
        words = WordConcatenator(False)

        # warpers
        if ast.warp_function:
            words.append("warp", ast.warp_function, ast.duration)
        elif ast.warper:
            words.append(ast.warper, ast.duration)
        elif ast.duration != "0":
            words.append("pause", ast.duration)

        # revolution
        if ast.revolution:
            words.append(ast.revolution)

        # circles
        if ast.circles != "0":
            words.append("circles", ast.circles)

        # splines
        for name, expressions in ast.splines:
            words.append(name)
            for expression in expressions:
                words.append("knot", expression)

        # properties
        for key, value in ast.properties:
            words.append(key, value)

        # with
        for (expression, with_expression) in ast.expressions:
            words.append(expression)
            if with_expression:
                words.append("with", with_expression)

        self.write(words.join())
Exemplo n.º 8
0
    def print_imspec(self, imspec):
        if imspec[1] is not None:
            begin = "expression %s" % imspec[1]
        else:
            begin = " ".join(imspec[0])

        words = WordConcatenator(begin and begin[-1] != ' ', True)
        if imspec[2] is not None:
            words.append("as %s" % imspec[2])

        if len(imspec[6]) > 0:
            words.append("behind %s" % ', '.join(imspec[6]))

        if isinstance(imspec[4], unicode):
            words.append("onlayer %s" % imspec[4])

        if imspec[5] is not None:
            words.append("zorder %s" % imspec[5])

        if len(imspec[3]) > 0:
            words.append("at %s" % ', '.join(imspec[3]))

        self.write(begin + words.join())
        return words.needs_space
Exemplo n.º 9
0
    def print_imspec(self, imspec):
        if imspec[1] is not None:
            begin = "expression %s" % imspec[1]
        else:
            begin = " ".join(imspec[0])

        words = WordConcatenator(begin and begin[-1] != " ", True)
        if imspec[2] is not None:
            words.append("as %s" % imspec[2])

        if len(imspec[6]) > 0:
            words.append("behind %s" % ", ".join(imspec[6]))

        if imspec[4] != "master":
            words.append("onlayer %s" % imspec[4])

        if imspec[5] is not None:
            words.append("zorder %s" % imspec[5])

        if len(imspec[3]) > 0:
            words.append("at %s" % ", ".join(imspec[3]))

        self.write(begin + words.join())
        return words.needs_space
Exemplo n.º 10
0
    def print_imspec(self, imspec):
        words = WordConcatenator(False)
        if imspec[1] is not None:
            words.append("expression %s" % imspec[1])
        else:
            words.append(" ".join(imspec[0]))

        if imspec[2] is not None:
            words.append("as %s" % imspec[2])

        if len(imspec[6]) > 0:
            words.append("behind %s" % ', '.join(imspec[6]))

        if imspec[4] != "master":
            words.append("onlayer %s" % imspec[4])

        if imspec[5] is not None:
            words.append("zorder %s" % imspec[5])

        if len(imspec[3]) > 0:
            words.append("at %s" % ', '.join(imspec[3]))

        self.write(words.join())
        return words.needs_space
Exemplo n.º 11
0
    def print_imspec(self, imspec):
        words = WordConcatenator(False)
        if imspec[1] is not None:
            words.append("expression %s" % imspec[1])
        else:
            words.append(" ".join(imspec[0]))

        if imspec[2] is not None:
            words.append("as %s" % imspec[2])

        if len(imspec[6]) > 0:
            words.append("behind %s" % ', '.join(imspec[6]))

        if imspec[4] != "master":
            words.append("onlayer %s" % imspec[4])

        if imspec[5] is not None:
            words.append("zorder %s" % imspec[5])

        if len(imspec[3]) > 0:
            words.append("at %s" % ', '.join(imspec[3]))

        self.write(words.join())
        return words.needs_space