[json-glib] parser: Use error codes for invalid assignments



commit 77ed79385795d93776e6299b9add3940ceee4245
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Oct 25 17:21:55 2012 +0100

    parser: Use error codes for invalid assignments
    
    In case we're parsing an assignment we should use the 'invalid bareword'
    error code.

 json-glib/json-parser.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/json-glib/json-parser.c b/json-glib/json-parser.c
index 4cd5718..d79d21c 100644
--- a/json-glib/json-parser.c
+++ b/json-glib/json-parser.c
@@ -576,7 +576,7 @@ json_parse_object (JsonParser   *parser,
         {
           JSON_NOTE (PARSER, "Missing object member name");
 
-          priv->error_code = JSON_PARSER_ERROR_PARSE;
+          priv->error_code = JSON_PARSER_ERROR_INVALID_BAREWORD;
 
           json_object_unref (object);
           json_node_free (priv->current_node);
@@ -748,6 +748,7 @@ json_parse_statement (JsonParser  *parser,
         next_token = json_scanner_get_next_token (scanner);
         if (next_token != '=')
           {
+            priv->error_code = JSON_PARSER_ERROR_INVALID_BAREWORD;
             g_free (name);
             return '=';
           }
@@ -776,6 +777,7 @@ json_parse_statement (JsonParser  *parser,
     case G_TOKEN_INT:
     case G_TOKEN_FLOAT:
     case G_TOKEN_STRING:
+    case G_TOKEN_IDENTIFIER:
       JSON_NOTE (PARSER, "Statement is a value");
       token = json_scanner_get_next_token (scanner);
       return json_parse_value (parser, scanner, token, &priv->root);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]