()
| 528 | } |
| 529 | |
| 530 | private consumeUnicodeRangeToken(): UnicodeRangeToken { |
| 531 | const digits = []; |
| 532 | let codePoint = this.consumeCodePoint(); |
| 533 | while (isHex(codePoint) && digits.length < 6) { |
| 534 | digits.push(codePoint); |
| 535 | codePoint = this.consumeCodePoint(); |
| 536 | } |
| 537 | let questionMarks = false; |
| 538 | while (codePoint === QUESTION_MARK && digits.length < 6) { |
| 539 | digits.push(codePoint); |
| 540 | codePoint = this.consumeCodePoint(); |
| 541 | questionMarks = true; |
| 542 | } |
| 543 | |
| 544 | if (questionMarks) { |
| 545 | const start = parseInt( |
| 546 | fromCodePoint(...digits.map((digit) => (digit === QUESTION_MARK ? ZERO : digit))), |
| 547 | 16 |
| 548 | ); |
| 549 | const end = parseInt(fromCodePoint(...digits.map((digit) => (digit === QUESTION_MARK ? F : digit))), 16); |
| 550 | return {type: TokenType.UNICODE_RANGE_TOKEN, start, end}; |
| 551 | } |
| 552 | |
| 553 | const start = parseInt(fromCodePoint(...digits), 16); |
| 554 | if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) { |
| 555 | this.consumeCodePoint(); |
| 556 | codePoint = this.consumeCodePoint(); |
| 557 | const endDigits = []; |
| 558 | while (isHex(codePoint) && endDigits.length < 6) { |
| 559 | endDigits.push(codePoint); |
| 560 | codePoint = this.consumeCodePoint(); |
| 561 | } |
| 562 | const end = parseInt(fromCodePoint(...endDigits), 16); |
| 563 | |
| 564 | return {type: TokenType.UNICODE_RANGE_TOKEN, start, end}; |
| 565 | } else { |
| 566 | return {type: TokenType.UNICODE_RANGE_TOKEN, start, end: start}; |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | private consumeIdentLikeToken(): StringValueToken | Token { |
| 571 | const value = this.consumeName(); |
no test coverage detected