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

Method UnmarshalJSONFFLexer

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

252
253// Benchmark harness support for STK-REQ-004.
254func (uj *CBGithub) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
255 var err error = nil
256 currentKey := ffj_t_CBGithubbase
257 _ = currentKey
258 tok := fflib.FFTok_init
259 wantedTok := fflib.FFTok_init
260
261mainparse:
262 for {
263 tok = fs.Scan()
264 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
265 if tok == fflib.FFTok_error {
266 goto tokerror
267 }
268
269 switch state {
270
271 case fflib.FFParse_map_start:
272 if tok != fflib.FFTok_left_bracket {
273 wantedTok = fflib.FFTok_left_bracket
274 goto wrongtokenerror
275 }
276 state = fflib.FFParse_want_key
277 continue
278
279 case fflib.FFParse_after_value:
280 if tok == fflib.FFTok_comma {
281 state = fflib.FFParse_want_key
282 } else if tok == fflib.FFTok_right_bracket {
283 goto done
284 } else {
285 wantedTok = fflib.FFTok_comma
286 goto wrongtokenerror
287 }
288
289 case fflib.FFParse_want_key:
290 // json {} ended. goto exit. woo.
291 if tok == fflib.FFTok_right_bracket {
292 goto done
293 }
294 if tok != fflib.FFTok_string {
295 wantedTok = fflib.FFTok_string
296 goto wrongtokenerror
297 }
298
299 kn := fs.Output.Bytes()
300 if len(kn) <= 0 {
301 // "" case. hrm.
302 currentKey = ffj_t_CBGithubno_such_key
303 state = fflib.FFParse_want_colon
304 goto mainparse
305 } else {
306 switch kn[0] {
307
308 case 'F':
309
310 if bytes.Equal(ffj_key_CBGithub_Followers, kn) {
311 currentKey = ffj_t_CBGithub_Followers

Callers 1

UnmarshalJSONMethod · 0.95

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected