MCPcopy
hub / github.com/niklasvh/html2canvas / consumeStringToken

Method consumeStringToken

src/css/syntax/tokenizer.ts:672–705  ·  view source on GitHub ↗
(endingCodePoint: number)

Source from the content-addressed store, hash-verified

670 }
671
672 private consumeStringToken(endingCodePoint: number): StringValueToken | Token {
673 let value = '';
674 let i = 0;
675
676 do {
677 const codePoint = this._value[i];
678 if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) {
679 value += this.consumeStringSlice(i);
680 return {type: TokenType.STRING_TOKEN, value};
681 }
682
683 if (codePoint === LINE_FEED) {
684 this._value.splice(0, i);
685 return BAD_STRING_TOKEN;
686 }
687
688 if (codePoint === REVERSE_SOLIDUS) {
689 const next = this._value[i + 1];
690 if (next !== EOF && next !== undefined) {
691 if (next === LINE_FEED) {
692 value += this.consumeStringSlice(i);
693 i = -1;
694 this._value.shift();
695 } else if (isValidEscape(codePoint, next)) {
696 value += this.consumeStringSlice(i);
697 value += fromCodePoint(this.consumeEscapedCodePoint());
698 i = -1;
699 }
700 }
701 }
702
703 i++;
704 } while (true);
705 }
706
707 private consumeNumber() {
708 const repr = [];

Callers 2

consumeTokenMethod · 0.95
consumeUrlTokenMethod · 0.95

Calls 3

consumeStringSliceMethod · 0.95
isValidEscapeFunction · 0.85

Tested by

no test coverage detected