| 431 | } |
| 432 | |
| 433 | static JsonParseErrorType |
| 434 | parse_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 | |
| 470 | static JsonParseErrorType |
| 471 | parse_array(JsonLexContext *lex, JsonSemAction *sem) |
no test coverage detected