pegjs/examples
David Majda f3d392bd1c JavaScript example: Fix handling of elided elements in array literals
JavaScript allows one to skip (elide) elements in array literals. It
also allows a trailing comma, which doesn't imply an element elision.

For example, an array literal:

  [,,,]

contains three elided elements (one before each comma) and a trailing
comma.

Example JavaScript parser handled elided elements incorrectly and just
threw them away. This commit fixes this behvior and inserts |null| in
the AST for each elided element. This is in line with how SpiderMonkey's
JavaScript parser (the |Reflect.parse| API), Esprima and Acorn behave.

Based on a patch by @fpirsch:

  https://github.com/dmajda/pegjs/pull/177
2013-08-31 11:02:00 +02:00
..
arithmetics.pegjs Text nodes: Use text nodes in examples/arithmetics.pegjs 2012-12-02 17:25:52 +01:00
css.pegjs Text nodes: Use text nodes in examples/css.pegjs 2012-12-02 17:40:02 +01:00
javascript.pegjs JavaScript example: Fix handling of elided elements in array literals 2013-08-31 11:02:00 +02:00
json.pegjs Fix |null| handling in the JSON parser 2013-08-20 07:54:12 +02:00