def parse(self, source): ast = None try: ast = jsparser.parse(source) except jsparser.ParseError as error: self.parsing_error = ParsingError(error) return ast
def main(): content = open(sys.argv[1]).read() content = indent(js.parse(content)) while main_loop(content): content = main_loop(content) print content print "finished" print content
def main_loop(content): parsed_content = js.parse(content) for c in parsed_content: change = normalize(c) if change: return rewrite(content, change)