def parse_property(line): match = re.search(r"@property\s*\(.+\)\s*([^*]*\*?)\s*([^;]*);", line) if match: return match.group(2), objc_to_ts_type(match.group(1).strip()) else: return None, None def parse_file(filename, specific_interfaces): interfaces = {} current_interface = None with open(filename, 'r') as file: for line in file: if "@interface" in line: potential_interface = re.search(r"@interface\s*([^:]*):", line) if potential_interface: potential_interface_name = potential_interface.group(1) if potential_interface_name in specific_interfaces: current_interface = potential_interface_name interfaces[current_interface] = {} else: print(f"Could not parse line: {line}") elif "@property" in line and current_interface: prop_name, prop_type = parse_property(line) if prop_name: interfaces[current_interface][prop_name] = prop_type elif "@end" in line: current_interface = None return interfaces