Benchmark harness support for STK-REQ-004.
(fs *fflib.FFLexer, state fflib.FFParseState)
| 1240 | |
| 1241 | // Benchmark harness support for STK-REQ-004. |
| 1242 | func (uj *DSTopic) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 1243 | var err error = nil |
| 1244 | currentKey := ffj_t_DSTopicbase |
| 1245 | _ = currentKey |
| 1246 | tok := fflib.FFTok_init |
| 1247 | wantedTok := fflib.FFTok_init |
| 1248 | |
| 1249 | mainparse: |
| 1250 | for { |
| 1251 | tok = fs.Scan() |
| 1252 | // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 1253 | if tok == fflib.FFTok_error { |
| 1254 | goto tokerror |
| 1255 | } |
| 1256 | |
| 1257 | switch state { |
| 1258 | |
| 1259 | case fflib.FFParse_map_start: |
| 1260 | if tok != fflib.FFTok_left_bracket { |
| 1261 | wantedTok = fflib.FFTok_left_bracket |
| 1262 | goto wrongtokenerror |
| 1263 | } |
| 1264 | state = fflib.FFParse_want_key |
| 1265 | continue |
| 1266 | |
| 1267 | case fflib.FFParse_after_value: |
| 1268 | if tok == fflib.FFTok_comma { |
| 1269 | state = fflib.FFParse_want_key |
| 1270 | } else if tok == fflib.FFTok_right_bracket { |
| 1271 | goto done |
| 1272 | } else { |
| 1273 | wantedTok = fflib.FFTok_comma |
| 1274 | goto wrongtokenerror |
| 1275 | } |
| 1276 | |
| 1277 | case fflib.FFParse_want_key: |
| 1278 | // json {} ended. goto exit. woo. |
| 1279 | if tok == fflib.FFTok_right_bracket { |
| 1280 | goto done |
| 1281 | } |
| 1282 | if tok != fflib.FFTok_string { |
| 1283 | wantedTok = fflib.FFTok_string |
| 1284 | goto wrongtokenerror |
| 1285 | } |
| 1286 | |
| 1287 | kn := fs.Output.Bytes() |
| 1288 | if len(kn) <= 0 { |
| 1289 | // "" case. hrm. |
| 1290 | currentKey = ffj_t_DSTopicno_such_key |
| 1291 | state = fflib.FFParse_want_colon |
| 1292 | goto mainparse |
| 1293 | } else { |
| 1294 | switch kn[0] { |
| 1295 | |
| 1296 | case 'I': |
| 1297 | |
| 1298 | if bytes.Equal(ffj_key_DSTopic_Id, kn) { |
| 1299 | currentKey = ffj_t_DSTopic_Id |
no test coverage detected