(code: string)
| 39 | constructor(public line: number, public column: number) {} |
| 40 | |
| 41 | offset(code: string): number { |
| 42 | const lines = code.split('\n'); |
| 43 | const newLines = this.line - 1; |
| 44 | const lineOffset = lines.slice(0, newLines).reduce((acc, curr) => acc + curr.length, 0); |
| 45 | return lineOffset + newLines + this.column; |
| 46 | } |
| 47 | |
| 48 | toString(): string { |
| 49 | return `Line ${this.line}, Column ${this.column}`; |