The qualifiers `A ::B::` written right before `end`, outermost first, each with the arguments it writes.
(text: string, end: number)
| 301 | |
| 302 | /** The qualifiers `A<T>::B::` written right before `end`, outermost first, each with the arguments it writes. */ |
| 303 | function qualifiersBefore(text: string, end: number): Array<{ name: string; args: string[] | null }> { |
| 304 | const out: Array<{ name: string; args: string[] | null }> = []; |
| 305 | let at = end; |
| 306 | for (;;) { |
| 307 | while (at > 0 && isSpace(text.charCodeAt(at - 1))) at--; |
| 308 | if (text.slice(at - 2, at) !== '::') return out; |
| 309 | at -= 2; |
| 310 | while (at > 0 && isSpace(text.charCodeAt(at - 1))) at--; |
| 311 | let args: string[] | null = null; |
| 312 | if (text[at - 1] === '>') { |
| 313 | let depth = 0; |
| 314 | let i = at - 1; |
| 315 | const floor = Math.max(0, at - MAX_ARGUMENT_LIST); |
| 316 | for (; i >= floor; i--) { |
| 317 | if (text[i] === '>') depth++; |
| 318 | else if (text[i] === '<' && --depth === 0) break; |
| 319 | } |
| 320 | if (i < floor) return out; |
| 321 | args = argumentsBetween(text, i, at - 1).map((a) => a.text); |
| 322 | at = i; |
| 323 | while (at > 0 && isSpace(text.charCodeAt(at - 1))) at--; |
| 324 | } |
| 325 | let start = at; |
| 326 | while (start > 0 && isWord(text.charCodeAt(start - 1))) start--; |
| 327 | if (start === at) return out; |
| 328 | out.unshift({ name: text.slice(start, at), args }); |
| 329 | at = start; |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | const escapeRegExp = (s: string): string => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); |
| 334 |
no test coverage detected