The offset of the next code after `at`: past whitespace and comments.
(s: string, at: number)
| 470 | |
| 471 | /** The offset of the next code after `at`: past whitespace and comments. */ |
| 472 | function skipTrivia(s: string, at: number): number { |
| 473 | let i = at; |
| 474 | for (;;) { |
| 475 | while (i < s.length && /\s/.test(s[i]!)) i++; |
| 476 | if (s.startsWith('//', i) || (s[i] === '#' && s[i + 1] !== '[')) { |
| 477 | const end = s.indexOf('\n', i); |
| 478 | if (end < 0) return s.length; |
| 479 | i = end; |
| 480 | } else if (s.startsWith('/*', i)) { |
| 481 | const end = s.indexOf('*/', i); |
| 482 | if (end < 0) return s.length; |
| 483 | i = end + 2; |
| 484 | } else return i; |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | /** |
| 489 | * Every declaration that carries attributes. Read from the source, not from |
no outgoing calls
no test coverage detected