regexp
Regex Parser
Last updated 13 years ago by forbeslindesay .
MIT · Repository · Original npm · Tarball · package.json
$ npm install regexp 
SYNC missed versions from official npm registry.

regexp

Regex parser based on descriptions in http://www.javascriptkit.com/javatutors/redev2.shtml

Build Status Dependency Status NPM version

Installation

npm install regexp

Usage

var regexp = require('regexp')
var res = regexp('[a-z]+')
assert.deepEqual(res, { type: 'match',
  offset: 0,
  text: '[a-z]+',
  body:
   [ { type: 'quantified',
       offset: 0,
       text: '[a-z]+',
       body:
        { type: 'charset',
          offset: 0,
          text: '[a-z]',
          invert: false,
          body:
           [ { type: 'range',
               offset: 1,
               text: 'a-z',
               start: 'a',
               end: 'z' } ] },
       quantifier:
        { type: 'quantifier',
          offset: 5,
          text: '+',
          min: 1,
          max: Infinity,
          greedy: true } } ] })

Contributing

To run tests:

$ npm install
$ npm test

This will also automatically compile index.js.

The key source files are src/grammer.pegjs which is compiled using pegjs and src/index.js which is a CommonJS module with a special additional pseudo import statement.

License

MIT

Current Tags

  • 1.0.0                                ...           latest (13 years ago)

7 Versions

  • 1.0.0                                ...           13 years ago
  • 0.0.6                                ...           13 years ago
  • 0.0.5                                ...           13 years ago
  • 0.0.4                                ...           13 years ago
  • 0.0.3                                ...           13 years ago
  • 0.0.2                                ...           13 years ago
  • 0.0.1                                ...           13 years ago
Maintainers (1)
Downloads
Total 17
Today 0
This Week 3
This Month 12
Last Day 0
Last Week 6
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)
  • uglify-js ~2.3.6
  • pegjs https://github.com/dmajda/pegjs/archive/798ed6a8a4fbfc36b312ba09d428a5832808d9d6.tar.gz
  • bash-color 0.0.3
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE