MCPcopy Create free account
hub / github.com/beefytech/Beef / parse_value

Function parse_value

BeefySysLib/util/Json.cpp:296–310  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

294
295/* Parser core - when encountering text, process appropriately. */
296static 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. */
313static char *print_value(Json* item,int depth,int fmt)

Callers 3

ParseWithOptsMethod · 0.85
parse_arrayFunction · 0.85
parse_objectFunction · 0.85

Calls 4

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

Tested by

no test coverage detected