MCPcopy Create free account
hub / github.com/Tracktion/choc / parseValue

Method parseValue

choc/text/choc_JSON.h:385–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383 }
384
385 value::Value parseValue()
386 {
387 skipWhitespace();
388 auto startPos = current;
389
390 switch (pop())
391 {
392 case '[': return parseArray();
393 case '{': return parseObject();
394 case '"': return value::createString (parseString());
395 case '-': skipWhitespace(); return parseNumber (true);
396 case 'n': if (popIf ("ull")) return {}; break;
397 case 't': if (popIf ("rue")) return value::createBool (true); break;
398 case 'f': if (popIf ("alse")) return value::createBool (false); break;
399
400 case '0': case '1': case '2': case '3': case '4':
401 case '5': case '6': case '7': case '8': case '9':
402 current = startPos;
403 return parseNumber (false);
404
405 default: break;
406 }
407
408 throwError ("Syntax error", startPos);
409 }
410
411 value::Value parseNumber (bool negate)
412 {

Callers 1

parseFunction · 0.80

Calls 3

createBoolFunction · 0.85
throwErrorFunction · 0.85
createStringFunction · 0.50

Tested by

no test coverage detected