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

Method UnmarshalJSONFFLexer

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

59
60// Benchmark harness support for STK-REQ-004.
61func (uj *CBAvatar) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
62 var err error = nil
63 currentKey := ffj_t_CBAvatarbase
64 _ = currentKey
65 tok := fflib.FFTok_init
66 wantedTok := fflib.FFTok_init
67
68mainparse:
69 for {
70 tok = fs.Scan()
71 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
72 if tok == fflib.FFTok_error {
73 goto tokerror
74 }
75
76 switch state {
77
78 case fflib.FFParse_map_start:
79 if tok != fflib.FFTok_left_bracket {
80 wantedTok = fflib.FFTok_left_bracket
81 goto wrongtokenerror
82 }
83 state = fflib.FFParse_want_key
84 continue
85
86 case fflib.FFParse_after_value:
87 if tok == fflib.FFTok_comma {
88 state = fflib.FFParse_want_key
89 } else if tok == fflib.FFTok_right_bracket {
90 goto done
91 } else {
92 wantedTok = fflib.FFTok_comma
93 goto wrongtokenerror
94 }
95
96 case fflib.FFParse_want_key:
97 // json {} ended. goto exit. woo.
98 if tok == fflib.FFTok_right_bracket {
99 goto done
100 }
101 if tok != fflib.FFTok_string {
102 wantedTok = fflib.FFTok_string
103 goto wrongtokenerror
104 }
105
106 kn := fs.Output.Bytes()
107 if len(kn) <= 0 {
108 // "" case. hrm.
109 currentKey = ffj_t_CBAvatarno_such_key
110 state = fflib.FFParse_want_colon
111 goto mainparse
112 } else {
113 switch kn[0] {
114
115 case 'U':
116
117 if bytes.Equal(ffj_key_CBAvatar_Url, kn) {
118 currentKey = ffj_t_CBAvatar_Url

Callers 2

UnmarshalJSONMethod · 0.95
UnmarshalJSONFFLexerMethod · 0.95

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected