Skip Menu |

This queue is for tickets about the JSON-DWIW CPAN distribution.

Report information
The Basics
Id: 37541
Status: resolved
Priority: 0/
Queue: JSON-DWIW

People
Owner: Nobody in particular
Requestors: robert [...] choicehotels.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.26



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
Nice catch! Thanks for debugging the code for me. This is fixed in version 0.26 (just uploaded to CPAN). Don On Tue Jul 08 16:23:02 2008, robert@choicehotels.com wrote: Show quoted text
> 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 > >