parseJSON bug
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Aug 8 09:31:47 PDT 2013
On Thu, Aug 08, 2013 at 11:45:19AM -0400, Nick Sabalausky wrote:
> On Thu, 08 Aug 2013 17:17:38 +0200
> "Tofu Ninja" <emmons0 at purdue.edu> wrote:
>
> > On Thursday, 8 August 2013 at 13:56:15 UTC, Dicebot wrote:
> > > On Thursday, 8 August 2013 at 13:49:22 UTC, bearophile wrote:
> > >> In my opinion we should follow the formal JSON grammar.
> > >
> > > This. Anyone who wants JavaScript behavior can use own
> > > third-party library bust standard library must behave according
> > > to published standards and specifications.
> >
> > A formal grammar can be found here starting on page 202 but I
> > don't know enough about grammars to be able to interpret it.
> > http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
> >
> > Im starting to become less sure if its a bug or not...
[...]
I find that the spec is not very clear as to what is/isn't allowed.
RFC-4627 is more unambiguous: it explicitly states that insignificant
whitespace is allowed before or after any of the six structural
characters, which are defined (in section 2) to be:
[ { ] } : ,
Section 2.4 in RFC-4627 defines the number format very clearly. There is
no mention of insignificant whitespace. This, plus the statement above
in section 2 about structural characters, makes it clear that whitespace
is NOT allowed inside a number literal.
So please file a bug against std.json.
T
--
If you compete with slaves, you become a slave. -- Norbert Wiener
More information about the Digitalmars-d
mailing list