(focus: string)
| 5 | type ColumnIndex = number; |
| 6 | |
| 7 | export function parseFocus(focus: string) { |
| 8 | if (!focus) { |
| 9 | throw new Error("Focus cannot be empty"); |
| 10 | } |
| 11 | |
| 12 | try { |
| 13 | const parts = focus.split(/,(?![^\[]*\])/g).map(parsePart); |
| 14 | return fromEntries(flat(parts)); |
| 15 | } catch (error) { |
| 16 | // TODO enhance error |
| 17 | throw error; |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | type Part = [LineIndex, true | ColumnIndex[]]; |
| 22 |