@invisible/merge-parsers

[![CircleCI](https://circleci.com/gh/invisible-tech/merge-parsers/tree/master.svg?style=svg)](https://circleci.com/gh/invisible-tech/merge-parsers/tree/master)

Stats

StarsIssuesVersionUpdatedCreatedSize
@invisible/merge-parsers
501.3.33 years ago4 years agoMinified + gzip package size for @invisible/merge-parsers in KB

Readme

@invisible/merge-parsers

CircleCI

Generate parsers for each .pegjs file in a directory. Accepts @import syntax from pegjs-import.

Install

npm install @invisible/merge-parsers

or

yarn add @invisible/merge-parsers

Usage

// src/parsers/index.js
const mergeParsers = require('@invisible/merge-parsers')

const parsers = mergeParsers({ path: './rules' }) // path contains foo.pegjs and bar.pegjs

parsers.foo() // calls the `foo` parser
parsers.bar() // calls the `bar` parser

Options

  • path - Absolute or relative path to parsers rules directory.

  • graceful - Instead of raising an error, it fails gracefully returning undefined. (default)

  • pegOptions - Options object passed through to pegjs.

    • See pegjs for more information!

Miscellaneous information

The module uses relative paths from the file that called the function.

Issues

Any issue, please, contact us on Github!

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.