Skip to content

voltrevo/parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

parser NPM version Build Status Dependency Status Coverage percentage

A parser library based on functional composition of stream consumers.

Install

$ npm install --save voltrevo-parser

Usage

'use strict';

var parser = require('voltrevo-parser');

var foo = parser.string('foo');
var bar = parser.string('bar');
var baz = parser.string('baz');

var demo = parser.sequence(
  parser.oneOrMore(foo),
  parser.many(bar),
  baz
);

var stream = parser.Stream('foobarbarbarbaz');

console.log(demo.consume(stream)); /*
{ name: 'sequence(oneOrMore("foo"), many("bar"), "baz")',
  value: [ [ 'foo' ], [ 'bar', 'bar', 'bar' ], 'baz' ],
  accepted: true,
  valid: true,
  invalidations: [],
  location: [ [Function], [Function] ] }
*/

License

MIT © Andrew Morris

About

A javascript parsing library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published