0.0.6 • Published 10 years ago

llkp v0.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

llkp - LL(k) parsers

Build Status

The goal of this library is to provide API that would look like the built-in RegExp class and would let easily write parsers for structures that cannot be parsed with regular expressions, such as XML-like structures, the e-mail pattern defined in RFC 822, the data URL pattern and so on.

Examples

To parse a list of comma separated key-value pairs with a parser written as ABNF:

var ABNF = require('llkp/abnf');

var p = new ABNF('1*{","}(key "=" val)', { key: /\w+/, val: /\w+/ }).join(0, 2);
var r = p.exec('charset=utf8,type=text,subtype=html');

assert.deepEqual(r, { charset: 'utf8', type: 'text', subtype: 'html' });

Tests

Unit tests were written in the mocha's TDD style:

npm install -g mocha
mocha -u tdd

They can be run with npm:

npm test

Coverage

TBD (istanbul?)

Static analysis

Static analysis is done by JSHint:

npm install -g jshint
jshint --verbose .

This command is mentioned in package.json so it's enough to run npm test:

npm test

Documentation

Check out the wiki page.

License

MIT

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago