Subject: | Number Parsing Bug |
Date: | Tue, 08 Jul 2008 10:44:27 -0700 |
To: | bug-JSON-DWIW [...] rt.cpan.org |
From: | Robert Peters <robert [...] choicehotels.com> |
When parsing a number like -1.555555 a "not a digit error" is reported
for the decimal point.
The code in question is from json_parse_number() in "old_parse.c" to wit:
looking_at = JsNextChar(ctx);
if (looking_at == '-') {
/*JsNextChar(ctx);*/
looking_at = JsNextChar(ctx);
flags |= kParseNumberHaveSign;
}
if (looking_at < '0' || looking_at > '9') {
JSON_DEBUG("syntax error at byte %d", ctx->pos);
ctx->error = JSON_PARSE_ERROR(ctx, "syntax error (not a digit)");
return (SV *)&PL_sv_undef;
}
The commented out call to JsNextChar() is my doing and appears to fix
the problem.
Thanks for your module, it has been a big help.
Regards,
Robert Peters