Yield start and end positions per line. Args: start: Start position. end: End position. Returns: Iterable of (LINE, COLUMN1, COLUMN2).
(
start: SyntaxPosition, end: SyntaxPosition
)
| 54 | |
| 55 | |
| 56 | def _iter_syntax_lines( |
| 57 | start: SyntaxPosition, end: SyntaxPosition |
| 58 | ) -> Iterable[Tuple[int, int, int]]: |
| 59 | """Yield start and end positions per line. |
| 60 | |
| 61 | Args: |
| 62 | start: Start position. |
| 63 | end: End position. |
| 64 | |
| 65 | Returns: |
| 66 | Iterable of (LINE, COLUMN1, COLUMN2). |
| 67 | """ |
| 68 | |
| 69 | line1, column1 = start |
| 70 | line2, column2 = end |
| 71 | |
| 72 | if line1 == line2: |
| 73 | yield line1, column1, column2 |
| 74 | else: |
| 75 | for first, last, line_no in loop_first_last(range(line1, line2 + 1)): |
| 76 | if first: |
| 77 | yield line_no, column1, -1 |
| 78 | elif last: |
| 79 | yield line_no, 0, column2 |
| 80 | else: |
| 81 | yield line_no, 0, -1 |
| 82 | |
| 83 | |
| 84 | def install( |
no test coverage detected