pegjs/examples
David Majda f07ab7f32e examples/json.pegjs: Fix the "unescaped" rule
The "unescaped" rule was created by mechanically translating original
RFC 7159 rule:

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

into:

  unescaped = [\x20-\x21\x23-\x5B\x5D-\u10FFFF]

However, this mechanical translation was incorrect as PEG.js grammars
don't have 6-digit Unicode escape sequences. Sequence "\u10FFFF" was
interpreted as "\u10FF" followed by two "F" characters.

This commit rewrites the "unescaped" rule into a form which, while not
being a mechanical translation of the original rule, matches the same
characters in the whole Unicode range. It also macthes textual
description of string representation in RFC 7159:

  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).

Fixes #417.
2016-02-28 08:09:16 +01:00
..
arithmetics.pegjs Switch from first/rest to head/tail in example grammars 2015-10-09 17:09:33 +02:00
css.pegjs Switch from first/rest to head/tail in example grammars 2015-10-09 17:09:33 +02:00
javascript.pegjs Switch from first/rest to head/tail in example grammars 2015-10-09 17:09:33 +02:00
json.pegjs examples/json.pegjs: Fix the "unescaped" rule 2016-02-28 08:09:16 +01:00