PEG.js v0.9.0 Release Notes
Release Date: 2015-08-30 // about 9 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
, andoffset
π functions available in parser code were replaced by a singlelocation
function which returns an object describing the current location. Similarly,
theline
,column
, andoffset
properties of exceptions were replaced by
a singlelocation
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 (thestack
property) in
π environments that supportError.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
andSyntaxError
topeg$parse
andpeg$SyntaxError
to
mark them as internal identifiers.
- π Tracing support. Parsers can be compiled with support for tracing their