The end of a `//` comment starting at `i`: its newline (a `\` before it continues the comment).
(source: string, i: number)
| 102 | |
| 103 | /** The end of a `//` comment starting at `i`: its newline (a `\` before it continues the comment). */ |
| 104 | function lineCommentEnd(source: string, i: number): number { |
| 105 | for (;;) { |
| 106 | const nl = source.indexOf('\n', i); |
| 107 | if (nl < 0) return source.length; |
| 108 | let k = nl - 1; |
| 109 | if (source.charCodeAt(k) === 13) k--; |
| 110 | if (source.charCodeAt(k) !== 92) return nl; |
| 111 | i = nl + 1; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /** Past whitespace and comments from `i`. */ |
| 116 | function skipBlank(source: string, i: number): number { |
no outgoing calls
no test coverage detected