PEG.js v0.9.0 Release Notes

Release Date: 2015-08-30 // over 6 years ago
  • Major Changes

    • πŸ‘ Tracing support. Parsers can be compiled with support for tracing their
      progress, which can help debugging complex grammars. This feature is
      experimental and is expected to evolve over time as experience is gained.
      More details
    • Infinite loop detection. Grammar constructs that could cause infinite
      πŸ“œ loops in generated parsers are detected during compilation and cause errors.
    • πŸ‘Œ Improved location information API. The line, column, and offset
      πŸ“œ functions available in parser code were replaced by a single location
      function which returns an object describing the current location. Similarly,
      the line, column, and offset properties of exceptions were replaced by
      a single location property. The location is no longer a single point but a
      character range, which is meaningful mainly in actions where the range
      covers action’s expression.
      More details
    • πŸ‘Œ Improved error reporting. All exceptions thrown when generating a parser
      have associated location information. And all exceptions thrown by generated
      πŸ“œ parser and PEG.js itself have a stack trace (the stack property) in
      πŸ‘ environments that support Error.captureStackTrace.
    • Strict mode code. All PEG.js and generated parser code is written using
      🌐 JavaScript strict mode.

    Minor Changes

    • πŸ‘€ Labels behave like block-scoped variables. This means parser code can see
      labels defined outside expressions containing code.
    • Empty sequences are no longer allowed.
    • Label names can’t be JavaScript reserved words.
    • Rule and label names can contain Unicode characters like in JavaScript.
    • Rules have to be separated either by ; or a newline (until now, any
      whitespace was enough).
    • The PEG.js grammar and all the example grammars were completely rewritten.
      This rewrite included a number of cleanups, formatting changes, naming
      πŸ”„ changes, and bug fixes.
    • πŸ“œ The parser object can now be accessed as parser in parser code.
    • Location information computation is faster.
    • βž• Added support for Node.js >= 0.10.x, io.js, and Edge. Removed support for
      Node.js < 0.10.x.

    πŸ› Bug Fixes

    • πŸ›  Fixed left recursion detector which missed many cases.
    • πŸ›  Fixed escaping of U+0100β€”U+107F and U+1000β€”U+107F in generated code and
      error messages.
    • πŸ“œ Renamed parse and SyntaxError to peg$parse and peg$SyntaxError to
      mark them as internal identifiers.

    Complete set of changes