Skips all tokens that form the current token type. Returns the token right after. */
| 391 | Returns the token right after. |
| 392 | */ |
| 393 | static jsmntok_t *skip(jsmntok_t *tok) |
| 394 | { |
| 395 | switch (tok->type) { |
| 396 | case JSMN_OBJECT: { |
| 397 | int keys = tok->size; /* this many keys */ |
| 398 | tok++; |
| 399 | while (keys--) { |
| 400 | /*key:value*/ |
| 401 | tok = skip(tok+1); |
| 402 | } |
| 403 | return tok; |
| 404 | } |
| 405 | case JSMN_ARRAY: { |
| 406 | int elems = tok->size; /** this many elements */ |
| 407 | tok++; |
| 408 | while (elems--) { |
| 409 | /*value*/ |
| 410 | tok = skip(tok); |
| 411 | } |
| 412 | return tok; |
| 413 | } |
| 414 | case JSMN_STRING: |
| 415 | /* Must be literal value, not a key! */ |
| 416 | assert(!tok->size); |
| 417 | /*FALL_THROUGH*/ |
| 418 | case JSMN_PRIMITIVE: /* number, false, true, null */ |
| 419 | return tok+1; |
| 420 | } |
| 421 | assert(!"(F) Never here!"); |
| 422 | } |
| 423 | |
| 424 | /** We have an object and are looking for a specific key, ignoring all others. |
| 425 | If the key is not found, the object itself is considered the value. |
no outgoing calls
no test coverage detected