JSON parser grammar [correction]

David-Sarah Hopwood david-sarah at jacaranda.org
Wed Jun 3 21:00:31 PDT 2009


David-Sarah Hopwood wrote:
>   JSONStringCharacter ::
>     JSONSourceCharacter but not " or \ or LineTerminator
>     \ JSONEscapeSequence
>     [not for output] LineTerminator

In order to be consistent with the escaping done by the 'Quote'
operation, this should be:

JSONControlCharacter ::
  [U+0000 thru U+001F]
  <LS>
  <PS>

JSONStringCharacter ::
  JSONSourceCharacter but not " or \ or JSONControlCharacter
  \ JSONEscapeSequence
  [not for output] JSONControlCharacter

(or if <CR> and <LF> should be rejected, make the preceding line
  [not for output] JSONControlCharacter but not <CR> or <LF>
)

> Change step 2.c in the algorithm for abstract operation
> Quote(value) in section 15.12.3, to
> 
>   c. Else If C is a control character having a code unit value
>      less than that of <SP>, or if C is <LS> or <PS>

Simplification:
    c. Else If C is a JSONControlCharacter

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



More information about the es5-discuss mailing list