MCPcopy Create free account
hub / github.com/buger/jsonparser / UnmarshalJSONFFLexer

Method UnmarshalJSONFFLexer

benchmark/benchmark_ffjson.go:716–861  ·  view source on GitHub ↗

Benchmark harness support for STK-REQ-004.

(fs *fflib.FFLexer, state fflib.FFParseState)

Source from the content-addressed store, hash-verified

714
715// Benchmark harness support for STK-REQ-004.
716func (uj *CBName) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
717 var err error = nil
718 currentKey := ffj_t_CBNamebase
719 _ = currentKey
720 tok := fflib.FFTok_init
721 wantedTok := fflib.FFTok_init
722
723mainparse:
724 for {
725 tok = fs.Scan()
726 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
727 if tok == fflib.FFTok_error {
728 goto tokerror
729 }
730
731 switch state {
732
733 case fflib.FFParse_map_start:
734 if tok != fflib.FFTok_left_bracket {
735 wantedTok = fflib.FFTok_left_bracket
736 goto wrongtokenerror
737 }
738 state = fflib.FFParse_want_key
739 continue
740
741 case fflib.FFParse_after_value:
742 if tok == fflib.FFTok_comma {
743 state = fflib.FFParse_want_key
744 } else if tok == fflib.FFTok_right_bracket {
745 goto done
746 } else {
747 wantedTok = fflib.FFTok_comma
748 goto wrongtokenerror
749 }
750
751 case fflib.FFParse_want_key:
752 // json {} ended. goto exit. woo.
753 if tok == fflib.FFTok_right_bracket {
754 goto done
755 }
756 if tok != fflib.FFTok_string {
757 wantedTok = fflib.FFTok_string
758 goto wrongtokenerror
759 }
760
761 kn := fs.Output.Bytes()
762 if len(kn) <= 0 {
763 // "" case. hrm.
764 currentKey = ffj_t_CBNameno_such_key
765 state = fflib.FFParse_want_colon
766 goto mainparse
767 } else {
768 switch kn[0] {
769
770 case 'F':
771
772 if bytes.Equal(ffj_key_CBName_FullName, kn) {
773 currentKey = ffj_t_CBName_FullName

Callers 4

UnmarshalJSONMethod · 0.95
UnmarshalJSONFFLexerMethod · 0.45
UnmarshalJSONFFLexerMethod · 0.45
UnmarshalJSONFFLexerMethod · 0.45

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected