MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / parsePrimitives

Method parsePrimitives

include/sonic/dom/parser.h:484–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

482
483 template <typename SAX>
484 void parsePrimitives(SAX &sax) {
485 switch (json_buf_[pos_ - 1]) {
486 case '0':
487 case '1':
488 case '2':
489 case '3':
490 case '4':
491 case '5':
492 case '6':
493 case '7':
494 case '8':
495 case '9':
496 case '-':
497 parseNumber(sax);
498 break;
499 case '"':
500 parseStrInPlace(sax);
501 // only need check length when parsing string primitives, because the
502 // padding "x\"x" makes parsing other invalid JSON always failed
503 if (pos_ > len_) {
504 setParseError(kParseErrorInvalidChar);
505 }
506 break;
507 case 'f':
508 parseFalse(sax);
509 break;
510 case 't':
511 parseTrue(sax);
512 break;
513 case 'n':
514 parseNull(sax);
515 break;
516 default:
517 setParseError(kParseErrorInvalidChar);
518 }
519 }
520
521 template <typename T, typename = int>
522 struct CheckKeyReturn : std::false_type {};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected