Augmented Backus-Naur Form (ABNF) parsing for node.js. See RFC 4234.
JavaScript
Latest commit 5c70464 Jun 10, 2013 Joe Hildebrand Update to 0.5
Failed to load latest commit information.
bin rename binaries. Sorry for the backward-compat hit, but "ast" was too… Jun 10, 2013
examples Add email example. Fix line-ending issues for input files. One day, t… May 29, 2012
lib Check for unreferenced rules, assume the first one is the root. Jun 10, 2013
.gitattributes EOL fix obliterated .gitattributes. re-fix. Add a jid example. May 29, 2012
.gitignore first commit May 29, 2012
LICENSE Refactor AST into separate javascript file. Remove security vulnerabi… May 29, 2012
README.md
package.json Update to 0.5 Jun 10, 2013

README.md

Parse ABNF grammars

For more information on ABNF, See RFC5234.

Installation:

npm install abnf

Example:

var abnf = require('abnf');
abnf.Parse("myfile.abnf", function(er, rules) {
    if (er) {
        console.error(er);
    } else {
        // Do something with rules
    }
});

.Parse(input, callback)

Parse the given input (string or readable stream), then call the callback with an error (will be null on success) and a Rules object

.ParseFile(input, callback)

Parse the file with the given name, then call the callback with an error (will be null on success) and a Rules object

Rules.defs

A hash of Rule objects indexed by uppercase rulename.

Rules.refs

An array of RuleRef objects.

Rule.name

The name of the rule

Rule.line

The line in the input file where the rule name was defined

Rule.def

The definition of the rule. More information forthcoming.

RuleRef.name

The name of the rule that was referenced

RuleRef.line

The line in the input file where the rule name was referenced.