()
| 567 | return c === "-" && n === "-" && (this.#isWhitespace(n2) || n2 === "" || n2 === "-") || c === "/" && n === "/" && (this.#isWhitespace(n2) || n2 === "" || n2 === "/"); |
| 568 | } |
| 569 | #tokenize() { |
| 570 | while (this.#position < this.#source.length) { |
| 571 | if (this.#isLineComment()) { |
| 572 | this.#consumeComment(); |
| 573 | } else if (this.#isWhitespace(this.#currentChar())) { |
| 574 | this.#tokens.push(this.#consumeWhitespace()); |
| 575 | } else if (!this.#possiblePrecedingSymbol() && this.#currentChar() === "." && (this.#isAlpha(this.#nextChar()) || this.#nextChar() === "{" || this.#nextChar() === "-")) { |
| 576 | this.#tokens.push(this.#consumeClassReference()); |
| 577 | } else if (!this.#possiblePrecedingSymbol() && this.#currentChar() === "#" && (this.#isAlpha(this.#nextChar()) || this.#nextChar() === "{")) { |
| 578 | if (this.#template === "lines" && this.#templateMode === "indeterminant") { |
| 579 | this.#templateMode = "command"; |
| 580 | this.#tokens.push(this.#consumeTemplateLogic()); |
| 581 | } else { |
| 582 | this.#tokens.push(this.#consumeIdReference()); |
| 583 | } |
| 584 | } else if (this.#template === "lines" && this.#templateMode === "indeterminant" && this.#templateBraceCount === 0) { |
| 585 | this.#templateMode = "template"; |
| 586 | this.#tokens.push(this.#consumeTemplateLine()); |
| 587 | } else if (this.#currentChar() === "[" && this.#nextChar() === "@") { |
| 588 | this.#tokens.push(this.#consumeAttributeReference()); |
| 589 | } else if (this.#currentChar() === "@") { |
| 590 | this.#tokens.push(this.#consumeShortAttributeReference()); |
| 591 | } else if (this.#currentChar() === "*" && this.#isAlpha(this.#nextChar())) { |
| 592 | this.#tokens.push(this.#consumeStyleReference()); |
| 593 | } else if (this.#inTemplate() && (this.#isAlpha(this.#currentChar()) || this.#currentChar() === "\\") && this.#templateMode !== "command") { |
| 594 | this.#tokens.push(this.#consumeTemplateIdentifier()); |
| 595 | } else if (this.#inCommandMode() && (this.#isAlpha(this.#currentChar()) || this.#isIdentifierChar(this.#currentChar()))) { |
| 596 | this.#tokens.push(this.#consumeIdentifier()); |
| 597 | } else if (this.#isNumeric(this.#currentChar())) { |
| 598 | this.#tokens.push(this.#consumeNumber()); |
| 599 | } else if (this.#inCommandMode() && (this.#currentChar() === '"' || this.#currentChar() === "`")) { |
| 600 | this.#tokens.push(this.#consumeString()); |
| 601 | } else if (this.#inCommandMode() && this.#currentChar() === "'") { |
| 602 | if (this.#isValidSingleQuoteStringStart()) { |
| 603 | this.#tokens.push(this.#consumeString()); |
| 604 | } else { |
| 605 | this.#tokens.push(this.#consumeOp()); |
| 606 | } |
| 607 | } else if (OP_TABLE[this.#currentChar()]) { |
| 608 | if (this.#lastToken === "$" && this.#currentChar() === "{") { |
| 609 | this.#templateBraceCount++; |
| 610 | } |
| 611 | if (this.#currentChar() === "}") { |
| 612 | this.#templateBraceCount--; |
| 613 | } |
| 614 | this.#tokens.push(this.#consumeOp()); |
| 615 | } else if (this.#inTemplate() || this.#isReservedChar(this.#currentChar())) { |
| 616 | this.#tokens.push(this.#makeToken("RESERVED", this.#consumeChar())); |
| 617 | } else { |
| 618 | if (this.#position < this.#source.length) { |
| 619 | throw new Error("Unknown token: " + this.#currentChar() + " "); |
| 620 | } |
| 621 | } |
| 622 | } |
| 623 | return new Tokens(this.#tokens, this.#source); |
| 624 | } |
| 625 | }; |
| 626 |
no test coverage detected