fix json child parsing issue
This commit is contained in:
parent
4978ec6633
commit
369223eafd
@ -5,7 +5,6 @@
|
|||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
/* Non-standard-conforming JSON parser.
|
/* Non-standard-conforming JSON parser.
|
||||||
* - Unicode not supported (TODO)
|
|
||||||
* - Unicode escape sequences in strings (\u) not supported
|
* - Unicode escape sequences in strings (\u) not supported
|
||||||
* - Leading 0s in numbers are allowed
|
* - Leading 0s in numbers are allowed
|
||||||
*/
|
*/
|
||||||
@ -787,7 +786,7 @@ INTERNAL void parse(struct arena *arena, struct parser *p)
|
|||||||
++stack_count;
|
++stack_count;
|
||||||
|
|
||||||
/* Create child & push to stack */
|
/* Create child & push to stack */
|
||||||
struct json *child = arena_push(arena, struct json);
|
struct json *child = arena_push_zero(arena, struct json);
|
||||||
child->parent = json;
|
child->parent = json;
|
||||||
*arena_push(scratch.arena, struct json *) = child;
|
*arena_push(scratch.arena, struct json *) = child;
|
||||||
++stack_count;
|
++stack_count;
|
||||||
@ -795,7 +794,7 @@ INTERNAL void parse(struct arena *arena, struct parser *p)
|
|||||||
/* Check for comma */
|
/* Check for comma */
|
||||||
if (at->type == TOKEN_TYPE_COMMA) {
|
if (at->type == TOKEN_TYPE_COMMA) {
|
||||||
/* Create sibling & push to stack */
|
/* Create sibling & push to stack */
|
||||||
struct json *sibling = arena_push(arena, struct json);
|
struct json *sibling = arena_push_zero(arena, struct json);
|
||||||
sibling->parent = parent_json;
|
sibling->parent = parent_json;
|
||||||
*arena_push(scratch.arena, struct json *) = sibling;
|
*arena_push(scratch.arena, struct json *) = sibling;
|
||||||
++stack_count;
|
++stack_count;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user