()
| 39 | } |
| 40 | |
| 41 | get lineCol(): { line: number; col: number } { |
| 42 | const start = this.pos; |
| 43 | this.pos = 0; |
| 44 | let line = 1; |
| 45 | let col = 1; |
| 46 | while (this.pos < start) { |
| 47 | if (this.atLineEnd) { |
| 48 | line++; |
| 49 | col = 1; // Reset column on new line |
| 50 | } else { |
| 51 | this.consume(); |
| 52 | col++; |
| 53 | } |
| 54 | } |
| 55 | return { line, col }; |
| 56 | } |
| 57 | |
| 58 | getLine(line: number): string | undefined { |
| 59 | if (line < 1) return undefined; // Lines are 1-indexed |