From 8a6e1b377726cca5f60ce249b1a5bfcb6616bdab Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 20 Jan 2010 15:05:19 +0100 Subject: [PATCH] Fix JSON parser WRT start symbol The start grammar symbol (referred to as JSONText in ECMA-262) is JSONValue, not JSONObject. --- src/json.c | 2 +- test/tst_json.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/json.c b/src/json.c index 4c41613..6c34fcb 100644 --- a/src/json.c +++ b/src/json.c @@ -420,7 +420,7 @@ struct json_node *json_parser_parse(json_parser_t p, const char *json_str) p->buf = json_str; p->cp = p->buf; - n = json_parse_object(p); + n = json_parse_value(p); if (!n) return 0; c = look_ch(p); diff --git a/test/tst_json.c b/test/tst_json.c index 8720290..eace27e 100644 --- a/test/tst_json.c +++ b/test/tst_json.c @@ -49,9 +49,9 @@ static void tst1(void) YAZ_CHECK(expect(p, "", 0)); - YAZ_CHECK(expect(p, "1234", 0)); + YAZ_CHECK(expect(p, "1234", "1234")); - YAZ_CHECK(expect(p, "[ 1234 ]", 0)); + YAZ_CHECK(expect(p, "[ 1234 ]", "[1234]")); YAZ_CHECK(expect(p, "{\"k\":tru}", 0)); -- 1.7.10.4