MCPcopy
hub / github.com/vuejs/core / fastForwardTo

Method fastForwardTo

packages/compiler-core/src/tokenizer.ts:494–514  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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 `]]>`.

Callers 6

stateInRCDATAMethod · 0.95
stateInCommentLikeMethod · 0.95
handleInAttrValueMethod · 0.95
stateInDeclarationMethod · 0.95
stateInSpecialCommentMethod · 0.95

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected