[json-glib] parser: Add MISSING_COLON error
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [json-glib] parser: Add MISSING_COLON error
- Date: Fri, 19 Mar 2010 16:09:33 +0000 (UTC)
commit 24567790d30e314ee519c8f3756b3514c0c3fd31
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Fri Mar 19 15:45:24 2010 +0000
parser: Add MISSING_COLON error
We identify a missing ':' separator between an object member name and
its value, so it would be a good thing to actually have an error code
for that.
json-glib/json-parser.c | 3 +--
json-glib/json-parser.h | 2 ++
json-glib/tests/parser-test.c | 3 ++-
3 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/json-glib/json-parser.c b/json-glib/json-parser.c
index 3e00cb6..c16d874 100644
--- a/json-glib/json-parser.c
+++ b/json-glib/json-parser.c
@@ -597,8 +597,7 @@ json_parse_object (JsonParser *parser,
{
JSON_NOTE (PARSER, "Missing object member name separator");
- /* FIXME - MISSING_COLON */
- priv->error_code = JSON_PARSER_ERROR_PARSE;
+ priv->error_code = JSON_PARSER_ERROR_MISSING_COLON;
g_free (name);
json_object_unref (object);
diff --git a/json-glib/json-parser.h b/json-glib/json-parser.h
index 11bfb89..77dfd77 100644
--- a/json-glib/json-parser.h
+++ b/json-glib/json-parser.h
@@ -51,6 +51,7 @@ typedef struct _JsonParserClass JsonParserClass;
* @JSON_PARSER_ERROR_PARSE: parse error
* @JSON_PARSER_ERROR_TRAILING_COMMA: unexpected trailing comma
* @JSON_PARSER_ERROR_MISSING_COMMA: expected comma
+ * @JSON_PARSER_ERROR_MISSING_COLOR: expected colon
* @JSON_PARSER_ERROR_INVALID_BAREWORD: invalid bareword
* @JSON_PARSER_ERROR_UNKNOWN: unknown error
*
@@ -62,6 +63,7 @@ typedef enum {
JSON_PARSER_ERROR_PARSE,
JSON_PARSER_ERROR_TRAILING_COMMA,
JSON_PARSER_ERROR_MISSING_COMMA,
+ JSON_PARSER_ERROR_MISSING_COLON,
JSON_PARSER_ERROR_INVALID_BAREWORD,
JSON_PARSER_ERROR_UNKNOWN
diff --git a/json-glib/tests/parser-test.c b/json-glib/tests/parser-test.c
index 8fb11b1..5e5fa48 100644
--- a/json-glib/tests/parser-test.c
+++ b/json-glib/tests/parser-test.c
@@ -139,7 +139,8 @@ static const struct
{ "{ \"foo\" : true \"bar\" : false }", JSON_PARSER_ERROR_MISSING_COMMA },
{ "[ true, [ false, ] ]", JSON_PARSER_ERROR_TRAILING_COMMA },
{ "{ \"foo\" : { \"bar\" : false, } }", JSON_PARSER_ERROR_TRAILING_COMMA },
- { "[ { }, { }, { }, ]", JSON_PARSER_ERROR_TRAILING_COMMA }
+ { "[ { }, { }, { }, ]", JSON_PARSER_ERROR_TRAILING_COMMA },
+ { "{ \"foo\" false }", JSON_PARSER_ERROR_MISSING_COLON }
};
static guint n_test_base_values = G_N_ELEMENTS (test_base_values);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]