JSPM

acorn-parse-regexps

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q19863F
  • License AGPL-3.0

Improved support for regular expressions in acorn

Package Exports

  • acorn-parse-regexps
  • acorn-parse-regexps/inject

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (acorn-parse-regexps) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Improved regular expressions support for Acorn

NPM version

This is a plugin for Acorn - a tiny, fast JavaScript parser, written completely in JavaScript.

It decouples regular expression parsing from the JavaScript host acorn is running in.

This allows to parse the following new features in every JS environment:

This plugin does not support the value property on regular expression Literal nodes, see ESTree. raw and regex can be used to get string-based representations of the regular expression.

Usage

You can use this module directly in order to get an Acorn instance with the plugin installed:

var acorn = require('acorn-parse-regexps');

Or you can use inject.js for injecting the plugin into your own version of Acorn like this:

var acorn = require('acorn-parse-regexps/inject')(require('./custom-acorn'));

Then, use the plugins option to enable the plugiin:

var ast = acorn.parse(code, {
  ecmaVersion: 9,
  plugins: { parseRegexps: true }
});

License

This plugin is released under the GNU Affero General Public License.