parse runs the parse loop -- reading next token from the stream, and decoding it based on the state machine.
()
| 76 | // parse runs the parse loop -- reading next token from the |
| 77 | // stream, and decoding it based on the state machine. |
| 78 | func (p *fastJSONParser) parse() (JSON, error) { |
| 79 | for { |
| 80 | tok, err := p.decoder.NextToken() |
| 81 | if err != nil { |
| 82 | return nil, err |
| 83 | } |
| 84 | |
| 85 | if len(tok) < 1 { |
| 86 | return nil, io.ErrUnexpectedEOF |
| 87 | } |
| 88 | |
| 89 | j, err := p.state(p, tok) |
| 90 | if err != nil { |
| 91 | return nil, err |
| 92 | } |
| 93 | if j != nil && len(p.kind) == 0 { |
| 94 | return j, nil |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | // parseTopValue processes top level JSON value. |
| 100 | func (p *fastJSONParser) parseTopValue(tok []byte) (JSON, error) { |
no test coverage detected