{
js->in_fb = in;
js->in_line = 1;
+ js->in_column = 0;
js->next_char = -1;
js->next_token = NULL;
js->in_eof = 0;
js->trivial_token = json_new_node(js, JSON_INVALID);
}
-// FIXME: Report column as well as line?
static void NONRET json_parse_error(struct json_context *js, const char *msg)
{
- trans_throw("ucw.js.parse", js, "%s at line %u", msg, js->in_line);
+ trans_throw("ucw.js.parse", js, "%s at line %u:%u", msg, js->in_line, js->in_column);
}
static int json_get_char(struct json_context *js)
// FIXME: Reject alternative sequences
return c;
}
+ js->in_column++;
return c;
}
while (c == 0x20 || c == 0x09 || c == 0x0a || c == 0x0d)
{
if (c == 0x0a)
- js->in_line++;
+ {
+ js->in_line++;
+ js->in_column = 0;
+ }
c = json_get_char(js);
}
if (c < 0)