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

Method stateInCommentLike

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

* Comments and CDATA end with `-->` and `]]>`. * * Their common qualities are: * - Their end sequences have a distinct character they start with. * - That character is then repeated, so we have to check multiple repeats. * - All characters but the start character of the sequence can b

(c: number)

Source from the content-addressed store, hash-verified

522 * - All characters but the start character of the sequence can be skipped.
523 */
524 private stateInCommentLike(c: number): void {
525 if (c === this.currentSequence[this.sequenceIndex]) {
526 if (++this.sequenceIndex === this.currentSequence.length) {
527 if (this.currentSequence === Sequences.CdataEnd) {
528 this.cbs.oncdata(this.sectionStart, this.index - 2)
529 } else {
530 this.cbs.oncomment(this.sectionStart, this.index - 2)
531 }
532
533 this.sequenceIndex = 0
534 this.sectionStart = this.index + 1
535 this.state = State.Text
536 }
537 } else if (this.sequenceIndex === 0) {
538 // Fast-forward to the first character of the sequence
539 if (this.fastForwardTo(this.currentSequence[0])) {
540 this.sequenceIndex = 1
541 }
542 } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
543 // Allow long sequences, eg. --->, ]]]>
544 this.sequenceIndex = 0
545 }
546 }
547
548 private startSpecial(sequence: Uint8Array, offset: number) {
549 this.enterRCDATA(sequence, offset)

Callers 1

parseMethod · 0.95

Calls 3

fastForwardToMethod · 0.95
oncdataMethod · 0.80
oncommentMethod · 0.80

Tested by

no test coverage detected