Validation for empty objects

Now (correctly) fails to parse {,}
This commit is contained in:
Stephen Dolan committed 2012-09-02 00:24:23 +01:00
1 parent e98624e5a9
commit 22f8aed31e
3 files changed
+19 -1

No files matched your search

+2 -1
View File
@@ -100,7 +100,8 @@ pfunc token(char ch) {
} else {
if (jv_get_kind(stack[stackpos-1]) != JV_KIND_OBJECT)
return "Unmatched '}'";
// FIXME: assert object empty
if (jv_object_length(jv_copy(stack[stackpos-1])) != 0)
return "Expected another key-value pair";
}
hasnext = 1;
next = stack[--stackpos];