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

Method UnmarshalJSONFFLexer

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

2029
2030// Benchmark harness support for STK-REQ-004.
2031func (uj *LargePayload) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
2032 var err error = nil
2033 currentKey := ffj_t_LargePayloadbase
2034 _ = currentKey
2035 tok := fflib.FFTok_init
2036 wantedTok := fflib.FFTok_init
2037
2038mainparse:
2039 for {
2040 tok = fs.Scan()
2041 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
2042 if tok == fflib.FFTok_error {
2043 goto tokerror
2044 }
2045
2046 switch state {
2047
2048 case fflib.FFParse_map_start:
2049 if tok != fflib.FFTok_left_bracket {
2050 wantedTok = fflib.FFTok_left_bracket
2051 goto wrongtokenerror
2052 }
2053 state = fflib.FFParse_want_key
2054 continue
2055
2056 case fflib.FFParse_after_value:
2057 if tok == fflib.FFTok_comma {
2058 state = fflib.FFParse_want_key
2059 } else if tok == fflib.FFTok_right_bracket {
2060 goto done
2061 } else {
2062 wantedTok = fflib.FFTok_comma
2063 goto wrongtokenerror
2064 }
2065
2066 case fflib.FFParse_want_key:
2067 // json {} ended. goto exit. woo.
2068 if tok == fflib.FFTok_right_bracket {
2069 goto done
2070 }
2071 if tok != fflib.FFTok_string {
2072 wantedTok = fflib.FFTok_string
2073 goto wrongtokenerror
2074 }
2075
2076 kn := fs.Output.Bytes()
2077 if len(kn) <= 0 {
2078 // "" case. hrm.
2079 currentKey = ffj_t_LargePayloadno_such_key
2080 state = fflib.FFParse_want_colon
2081 goto mainparse
2082 } else {
2083 switch kn[0] {
2084
2085 case 'T':
2086
2087 if bytes.Equal(ffj_key_LargePayload_Topics, kn) {
2088 currentKey = ffj_t_LargePayload_Topics

Callers 1

UnmarshalJSONMethod · 0.95

Calls 3

UnmarshalJSONFFLexerMethod · 0.95
UnmarshalJSONFFLexerMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected