Where the ` ` closing the ` ` at `open` starts, nested ones counted; -1 if none before `to`.
(s: string, open: number, to: number)
| 93 | |
| 94 | /** Where the `</text>` closing the `<text>` at `open` starts, nested ones counted; -1 if none before `to`. */ |
| 95 | function closingText(s: string, open: number, to: number): number { |
| 96 | let depth = 0; |
| 97 | const tag = /<(\/?)text>/g; |
| 98 | tag.lastIndex = open; |
| 99 | let m: RegExpExecArray | null; |
| 100 | while ((m = tag.exec(s)) !== null && m.index < to) { |
| 101 | depth += m[1] ? -1 : 1; |
| 102 | if (depth === 0) return m.index; |
| 103 | } |
| 104 | return -1; |
| 105 | } |
| 106 | |
| 107 | /** Keep what a statement block emits as JavaScript, and blank the C# around it. */ |
| 108 | function keepEmittedScript(s: string, out: string[], from: number, to: number): void { |
no test coverage detected