decimals without integer part in JSON source text (was: Re: JSON parser grammar)

Hallvord R. M. Steen hallvord at opera.com
Tue Aug 25 09:32:36 PDT 2009


On Sat, 04 Jul 2009 13:49:01 +0200, Hallvord R. M. Steen
<hallvord at opera.com> wrote:

> Another question: The JSON grammar says
> JSONNumber ::
> -opt  DecimalIntegerLiteral JSONFraction opt  ExponentPart opt
> JSONFraction ::
> . DecimalDigits
> This apparently makes numbers like "1." illegal?

I suggest that the spec is changed. In 15.12.1.1 under "Syntax", add
"JSONFraction" on a new line after

JSONNumber ::
	-opt  DecimalIntegerLiteral JSONFractionopt  ExponentPartopt

in other words, define JSONNumber as follows:


JSONNumber ::
	-opt  DecimalIntegerLiteral JSONFractionopt  ExponentPartopt
	JSONFraction

I suggest this change because the browser implementations seem to align on
allowing this.

-- 
Hallvord R. M. Steen, Core Tester, Opera Software
http://www.opera.com http://my.opera.com/hallvors/


More information about the es-discuss mailing list