()
| 111 | } |
| 112 | |
| 113 | private parseValue(): ParseResult { |
| 114 | const token = this.buf1; |
| 115 | |
| 116 | if (token === null) { |
| 117 | throw new ObjectParseError("Unexpected null token"); |
| 118 | } |
| 119 | |
| 120 | switch (token.type) { |
| 121 | case "keyword": |
| 122 | return this.parseKeyword(token.value); |
| 123 | |
| 124 | case "number": |
| 125 | return this.parseNumberOrRef(token); |
| 126 | |
| 127 | case "name": |
| 128 | this.shift(); |
| 129 | return { object: PdfName.of(token.value), hasStream: false }; |
| 130 | |
| 131 | case "string": |
| 132 | this.shift(); |
| 133 | return { |
| 134 | object: new PdfString(token.value, token.format), |
| 135 | hasStream: false, |
| 136 | }; |
| 137 | |
| 138 | case "delimiter": |
| 139 | return this.parseDelimiter(token.value); |
| 140 | |
| 141 | default: |
| 142 | throw new ObjectParseError(`Unexpected token type: ${token.type}`); |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | private parseKeyword(value: string): ParseResult { |
| 147 | this.shift(); |
no test coverage detected