MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxJSONObject

Function fxJSONObject

xs/sources/xsSyntaxical.c:4300–4331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4298}
4299
4300void fxJSONObject(txParser* parser)
4301{
4302 txIndex aLength = 0;
4303 txInteger aLine = parser->states[0].line;
4304 fxGetNextTokenJSON(parser);
4305 for (;;) {
4306 if (parser->states[0].token == XS_TOKEN_RIGHT_BRACE)
4307 break;
4308 if (parser->states[0].token != XS_TOKEN_STRING) {
4309 fxReportParserError(parser, parser->states[0].line, "missing name");
4310 break;
4311 }
4312 fxPushStringNode(parser, parser->states[0].stringLength, parser->states[0].string, parser->states[0].line);
4313 fxGetNextTokenJSON(parser);
4314 if (parser->states[0].token != XS_TOKEN_COLON) {
4315 fxReportParserError(parser, parser->states[0].line, "missing :");
4316 break;
4317 }
4318 fxGetNextTokenJSON(parser);
4319 fxJSONValue(parser);
4320 fxPushNodeStruct(parser, 2, XS_TOKEN_PROPERTY_AT, parser->states[0].line);
4321 aLength++;
4322 if (parser->states[0].token != XS_TOKEN_COMMA)
4323 break;
4324 fxGetNextTokenJSON(parser);
4325 }
4326 if (parser->states[0].token != XS_TOKEN_RIGHT_BRACE)
4327 fxReportParserError(parser, parser->states[0].line, "missing }");
4328 fxGetNextTokenJSON(parser);
4329 fxPushNodeList(parser, aLength);
4330 fxPushNodeStruct(parser, 1, XS_TOKEN_OBJECT, aLine);
4331}
4332
4333void fxJSONArray(txParser* parser)
4334{

Callers 1

fxJSONValueFunction · 0.85

Calls 6

fxGetNextTokenJSONFunction · 0.85
fxReportParserErrorFunction · 0.85
fxPushStringNodeFunction · 0.85
fxJSONValueFunction · 0.85
fxPushNodeStructFunction · 0.85
fxPushNodeListFunction · 0.85

Tested by

no test coverage detected