Exemplo n.º 1
0
    def process(self, code):
        node = Parser.parse(code)

        translation = Translation.TranslationItem(
            None,
            id="de_DE",
            table={
                "Hello World": "Hallo Welt",
                "Short": "Kurz",
                "Thank you for the flowers": "Danke für die Blumen",
                "Hello %1!": "Hallo: %1!",
                "Hello %1! %1!": "Hallo: %1! %1!",
                "Chat[C:Chat (noum)]": "Unterhaltung",
                "Chat %1[C:Chat (noum) %1]": "Unterhaltung %1",
                "You have got a new mail[N:You have got new mails]": {
                    0: "Du hast eine neue E-Mail",
                    1: "Du hast neue E-Mails"
                },
                "You have got a new mail[N:You have got %1 new mails]": {
                    0: "Du hast eine neue E-Mail",
                    1: "Du hast %1 neue E-Mail erhalten"
                }
            })

        TranslationOptimizer.optimize(node, translation)

        return Compressor.Compressor().compress(node)
Exemplo n.º 2
0
 def process(self, code, contextId=""):
     node = Parser.parse(code)
     permutation = Permutation.Permutation({
         'debug': False,
         'legacy': True,
         'engine': 'webkit',
         'version': 3,
         'fullversion': 3.11
     })
     Permutate.patch(node, permutation)
     return Compressor.Compressor().compress(node)
Exemplo n.º 3
0
    def process(self, code):
        node = Parser.parse(code)

        translation = Translation.Translation(
            "de_DE",
            table={
                "Hello World": "Hallo Welt",
                "Short": "Kurz",
                "Thank you for the flowers": "Danke für die Blumen",
                "Hello %1!": "Hallo: %1!",
                "Hello %1! %1!": "Hallo: %1! %1!",
                "Chat (noum)": "Unterhaltung",
                "Chat (noum) %1": "Unterhaltung %1",
                "You have got a new mail": "Du hast eine neue E-Mail",
                "You have got new mails": "Du hast neue E-Mails",
                "You have got %1 new mails": "Du hast %1 neue E-Mail erhalten"
            })

        translation.patch(node)

        return Compressor.Compressor().compress(node)
Exemplo n.º 4
0
 def process(self, code):
     node = Parser.parse(code)
     BlockReducer.optimize(node)
     return Compressor.Compressor().compress(node)
Exemplo n.º 5
0
 def process(self, code):
     return Compressor.Compressor().compress(Parser.parse(code))
Exemplo n.º 6
0
 def process(self, code):
     node = Parser.parse(code)
     ScopeScanner.scan(node)
     CombineDeclarations.optimize(node)
     return Compressor.Compressor().compress(node)
Exemplo n.º 7
0
 def process(self, code):
     node = Parser.parse(code)
     DeadCode.cleanup(node)
     return Compressor.Compressor().compress(node)
Exemplo n.º 8
0
 def process(self, code, contextId=""):
     node = Parser.parse(code)
     CryptPrivates.optimize(node, contextId)
     return Compressor.Compressor().compress(node)
Exemplo n.º 9
0
 def process(self, code):
     node = Parser.parse(code)
     ScopeScanner.scan(node)
     LocalVariables.optimize(node)
     return Compressor.Compressor().compress(node)
Exemplo n.º 10
0
def optimize(node):
    Console.debug("Reducing block complexity...")
    Console.indent()
    result = __optimize(node, Compressor.Compressor())
    Console.outdent()
    return result