1import ast 2import sys 3import time 4 5from pegen.testutil import print_memstats 6 7 8def main() -> None: 9 t0 = time.time() 10 for filename in sys.argv[1:]: 11 print(filename, end="\r") 12 try: 13 with open(filename) as file: 14 source = file.read() 15 tree = ast.parse(source, filename) 16 except Exception as err: 17 print(f"{filename}: {err.__class__.__name__}: {err}", file=sys.stderr) 18 tok = None 19 t1 = time.time() 20 dt = t1 - t0 21 print(f"Parsed in {dt:.3f} secs", file=sys.stderr) 22 print_memstats() 23 24 25if __name__ == "__main__": 26 main() 27