Function
scanToTokCount
(ffl *FFLexer, targetTok FFTok)
Source from the content-addressed store, hash-verified
| 59 | } |
| 60 | |
| 61 | func 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 | |
| 80 | func TestBasicLexing(t *testing.T) { |
| 81 | ffl := NewFFLexer([]byte(`{}`)) |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…