* Walk the parameter list whose `(` is at `open`, pushing the `[from, to)` * range of each attribute group a parameter starts with — before or after its * modifier — onto `ranges`. Returns the index after the list's `)`.
(s: string, open: number, ranges: number[])
| 305 | * modifier — onto `ranges`. Returns the index after the list's `)`. |
| 306 | */ |
| 307 | function scanParameterList(s: string, open: number, ranges: number[]): number { |
| 308 | let depth = 0; |
| 309 | let i = open; |
| 310 | let atParameterStart = false; |
| 311 | while (i < s.length) { |
| 312 | if (atParameterStart) { |
| 313 | atParameterStart = false; |
| 314 | for (;;) { |
| 315 | i = skipTrivia(s, i); |
| 316 | const c = s.charCodeAt(i); |
| 317 | if (c === CH_LBRACKET) { |
| 318 | const end = attributeEnd(s, i); |
| 319 | if (end < 0) break; |
| 320 | ranges.push(i, end); |
| 321 | i = end; |
| 322 | } else if (isIdentStart(c)) { |
| 323 | const e = wordEnd(s, i + 1); |
| 324 | if (!MODIFIERS.has(s.slice(i, e).toLowerCase())) break; |
| 325 | i = e; |
| 326 | } else { |
| 327 | break; |
| 328 | } |
| 329 | } |
| 330 | continue; |
| 331 | } |
| 332 | const k = commentOrStringEnd(s, i); |
| 333 | if (k >= 0) { |
| 334 | i = k; |
| 335 | continue; |
| 336 | } |
| 337 | const c = s.charCodeAt(i); |
| 338 | if (c === CH_LPAREN || c === CH_LBRACKET) { |
| 339 | if (++depth === 1) atParameterStart = true; |
| 340 | } else if (c === CH_RPAREN || c === CH_RBRACKET) { |
| 341 | if (--depth <= 0) return i + 1; |
| 342 | } else if (c === CH_SEMI && depth === 1) { |
| 343 | atParameterStart = true; |
| 344 | } |
| 345 | i++; |
| 346 | } |
| 347 | return i; |
| 348 | } |
| 349 | |
| 350 | /** The word starting at `i`, lowercased, or '' when no word starts there. */ |
| 351 | function lowerWordAt(s: string, i: number): string { |
no test coverage detected