[antlr-interest] more JSON spec questions

David-Sarah Hopwood david-sarah at jacaranda.org
Thu Aug 27 11:37:20 PDT 2009


Hallvord R. M. Steen wrote:
> Hi,
> the feedback below refers to the "Initial ECMA formated ES5 draft" and
> consists of a few things I've noticed while working on a JSON test suite.
> 
> First, I think considerable work has gone into the JSON part of the spec
> since I first looked at it - it's beginning to look really good. My test
> suite is a work in progress, and of course both the tests and my
> questions might just show that there's something I haven't entirely
> understood rather than problems with the specification. Feedback is
> welcome.
> 
> Now, the questions..
> 
> 1) Apparently the grammar still disallows literal tab inside JSONString.
> Implementations that pass this test allow it:
> http://testsuites.opera.com/JSON/correctness/035.html
> - from earlier discussions I had the impression that the spec would
> change..?

The JSON spec (which isn't changing) says:

   The representation of strings is similar to conventions used in the C
   family of programming languages.  A string begins and ends with
   quotation marks.  All Unicode characters may be placed within the
   quotation marks except for the characters that must be escaped:
   quotation mark, reverse solidus, and the control characters (U+0000
   through U+001F).
   [...]

   unescaped = %x20-21 / %x23-5B / %x5D-10FFFF

Literal tab is in "U+0000 through U+001F" and therefore must be escaped,
as confirmed by the ABNF.

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com



More information about the antlr-interest mailing list