(endingCodePoint: number)
| 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 = []; |
no test coverage detected