stackReturn returns json object to the top of the stack and transitions state machine to the next state.
(j JSON)
| 266 | // stackReturn returns json object to the top of the stack |
| 267 | // and transitions state machine to the next state. |
| 268 | func (p *fastJSONParser) stackReturn(j JSON) (JSON, error) { |
| 269 | // If stack is now empty, we're done -- return JSON. |
| 270 | if len(p.kind) == 0 { |
| 271 | return j, nil |
| 272 | } |
| 273 | |
| 274 | // Add json to array or object; arrange for next state transition. |
| 275 | if p.kind[len(p.kind)-1] == kindArray { |
| 276 | p.addArrayValue(j) |
| 277 | p.state = (*fastJSONParser).parseArrayValue |
| 278 | } else { |
| 279 | p.setObjectValue(j) |
| 280 | p.state = (*fastJSONParser).parseObjectKey |
| 281 | } |
| 282 | return nil, nil |
| 283 | } |
| 284 | |
| 285 | var errInvalidInputToken = errors.New("invalid JSON token") |
| 286 |
no test coverage detected