(ranges: HighlightLine[])
| 17 | }; |
| 18 | |
| 19 | function expandLineRanges(ranges: HighlightLine[]): Set<number> { |
| 20 | const lines = new Set<number>(); |
| 21 | for (const range of ranges) { |
| 22 | if (typeof range === "number") { |
| 23 | lines.add(range); |
| 24 | } else { |
| 25 | const [start, end] = range; |
| 26 | for (let i = start; i <= end; i++) { |
| 27 | lines.add(i); |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | return lines; |
| 32 | } |
| 33 | |
| 34 | function escapeRegExp(str: string): string { |
| 35 | return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |