()
| 404 | // ========================================================================= |
| 405 | |
| 406 | private parseNextToken(): Token { |
| 407 | this.skipWhitespace(); |
| 408 | |
| 409 | if (this.position >= this.data.length) { |
| 410 | return null; |
| 411 | } |
| 412 | |
| 413 | const byte = this.data[this.position]; |
| 414 | |
| 415 | switch (byte) { |
| 416 | case 0x25: // % |
| 417 | return this.readComment(); |
| 418 | case 0x28: // ( |
| 419 | return this.readString(); |
| 420 | case 0x3e: // > |
| 421 | return this.readEndDictOrHex(); |
| 422 | case 0x5d: // ] |
| 423 | this.position++; |
| 424 | return { type: "operator", op: "]" }; |
| 425 | case 0x5b: // [ |
| 426 | return this.readArray(); |
| 427 | case 0x3c: // < |
| 428 | return this.readHexOrDict(); |
| 429 | case 0x2f: // / |
| 430 | return this.readLiteralName(); |
| 431 | default: |
| 432 | if (isDigit(byte)) { |
| 433 | return this.readNumber(); |
| 434 | } |
| 435 | |
| 436 | return this.readOperator(); |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | private skipWhitespace(): void { |
| 441 | while (this.position < this.data.length) { |
no test coverage detected