We have an object and are looking for a specific key, ignoring all others. If the key is not found, the object itself is considered the value. Returns the first token of the value. */
| 426 | Returns the first token of the value. |
| 427 | */ |
| 428 | static jsmntok_t *lookfor_value_of_key(jsmntok_t *tok, const char *s) |
| 429 | { |
| 430 | assert(tok->type == JSMN_OBJECT); |
| 431 | jsmntok_t *save_tok = tok; |
| 432 | int keys = tok->size; /* this many keys */ |
| 433 | tok++; |
| 434 | while (keys--) { |
| 435 | /*key*/ |
| 436 | if (string_eq(tok, s)) |
| 437 | return ++tok; |
| 438 | /*value*/ |
| 439 | tok = skip(tok+1); |
| 440 | } |
| 441 | return save_tok; |
| 442 | } |
| 443 | |
| 444 | Graph jgf_parse(void) |
| 445 | { |