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

Method UnmarshalJSONFFLexer

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

2336
2337// Benchmark harness support for STK-REQ-004.
2338func (uj *MediumPayload) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
2339 var err error = nil
2340 currentKey := ffj_t_MediumPayloadbase
2341 _ = currentKey
2342 tok := fflib.FFTok_init
2343 wantedTok := fflib.FFTok_init
2344
2345mainparse:
2346 for {
2347 tok = fs.Scan()
2348 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
2349 if tok == fflib.FFTok_error {
2350 goto tokerror
2351 }
2352
2353 switch state {
2354
2355 case fflib.FFParse_map_start:
2356 if tok != fflib.FFTok_left_bracket {
2357 wantedTok = fflib.FFTok_left_bracket
2358 goto wrongtokenerror
2359 }
2360 state = fflib.FFParse_want_key
2361 continue
2362
2363 case fflib.FFParse_after_value:
2364 if tok == fflib.FFTok_comma {
2365 state = fflib.FFParse_want_key
2366 } else if tok == fflib.FFTok_right_bracket {
2367 goto done
2368 } else {
2369 wantedTok = fflib.FFTok_comma
2370 goto wrongtokenerror
2371 }
2372
2373 case fflib.FFParse_want_key:
2374 // json {} ended. goto exit. woo.
2375 if tok == fflib.FFTok_right_bracket {
2376 goto done
2377 }
2378 if tok != fflib.FFTok_string {
2379 wantedTok = fflib.FFTok_string
2380 goto wrongtokenerror
2381 }
2382
2383 kn := fs.Output.Bytes()
2384 if len(kn) <= 0 {
2385 // "" case. hrm.
2386 currentKey = ffj_t_MediumPayloadno_such_key
2387 state = fflib.FFParse_want_colon
2388 goto mainparse
2389 } else {
2390 switch kn[0] {
2391
2392 case 'C':
2393
2394 if bytes.Equal(ffj_key_MediumPayload_Company, kn) {
2395 currentKey = ffj_t_MediumPayload_Company

Callers 1

UnmarshalJSONMethod · 0.95

Calls 2

UnmarshalJSONFFLexerMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected