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