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

Method UnmarshalJSONFFLexer

benchmark/benchmark_ffjson.go:957–1188  ·  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

955
956// Benchmark harness support for STK-REQ-004.
957func (uj *CBPerson) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
958 var err error = nil
959 currentKey := ffj_t_CBPersonbase
960 _ = currentKey
961 tok := fflib.FFTok_init
962 wantedTok := fflib.FFTok_init
963
964mainparse:
965 for {
966 tok = fs.Scan()
967 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
968 if tok == fflib.FFTok_error {
969 goto tokerror
970 }
971
972 switch state {
973
974 case fflib.FFParse_map_start:
975 if tok != fflib.FFTok_left_bracket {
976 wantedTok = fflib.FFTok_left_bracket
977 goto wrongtokenerror
978 }
979 state = fflib.FFParse_want_key
980 continue
981
982 case fflib.FFParse_after_value:
983 if tok == fflib.FFTok_comma {
984 state = fflib.FFParse_want_key
985 } else if tok == fflib.FFTok_right_bracket {
986 goto done
987 } else {
988 wantedTok = fflib.FFTok_comma
989 goto wrongtokenerror
990 }
991
992 case fflib.FFParse_want_key:
993 // json {} ended. goto exit. woo.
994 if tok == fflib.FFTok_right_bracket {
995 goto done
996 }
997 if tok != fflib.FFTok_string {
998 wantedTok = fflib.FFTok_string
999 goto wrongtokenerror
1000 }
1001
1002 kn := fs.Output.Bytes()
1003 if len(kn) <= 0 {
1004 // "" case. hrm.
1005 currentKey = ffj_t_CBPersonno_such_key
1006 state = fflib.FFParse_want_colon
1007 goto mainparse
1008 } else {
1009 switch kn[0] {
1010
1011 case 'G':
1012
1013 if bytes.Equal(ffj_key_CBPerson_Github, kn) {
1014 currentKey = ffj_t_CBPerson_Github

Callers 1

UnmarshalJSONMethod · 0.95

Calls 2

UnmarshalJSONFFLexerMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected