import re recursive_regex = "<([^<>]*REC)*[^<>]*>" regex = "<[^<>]*>" for i in range(20): regex = recursive_regex.replace("REC", regex) lines = open("./layout_of_other_places.tsv").readlines()[1:] if lines[-1] == "": lines = lines[:-1] lines2 = [line.split("\\n") for line in lines] lines = [] for line2 in lines2: bt_idx = 0 line = [] lines.append(line) while bt_idx < len(line2) - 1: if "" in line2[bt_idx] or not line2[bt_idx + 1].startswith(" at "): line.append(line2[bt_idx]) bt_idx += 1 continue line.append(line2[bt_idx] + line2[bt_idx + 1]) bt_idx += 2 lines = [[bt[:7] + re.sub(regex, "<>", bt[7:]) for bt in line[:-1]] for line in lines] bt_set = {} for line in lines: for bt in line[28:]: if "at ./compiler/" in bt and not "layout" in bt: # print(bt) bt_set[bt[6:]] = line break else: print(*line, sep="\n") assert False # for k, v in bt_set.items(): # print(k) # print(*v, sep="\n") # print("\n\n") print(*bt_set, sep="\n") # print(*lines[0], sep="\n")