Parser core - when encountering text, process appropriately. */
| 289 | |
| 290 | /* Parser core - when encountering text, process appropriately. */ |
| 291 | static const char *parse_value(cJSON *item,const char *value) |
| 292 | { |
| 293 | if (!value) return 0; /* Fail on null. */ |
| 294 | if (!strncmp(value,"null",4)) { item->type=cJSON_NULL; return value+4; } |
| 295 | if (!strncmp(value,"false",5)) { item->type=cJSON_False; return value+5; } |
| 296 | if (!strncmp(value,"true",4)) { item->type=cJSON_True; item->valueint=1; return value+4; } |
| 297 | if (*value=='\"') { return parse_string(item,value); } |
| 298 | if (*value=='-' || (*value>='0' && *value<='9')) { return parse_number(item,value); } |
| 299 | if (*value=='[') { return parse_array(item,value); } |
| 300 | if (*value=='{') { return parse_object(item,value); } |
| 301 | |
| 302 | ep=value;return 0; /* failure. */ |
| 303 | } |
| 304 | |
| 305 | /* Render a value to text. */ |
| 306 | static char *print_value(cJSON *item,int depth,int fmt) |
no test coverage detected