| 31 | logger = logging.getLogger("check_header_guards") |
| 32 | |
| 33 | def find_code_boundaries(lines: List[str]) -> (int, int): |
| 34 | inside_comment : bool = False |
| 35 | |
| 36 | start = len(lines) |
| 37 | end = -1 |
| 38 | line_num = 0 |
| 39 | for line in lines: |
| 40 | stripped_line : str = line.strip() |
| 41 | if stripped_line.startswith("/*"): # block comment start |
| 42 | inside_comment = True |
| 43 | |
| 44 | if not inside_comment and not stripped_line.startswith("//") and stripped_line != "": |
| 45 | start = min(line_num, start) |
| 46 | end = line_num |
| 47 | |
| 48 | if inside_comment and stripped_line.endswith("*/"): |
| 49 | inside_comment = False |
| 50 | |
| 51 | line_num += 1 |
| 52 | |
| 53 | return start, end |
| 54 | |
| 55 | |
| 56 | def is_define(line: str) -> bool: |