MCPcopy
hub / github.com/pquerna/ffjson / Scan

Method Scan

fflib/v1/lexer.go:390–480  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

388var null_bytes = []byte{'u', 'l', 'l'}
389
390func (ffl *FFLexer) Scan() FFTok {
391 tok := FFTok_error
392 if ffl.captureAll == false {
393 ffl.Output.Reset()
394 }
395 ffl.Token = FFTok_init
396
397 for {
398 c, err := ffl.scanReadByte()
399 if err != nil {
400 if err == io.EOF {
401 return FFTok_eof
402 } else {
403 return FFTok_error
404 }
405 }
406
407 switch c {
408 case '{':
409 tok = FFTok_left_bracket
410 if ffl.captureAll {
411 ffl.Output.WriteByte('{')
412 }
413 goto lexed
414 case '}':
415 tok = FFTok_right_bracket
416 if ffl.captureAll {
417 ffl.Output.WriteByte('}')
418 }
419 goto lexed
420 case '[':
421 tok = FFTok_left_brace
422 if ffl.captureAll {
423 ffl.Output.WriteByte('[')
424 }
425 goto lexed
426 case ']':
427 tok = FFTok_right_brace
428 if ffl.captureAll {
429 ffl.Output.WriteByte(']')
430 }
431 goto lexed
432 case ',':
433 tok = FFTok_comma
434 if ffl.captureAll {
435 ffl.Output.WriteByte(',')
436 }
437 goto lexed
438 case ':':
439 tok = FFTok_colon
440 if ffl.captureAll {
441 ffl.Output.WriteByte(':')
442 }
443 goto lexed
444 case '\t', '\n', '\v', '\f', '\r', ' ':
445 if ffl.captureAll {
446 ffl.Output.WriteByte(c)
447 }

Callers 3

scanFieldMethod · 0.95
scanAllFunction · 0.80
scanToTokCountFunction · 0.80

Calls 8

scanReadByteMethod · 0.95
wantBytesMethod · 0.95
lexStringMethod · 0.95
unreadByteMethod · 0.95
lexNumberMethod · 0.95
lexCommentMethod · 0.95
WriteByteMethod · 0.80
ResetMethod · 0.65

Tested by 2

scanAllFunction · 0.64
scanToTokCountFunction · 0.64