Comma and colon

This commit is contained in:
Eric Fischer 2014-02-05 16:00:01 -08:00
parent f895b8f6b7
commit 50f30c3dd0

18
json.c
View File

@ -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);
}
}