def main(): cparse = argparse.ArgumentParser(add_help=False) glob.add_args(cparse) cparse.add_argument("--help", action="help", help="Print this message") args = cparse.parse_args() glob.parse_args(cparse, args) glob.g_outfile = args.outfile #test_regexpr() #return 1 glob.g_file = args.infile if args.infile == None: print("js_cc.py: no input files") return -1 f = open(args.infile, "rb") data = f.read() data = str(data, "latin-1") data = data.replace("\r", "") f.close() doloops = not glob.g_emit_code and glob.g_expand_iterators if glob.g_refactor_mode: from js_refactor import refactor buf, node = refactor(data) if args.outfile == "": print(syntaxColor(buf)) elif glob.g_gen_log_code: buf, node = parse(data, expand_loops=doloops, create_logger=True) else: buf, node = parse(data, expand_loops=doloops) if glob.g_emit_code: import js_type_emit js_type_emit.emit(node) if not glob.g_error: if args.outfile != "": f = open(args.outfile, "w") f.write(buf) f.close() else: return -1 return 0
def main(): cparse = argparse.ArgumentParser() glob.add_args(cparse); args = cparse.parse_args() path = args.infile glob.g_file = path file = open(path, "r") buf = file.read() file.close() process(buf)
def main(): cparse = argparse.ArgumentParser(add_help=False) glob.add_args(cparse) cparse.add_argument("--help", action="help", help="Print this message") args = cparse.parse_args() glob.parse_args(cparse, args) glob.g_outfile = args.outfile # test_regexpr() # return 1 glob.g_file = args.infile if args.infile == None: print("js_cc.py: no input files") return -1 f = open(args.infile, "r") data = f.read() f.close() doloops = not glob.g_emit_code and glob.g_expand_iterators if glob.g_refactor_mode: from js_refactor import refactor buf, node = refactor(data) if args.outfile == "": print(buf) elif glob.g_gen_log_code: buf, node = parse(data, expand_loops=doloops, create_logger=True) else: buf, node = parse(data, expand_loops=doloops) if glob.g_emit_code: import js_type_emit js_type_emit.emit(node) if not glob.g_error: if args.outfile != "": f = open(args.outfile, "w") f.write(buf) f.close() else: return -1 return 0
def main(do_clean): global t_stamps, db, typespace, logfile cparse = argparse.ArgumentParser(add_help=False) glob.add_args(cparse, js_cc_mode=False) cparse.add_argument("--help", action="help", help="Print this message") args = cparse.parse_args() glob.parse_args(cparse, args) if glob.g_log_file != None: logfile = glob.g_log_file if glob.g_single_file != None and glob.g_single_file != "": path = glob.g_single_file process_one_file(path) else: process_all_files()