p->curr_buf = 0;
p->curr_buf_length = p->curr_buf_pos = p->curr_buf_is_partial = 0;
p->bom_strip_position = 0;
+ p->line = 1;
+ p->column = 0;
jvp_dtoa_context_init(&p->dtoa);
}
}
static pfunc scan(struct jv_parser* p, char ch, jv* out) {
+ p->column++;
+ if (ch == '\n') {
+ p->line++;
+ p->column = 0;
+ }
presult answer = 0;
if (p->st == JV_PARSER_NORMAL) {
chclass cls = classify(ch);
if (msg == OK) {
return value;
} else if (msg) {
- return jv_invalid_with_msg(jv_string(msg));
+ return jv_invalid_with_msg(jv_string_fmt("%s at line %d, column %d", msg, p->line, p->column));
} else if (p->curr_buf_is_partial) {
assert(p->curr_buf_pos == p->curr_buf_length);
// need another buffer