@hyperjump/abnf
v1.0.0
Published
Compile ABNF grammars into regular expressions
Maintainers
Readme
Hyperjump - ABNF
Compile grammars written in
ABNF into regular expressions.
ABNF is the notation that RFCs use for syntax, so you can paste an RFC's
rules in and get a RegExp that matches what the RFC describes.
Read the documentation at hyperjump.io
npm install @hyperjump/abnfimport { abnf } from "@hyperjump/abnf";
const fullDate = abnf()`
full-date = date-fullyear "-" date-month "-" date-mday
date-fullyear = 4DIGIT
date-month = 2DIGIT
date-mday = 2DIGIT
`;
fullDate.test("2004-01-15"); // true- RFC 5234 and RFC 7405. Rules, repetition, options, groups, numeric values, and case-insensitive and case-sensitive strings, with the core rules built in.
- A regular expression. The result is a
RegExpwith theuflag, as fast as one written by hand. - What you know about the input. A context can supply rules to reference, characters that end a match, and characters the input can't have.
- Small. No dependencies. TypeScript types included. Works in Node.js and browsers.
Documentation
Contributing
See design/ for how it works and why.
npm install
npm test
npm run lint
npm run type-checkLicense
MIT
