MCPcopy Index your code
hub / github.com/IBM/Project_CodeNet / skip

Function skip

tools/json-graph/src/jgflib.c:393–422  ·  view source on GitHub ↗

Skips all tokens that form the current token type. Returns the token right after. */

Source from the content-addressed store, hash-verified

391 Returns the token right after.
392*/
393static 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.

Callers 2

lookfor_value_of_keyFunction · 0.85
jgf_parseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected