The index after the first `;` from `i` outside parentheses and brackets, or -1 when none comes within `max` characters.
(s: string, i: number, max: number)
| 214 | |
| 215 | /** The index after the first `;` from `i` outside parentheses and brackets, or -1 when none comes within `max` characters. */ |
| 216 | function semicolonEnd(s: string, i: number, max: number): number { |
| 217 | const limit = Math.min(s.length, i + max); |
| 218 | let depth = 0; |
| 219 | while (i < limit) { |
| 220 | const k = commentOrStringEnd(s, i); |
| 221 | if (k >= 0) { |
| 222 | i = k; |
| 223 | continue; |
| 224 | } |
| 225 | const c = s.charCodeAt(i); |
| 226 | if (c === CH_LPAREN || c === CH_LBRACKET) { |
| 227 | depth++; |
| 228 | } else if (c === CH_RPAREN || c === CH_RBRACKET) { |
| 229 | depth--; |
| 230 | } else if (c === CH_SEMI && depth <= 0) { |
| 231 | return i + 1; |
| 232 | } |
| 233 | i++; |
| 234 | } |
| 235 | return -1; |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * The index after the `]` closing the attribute group whose `[` is at `i`, |
no test coverage detected