MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / parse_value

Function parse_value

eval/LANE_evaluation/lane2d/src/cJSON.c:461–500  ·  view source on GitHub ↗

Parser core - when encountering text, process appropriately. */

Source from the content-addressed store, hash-verified

459
460/* Parser core - when encountering text, process appropriately. */
461static const char *parse_value(cJSON *item, const char *value, const char **ep)
462{
463 if (!value)
464 return 0; /* Fail on null. */
465 if (!strncmp(value, "null", 4))
466 {
467 item->type = cJSON_NULL;
468 return value + 4;
469 }
470 if (!strncmp(value, "false", 5))
471 {
472 item->type = cJSON_False;
473 return value + 5;
474 }
475 if (!strncmp(value, "true", 4))
476 {
477 item->type = cJSON_True;
478 item->valueint = 1;
479 return value + 4;
480 }
481 if (*value == '\"')
482 {
483 return parse_string(item, value, ep);
484 }
485 if (*value == '-' || (*value >= '0' && *value <= '9'))
486 {
487 return parse_number(item, value);
488 }
489 if (*value == '[')
490 {
491 return parse_array(item, value, ep);
492 }
493 if (*value == '{')
494 {
495 return parse_object(item, value, ep);
496 }
497
498 *ep = value;
499 return 0; /* failure. */
500}
501
502/* Render a value to text. */
503static char *print_value(cJSON *item, int depth, int fmt)

Callers 3

cJSON_ParseFunction · 0.85
parse_arrayFunction · 0.85
parse_objectFunction · 0.85

Calls 4

parse_stringFunction · 0.85
parse_numberFunction · 0.85
parse_arrayFunction · 0.85
parse_objectFunction · 0.85

Tested by

no test coverage detected