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

Function scanToTokCount

fflib/v1/lexer_test.go:61–78  ·  view source on GitHub ↗
(ffl *FFLexer, targetTok FFTok)

Source from the content-addressed store, hash-verified

59}
60
61func scanToTokCount(ffl *FFLexer, targetTok FFTok) (int, error) {
62 c := 0
63 for {
64 tok := ffl.Scan()
65 c++
66
67 if tok == targetTok {
68 return c, nil
69 }
70
71 if tok == FFTok_error {
72 return c, errors.New("Hit error before target token")
73 }
74 if tok == FFTok_eof {
75 return c, errors.New("Hit EOF before target token")
76 }
77 }
78}
79
80func TestBasicLexing(t *testing.T) {
81 ffl := NewFFLexer([]byte(`{}`))

Callers 2

scanToTokFunction · 0.85
tErrorFunction · 0.85

Calls 1

ScanMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…