()
| 237 | } |
| 238 | |
| 239 | private parseArray(): ParseResult { |
| 240 | this.shift(); // consume '[' |
| 241 | |
| 242 | const items: PdfObject[] = []; |
| 243 | |
| 244 | while (true) { |
| 245 | this.ensureBufferFilled(); |
| 246 | |
| 247 | if (this.buf1 === null || this.buf1.type === "eof") { |
| 248 | if (this.recoveryMode) { |
| 249 | this.warn("Unterminated array at EOF"); |
| 250 | break; |
| 251 | } |
| 252 | |
| 253 | throw new ObjectParseError("Unterminated array at EOF"); |
| 254 | } |
| 255 | |
| 256 | if (this.buf1.type === "delimiter" && this.buf1.value === "]") { |
| 257 | this.shift(); // consume ']' |
| 258 | break; |
| 259 | } |
| 260 | |
| 261 | const result = this.parseObject(); |
| 262 | |
| 263 | if (result === null) { |
| 264 | if (this.recoveryMode) { |
| 265 | this.warn("Unexpected null in array"); |
| 266 | break; |
| 267 | } |
| 268 | |
| 269 | throw new ObjectParseError("Unexpected null in array"); |
| 270 | } |
| 271 | |
| 272 | items.push(result.object); |
| 273 | } |
| 274 | |
| 275 | return { object: PdfArray.of(...items), hasStream: false }; |
| 276 | } |
| 277 | |
| 278 | private parseDict(): ParseResult { |
| 279 | this.shift(); // consume '<<' |
no test coverage detected