* When we wait for one specific character, we can speed things up * by skipping through the buffer until we find it. * @param c Current character code point. * @returns Whether the character was found.
(c: number)
| 378 | * @returns Whether the character was found. |
| 379 | */ |
| 380 | private fastForwardTo(c: number): boolean { |
| 381 | while (++this.index < this.buffer.length + this.offset) { |
| 382 | if (this.buffer.charCodeAt(this.index - this.offset) === c) { |
| 383 | return true; |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | /* |
| 388 | * We increment the index at the end of the `parse` loop, |
| 389 | * so set it to `buffer.length - 1` here. |
| 390 | * |
| 391 | * TODO: Refactor `parse` to increment index before calling states. |
| 392 | */ |
| 393 | this.index = this.buffer.length + this.offset - 1; |
| 394 | |
| 395 | return false; |
| 396 | } |
| 397 | |
| 398 | /** |
| 399 | * Emit a comment token and return to the text state. |
no outgoing calls
no test coverage detected