@peeriq/ember-cli-pegjs

1.0.2 • Public • Published

ember-cli-pegjs

An ember-cli addon for generating PegJS parser from grammar file.

Installation

npm install --save-dev @peeriq/ember-cli-pegjs

Usage

By default this addon will generate a parser for every file with the pegjs extension, the generated parser extension is js and will be located in the same folder as the grammar file.

The parser is exported as an ES6 module and can be simply imported as any other Ember CLI file.

You can control how the parser code is exported by specifying options using the pegOptions config property:

var app = new EmberApp({
  ...
  pegOptions: {
    wrapper: function (src, parser) {
      return 'var Parser = ' + parser + ";\nvar parse = Parser.parse, SyntaxError = Parser.SyntaxError;\nexport {SyntaxError, parse};\nexport default parse;";
    }
  }
});

Readme

Keywords

Package Sidebar

Install

npm i @peeriq/ember-cli-pegjs

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

14.3 kB

Total Files

5

Last publish

Collaborators

  • wojm
  • gaurav9576