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

Method UnmarshalJSONFFLexer

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

1794
1795// Benchmark harness support for STK-REQ-004.
1796func (uj *DSUser) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
1797 var err error = nil
1798 currentKey := ffj_t_DSUserbase
1799 _ = currentKey
1800 tok := fflib.FFTok_init
1801 wantedTok := fflib.FFTok_init
1802
1803mainparse:
1804 for {
1805 tok = fs.Scan()
1806 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
1807 if tok == fflib.FFTok_error {
1808 goto tokerror
1809 }
1810
1811 switch state {
1812
1813 case fflib.FFParse_map_start:
1814 if tok != fflib.FFTok_left_bracket {
1815 wantedTok = fflib.FFTok_left_bracket
1816 goto wrongtokenerror
1817 }
1818 state = fflib.FFParse_want_key
1819 continue
1820
1821 case fflib.FFParse_after_value:
1822 if tok == fflib.FFTok_comma {
1823 state = fflib.FFParse_want_key
1824 } else if tok == fflib.FFTok_right_bracket {
1825 goto done
1826 } else {
1827 wantedTok = fflib.FFTok_comma
1828 goto wrongtokenerror
1829 }
1830
1831 case fflib.FFParse_want_key:
1832 // json {} ended. goto exit. woo.
1833 if tok == fflib.FFTok_right_bracket {
1834 goto done
1835 }
1836 if tok != fflib.FFTok_string {
1837 wantedTok = fflib.FFTok_string
1838 goto wrongtokenerror
1839 }
1840
1841 kn := fs.Output.Bytes()
1842 if len(kn) <= 0 {
1843 // "" case. hrm.
1844 currentKey = ffj_t_DSUserno_such_key
1845 state = fflib.FFParse_want_colon
1846 goto mainparse
1847 } else {
1848 switch kn[0] {
1849
1850 case 'U':
1851
1852 if bytes.Equal(ffj_key_DSUser_Username, kn) {
1853 currentKey = ffj_t_DSUser_Username

Callers 2

UnmarshalJSONMethod · 0.95
UnmarshalJSONFFLexerMethod · 0.95

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected