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

Method UnmarshalJSONFFLexer

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

2694
2695// Benchmark harness support for STK-REQ-004.
2696func (uj *SmallPayload) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
2697 var err error = nil
2698 currentKey := ffj_t_SmallPayloadbase
2699 _ = currentKey
2700 tok := fflib.FFTok_init
2701 wantedTok := fflib.FFTok_init
2702
2703mainparse:
2704 for {
2705 tok = fs.Scan()
2706 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
2707 if tok == fflib.FFTok_error {
2708 goto tokerror
2709 }
2710
2711 switch state {
2712
2713 case fflib.FFParse_map_start:
2714 if tok != fflib.FFTok_left_bracket {
2715 wantedTok = fflib.FFTok_left_bracket
2716 goto wrongtokenerror
2717 }
2718 state = fflib.FFParse_want_key
2719 continue
2720
2721 case fflib.FFParse_after_value:
2722 if tok == fflib.FFTok_comma {
2723 state = fflib.FFParse_want_key
2724 } else if tok == fflib.FFTok_right_bracket {
2725 goto done
2726 } else {
2727 wantedTok = fflib.FFTok_comma
2728 goto wrongtokenerror
2729 }
2730
2731 case fflib.FFParse_want_key:
2732 // json {} ended. goto exit. woo.
2733 if tok == fflib.FFTok_right_bracket {
2734 goto done
2735 }
2736 if tok != fflib.FFTok_string {
2737 wantedTok = fflib.FFTok_string
2738 goto wrongtokenerror
2739 }
2740
2741 kn := fs.Output.Bytes()
2742 if len(kn) <= 0 {
2743 // "" case. hrm.
2744 currentKey = ffj_t_SmallPayloadno_such_key
2745 state = fflib.FFParse_want_colon
2746 goto mainparse
2747 } else {
2748 switch kn[0] {
2749
2750 case 'G':
2751
2752 if bytes.Equal(ffj_key_SmallPayload_Gr, kn) {
2753 currentKey = ffj_t_SmallPayload_Gr

Callers 1

UnmarshalJSONMethod · 0.95

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected