(token: RawToken)
| 293 | } |
| 294 | |
| 295 | convertToken(token: RawToken): TokenEntry { |
| 296 | const t: TokenEntry = { |
| 297 | type: TokenName[token.type], |
| 298 | value: this.getTokenRaw(token) |
| 299 | }; |
| 300 | if (this.config.range) { |
| 301 | t.range = [token.start, token.end]; |
| 302 | } |
| 303 | if (this.config.loc) { |
| 304 | t.loc = { |
| 305 | start: { |
| 306 | line: this.startMarker.line, |
| 307 | column: this.startMarker.column |
| 308 | }, |
| 309 | end: { |
| 310 | line: this.scanner.lineNumber, |
| 311 | column: this.scanner.index - this.scanner.lineStart |
| 312 | } |
| 313 | }; |
| 314 | } |
| 315 | if (token.type === Token.RegularExpression) { |
| 316 | const pattern = token.pattern as string; |
| 317 | const flags = token.flags as string; |
| 318 | t.regex = { pattern, flags }; |
| 319 | } |
| 320 | |
| 321 | return t; |
| 322 | } |
| 323 | |
| 324 | nextToken(): RawToken { |
| 325 | const token = this.lookahead; |
no test coverage detected