llkp - LL(k) parsers
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 = ; var p = '1*{","}(key "=" val)' key: /\w+/ val: /\w+/ ;var r = p; assert;
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