MCPcopy Create free account
hub / github.com/apache/cloudberry / parse_array_element

Function parse_array_element

src/common/jsonapi.c:433–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433static JsonParseErrorType
434parse_array_element(JsonLexContext *lex, JsonSemAction *sem)
435{
436 json_aelem_action astart = sem->array_element_start;
437 json_aelem_action aend = sem->array_element_end;
438 JsonTokenType tok = lex_peek(lex);
439 JsonParseErrorType result;
440
441 bool isnull;
442
443 isnull = tok == JSON_TOKEN_NULL;
444
445 if (astart != NULL)
446 (*astart) (sem->semstate, isnull);
447
448 /* an array element is any object, array or scalar */
449 switch (tok)
450 {
451 case JSON_TOKEN_OBJECT_START:
452 result = parse_object(lex, sem);
453 break;
454 case JSON_TOKEN_ARRAY_START:
455 result = parse_array(lex, sem);
456 break;
457 default:
458 result = parse_scalar(lex, sem);
459 }
460
461 if (result != JSON_SUCCESS)
462 return result;
463
464 if (aend != NULL)
465 (*aend) (sem->semstate, isnull);
466
467 return JSON_SUCCESS;
468}
469
470static JsonParseErrorType
471parse_array(JsonLexContext *lex, JsonSemAction *sem)

Callers 2

parse_arrayFunction · 0.85

Calls 4

lex_peekFunction · 0.85
parse_objectFunction · 0.85
parse_arrayFunction · 0.85
parse_scalarFunction · 0.85

Tested by

no test coverage detected