From 50f30c3dd0f2eed735d08b60a955ac33a7b8f7d3 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 5 Feb 2014 16:00:01 -0800 Subject: [PATCH] Comma and colon --- json.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/json.c b/json.c index c5b7cf6..53f714f 100644 --- a/json.c +++ b/json.c @@ -95,4 +95,22 @@ json_object *parse(FILE *f, json_object *current) { return new_object(JSON_FALSE, current); } + + if (c == ',') { + if (current->parent == NULL || + (current->parent->type != JSON_ARRAY || + current->parent->type != JSON_HASH)) { + json_error(", not in array or hash"); + } + + return parse(f, current); + } + + if (c == ':') { + if (current->parent == NULL || current->parent->type != JSON_HASH) { + json_error(": not in hash"); + } + + return parse(f, current); + } }