(in_file: str, lines: List[str])
| 56 | |
| 57 | |
| 58 | def process_file(in_file: str, lines: List[str]) -> str: |
| 59 | out_text = "" |
| 60 | for idx, line in enumerate(lines): |
| 61 | if idx == 0: |
| 62 | guard_match = guard_pattern.match(line.strip()) |
| 63 | if guard_match: |
| 64 | if guard_match[1] in defines: |
| 65 | break |
| 66 | defines.add(guard_match[1]) |
| 67 | else: |
| 68 | once_match = once_pattern.match(line.strip()) |
| 69 | if once_match: |
| 70 | if in_file in defines: |
| 71 | break |
| 72 | defines.add(in_file) |
| 73 | print("Processing file", in_file) |
| 74 | include_match = include_pattern.match(line.strip()) |
| 75 | if include_match and not include_match[1].endswith(".s"): |
| 76 | out_text += f'/* "{in_file}" line {idx} "{include_match[1]}" */\n' |
| 77 | out_text += import_h_file(include_match[1], os.path.dirname(in_file)) |
| 78 | out_text += f'/* end "{include_match[1]}" */\n' |
| 79 | else: |
| 80 | out_text += line |
| 81 | |
| 82 | return out_text |
| 83 | |
| 84 | |
| 85 | def sanitize_path(path: str) -> str: |
no test coverage detected