You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
4.4 KiB
Markdown

6 years ago
---
editLink: false
---
> See [commit history](https://github.com/pegjs/pegjs/compare/v0.7.0...v0.8.0) for a full list of changes.
## v0.8.0 _(December 24, 2013)_
### Big Changes
* Completely rewrote the code generator. Among other things, it allows optimizing generated parsers for parsing speed or code size using the `optimize` option of the `PEG.buildParser` method or the `--optimize`/`-o` option on the command-line. All internal identifiers in generated code now also have a `peg$` prefix to discourage their use and avoid conflicts. [[#35](https://github.com/dmajda/pegjs/issues/35), [#92](https://github.com/dmajda/pegjs/issues/92)]
* Completely redesigned error handling. Instead of returning `null` inside actions to indicate match failure, new `expected` and `error` functions can be called to trigger an error. Also, expectation inside the `SyntaxError` exceptions are now structured to allow easier machine processing. [[#198](https://github.com/dmajda/pegjs/issues/198)]
* Implemented a plugin API. The list of plugins to use can be specified using the `plugins` option of the `PEG.buildParser` method or the `--plugin` option on the command-line. Also implemented the `--extra-options` and `--extra-options-file` command-line options, which are mainly useful to pass additional options to plugins. [[#106](https://github.com/dmajda/pegjs/issues/106)]
* Made `offset`, `line` and `column` functions, not variables. They are now available in all parsers and return lazily-computed position data. Removed now useless `trackLineAndColumn` option of the `PEG.buildParser` method and the `--track-line-and-column` option on the command-line.
* Added a new `text` function. When called inside an action, it returns the text matched by action's expression. [[#131](https://github.com/dmajda/pegjs/issues/131)]
* Added a new `$` operator. It extracts matched strings from expressions.
* The `?` operator now returns `null` on unsuccessful match.
* Predicates now always return `undefined`.
* Replaced the `startRule` parameter of the `parse` method in generated parsers with more generic `options` parameter. The start rule can now be specified as the `startRule` option. The `options` parameter can be also used to pass custom options to the parser because it is visible as the `options` variable inside parser code. [[#37](https://github.com/dmajda/pegjs/issues/37)]
* The list of allowed start rules of a generated parser now has to be specified explicitly using the `allowedStartRules` option of the `PEG.buildParser` method or the `--allowed-start-rule` option on the command-line. This will make certain optimizations like rule inlining easier in the future.
* Removed the `toSource` method of generated parsers and introduced a new `output` option of the `PEG.buildParser` method. It allows callers to specify whether they want to get back the parser object or its source code.
* The source code is now a valid npm package. This makes using development versions easier. [[#32](https://github.com/dmajda/pegjs/issues/32)]
* Generated parsers are now ~25% faster and ~62%/~3% smaller (when optimized for size/speed) than those generated by 0.7.0.
* Requires Node.js 0.8.0+.
### Small Changes
* `bin/pegjs` now outputs just the parser source if the value of the `--export-var` option is empty. This makes embedding generated parsers into other files easier. [[#143](https://github.com/dmajda/pegjs/issues/143)]
* Changed the value of the `name` property of `PEG.GrammarError` instances from “PEG.GrammarError” to just “GrammarError”. This better reflects the fact that PEG.js can get required with different variable name than `PEG`.
* Setup prototype chain for `PEG.GrammarError` correctly.
* Setup prototype chain for `SyntaxError` in generated parsers correctly.
* Fixed error messages in certain cases with trailing input [[#119](https://github.com/dmajda/pegjs/issues/119)]
* Fixed code generated for classes starting with `\^`. [[#125](https://github.com/dmajda/pegjs/issues/125)]
* Fixed too eager proxy rules removal. [[#137](https://github.com/dmajda/pegjs/issues/137)]
* Added a license to all vendored libraries. [[#207](https://github.com/dmajda/pegjs/issues/207)]
* Converted the test suite from QUnit to Jasmine, cleaning it up on the way.
* Travis CI integration.
* Various internal code improvements and fixes.
* Various generated code improvements and fixes.
* Various example grammar improvements and fixes.
* Improved `README.md`.
* Converted `CHANGELOG` to Markdown.