]> mj.ucw.cz Git - libucw.git/blobdiff - ucw-json/parse.c
Released as 6.5.16.
[libucw.git] / ucw-json / parse.c
index 765352b0acbb2ffae41551dc6d9c66431f955ca2..df99ea405196efad68538da24d28ad15073170cc 100644 (file)
@@ -25,13 +25,11 @@ void json_set_input(struct json_context *js, struct fastbuf *in)
   js->next_char = -1;
   js->next_token = NULL;
   js->in_eof = 0;
-  if (!js->trivial_token)
-    js->trivial_token = json_new_node(js, JSON_INVALID);
 }
 
 static void NONRET json_parse_error(struct json_context *js, const char *msg)
 {
-  trans_throw("ucw.js.parse", js, "%s at line %u:%u", msg, js->in_line, js->in_column);
+  trans_throw("ucw.json.parse", js, "%s at line %u:%u", msg, js->in_line, js->in_column);
 }
 
 static int json_get_char(struct json_context *js)
@@ -42,7 +40,6 @@ static int json_get_char(struct json_context *js)
       if (c == -2)
        json_parse_error(js, "Malformed UTF-8 character");
       js->in_eof = 1;
-      // FIXME: Reject alternative sequences
       return c;
     }
   js->in_column++;
@@ -386,7 +383,7 @@ struct json_node *json_next_value(struct json_context *js)
            if (t->type == JSON_END_ARRAY)
              break;
            if (t->type != JSON_VALUE_SEP)
-             json_parse_error(js, "Comma expected");
+             json_parse_error(js, "Comma or right bracket expected");
          }
        return a;
       }