MCPcopy Create free account
hub / github.com/LibPDF-js/core / parseNextToken

Method parseNextToken

src/fontbox/cmap/parser.ts:406–438  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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) {

Callers 9

parseMethod · 0.95
parseLiteralNameMethod · 0.95
parseCodespaceRangeMethod · 0.95
parseBfCharMethod · 0.95
parseBfRangeMethod · 0.95
parseCidCharMethod · 0.95
parseCidRangeMethod · 0.95
readArrayMethod · 0.95
readHexOrDictMethod · 0.95

Calls 10

skipWhitespaceMethod · 0.95
readCommentMethod · 0.95
readStringMethod · 0.95
readEndDictOrHexMethod · 0.95
readArrayMethod · 0.95
readHexOrDictMethod · 0.95
readLiteralNameMethod · 0.95
readNumberMethod · 0.95
readOperatorMethod · 0.95
isDigitFunction · 0.70

Tested by

no test coverage detected