()
| 1713 | } |
| 1714 | |
| 1715 | readDirectives() { |
| 1716 | let hasDirectives = false; |
| 1717 | let version = null; |
| 1718 | |
| 1719 | let ch = this.#scanner.peek(); |
| 1720 | while (ch !== 0) { |
| 1721 | this.skipSeparationSpace(true, -1); |
| 1722 | |
| 1723 | ch = this.#scanner.peek(); |
| 1724 | |
| 1725 | if (this.lineIndent > 0 || ch !== PERCENT) { |
| 1726 | break; |
| 1727 | } |
| 1728 | |
| 1729 | hasDirectives = true; |
| 1730 | this.#scanner.next(); |
| 1731 | ch = this.#scanner.peek(); |
| 1732 | let position = this.#scanner.position; |
| 1733 | |
| 1734 | while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) { |
| 1735 | this.#scanner.next(); |
| 1736 | ch = this.#scanner.peek(); |
| 1737 | } |
| 1738 | |
| 1739 | const directiveName = this.#scanner.source.slice( |
| 1740 | position, |
| 1741 | this.#scanner.position, |
| 1742 | ); |
| 1743 | const directiveArgs = []; |
| 1744 | |
| 1745 | if (directiveName.length < 1) { |
| 1746 | throw this.#createError( |
| 1747 | "Cannot read document: directive name length must be greater than zero", |
| 1748 | ); |
| 1749 | } |
| 1750 | |
| 1751 | while (ch !== 0) { |
| 1752 | this.skipWhitespaces(); |
| 1753 | this.skipComment(); |
| 1754 | ch = this.#scanner.peek(); |
| 1755 | |
| 1756 | if (isEOL(ch)) break; |
| 1757 | |
| 1758 | position = this.#scanner.position; |
| 1759 | |
| 1760 | while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) { |
| 1761 | this.#scanner.next(); |
| 1762 | ch = this.#scanner.peek(); |
| 1763 | } |
| 1764 | |
| 1765 | directiveArgs.push( |
| 1766 | this.#scanner.source.slice(position, this.#scanner.position), |
| 1767 | ); |
| 1768 | } |
| 1769 | |
| 1770 | if (ch !== 0) this.readLineBreak(); |
| 1771 | |
| 1772 | switch (directiveName) { |
no test coverage detected