Parser core - when encountering text, process appropriately. */
| 294 | |
| 295 | /* Parser core - when encountering text, process appropriately. */ |
| 296 | static const char *parse_value(Json* item,const char *value) |
| 297 | { |
| 298 | //item->mSrcStart = value; |
| 299 | |
| 300 | if (!value) return 0; /* Fail on null. */ |
| 301 | if (!strncmp(value,"null",4)) { item->mType=Json::Type_NULL; return value+4; } |
| 302 | if (!strncmp(value,"false",5)) { item->mType=Json::Type_False; return value+5; } |
| 303 | if (!strncmp(value,"true",4)) { item->mType=Json::Type_True; item->mValueInt=1; return value+4; } |
| 304 | if (*value=='\"') { return parse_string(item,value); } |
| 305 | if (*value=='-' || (*value>='0' && *value<='9')) { return parse_number(item,value); } |
| 306 | if (*value=='[') { return parse_array(item,value); } |
| 307 | if (*value=='{') { return parse_object(item,value); } |
| 308 | |
| 309 | ep=value;return 0; /* failure. */ |
| 310 | } |
| 311 | |
| 312 | /* Render a value to text. */ |
| 313 | static char *print_value(Json* item,int depth,int fmt) |
no test coverage detected