()
| 169 | } |
| 170 | |
| 171 | private skipMultiLineComment(): Comment[] { |
| 172 | let comments: Comment[] = []; |
| 173 | let start, loc; |
| 174 | |
| 175 | if (this.trackComment) { |
| 176 | comments = []; |
| 177 | start = this.index - 2; |
| 178 | loc = { |
| 179 | start: { |
| 180 | line: this.lineNumber, |
| 181 | column: this.index - this.lineStart - 2 |
| 182 | }, |
| 183 | end: {} |
| 184 | }; |
| 185 | } |
| 186 | |
| 187 | while (!this.eof()) { |
| 188 | const ch = this.source.charCodeAt(this.index); |
| 189 | if (Character.isLineTerminator(ch)) { |
| 190 | if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) { |
| 191 | ++this.index; |
| 192 | } |
| 193 | ++this.lineNumber; |
| 194 | ++this.index; |
| 195 | this.lineStart = this.index; |
| 196 | } else if (ch === 0x2A) { |
| 197 | // Block comment ends with '*/'. |
| 198 | if (this.source.charCodeAt(this.index + 1) === 0x2F) { |
| 199 | this.index += 2; |
| 200 | if (this.trackComment) { |
| 201 | loc.end = { |
| 202 | line: this.lineNumber, |
| 203 | column: this.index - this.lineStart |
| 204 | }; |
| 205 | const entry: Comment = { |
| 206 | multiLine: true, |
| 207 | slice: [start + 2, this.index - 2], |
| 208 | range: [start, this.index], |
| 209 | loc: loc |
| 210 | }; |
| 211 | comments.push(entry); |
| 212 | } |
| 213 | return comments; |
| 214 | } |
| 215 | ++this.index; |
| 216 | } else { |
| 217 | ++this.index; |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | // Ran off the end of the file - the whole thing is a comment |
| 222 | if (this.trackComment) { |
| 223 | loc.end = { |
| 224 | line: this.lineNumber, |
| 225 | column: this.index - this.lineStart |
| 226 | }; |
| 227 | const entry: Comment = { |
| 228 | multiLine: true, |
no test coverage detected