HwaAnnaLee / androguard

Automatically exported from code.google.com/p/androguard
Apache License 2.0
0 stars 0 forks source link

Formatter in get_source in decompiler.py #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be useful to set a different formatter between "normal" get_source and 
source display.
Below a possible suggestion.    

    def get_source(self, class_name, method_name, formatter="null") :
        if class_name not in self.classes :
            return ""

        lexer = get_lexer_by_name("java", stripall=True)
        lexer.add_filter(MethodFilter(method_name=method_name))
        formatter = NullFormatter()
        if formatter != "null" :
            formatter = TerminalFormatter()
        result = highlight(self.classes[class_name], lexer, formatter)
        return result

    def display_source(self, class_name, method_name) :
        print self.get_source( class_name, method_name, "terminal" )

Original issue reported on code.google.com by liadalex82@gmail.com on 23 Jul 2012 at 2:56

GoogleCodeExporter commented 9 years ago

Original comment by anthony....@gmail.com on 26 Sep 2012 at 6:21