Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Augmented Backus-Naur Form (ABNF) parsing for node.js. See RFC 4234.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 .gitattributes
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
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.

Something went wrong with that request. Please try again.