* When we wait for one specific character, we can speed things up * by skipping through the buffer until we find it. * * @returns Whether the character was found.
(c: number)
| 492 | * @returns Whether the character was found. |
| 493 | */ |
| 494 | private fastForwardTo(c: number): boolean { |
| 495 | while (++this.index < this.buffer.length) { |
| 496 | const cc = this.buffer.charCodeAt(this.index) |
| 497 | if (cc === CharCodes.NewLine) { |
| 498 | this.newlines.push(this.index) |
| 499 | } |
| 500 | if (cc === c) { |
| 501 | return true |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | /* |
| 506 | * We increment the index at the end of the `parse` loop, |
| 507 | * so set it to `buffer.length - 1` here. |
| 508 | * |
| 509 | * TODO: Refactor `parse` to increment index before calling states. |
| 510 | */ |
| 511 | this.index = this.buffer.length - 1 |
| 512 | |
| 513 | return false |
| 514 | } |
| 515 | |
| 516 | /** |
| 517 | * Comments and CDATA end with `-->` and `]]>`. |
no test coverage detected