[−][src]Crate abnf
A crate for parsing ABNF definitions.
This crate exposes two functions for now, rulelist
and rule
.
The functions are designed to cover the use case, where the complete ABNF definition is provided as a string.
On success, both functions return Ok(...)
with the parsed object.
If the ABNF definition contains a syntax error, both functions will return Err(ParsingError)
.
ParsingError
is intended to be displayed to a user and should help correcting mistakes in the
provided ABNF definition.
Example
use abnf::rulelist; // Note: mind the trailing newline! match rulelist("a = b\nc = *d\n") { Ok(rules) => { for rule in &rules { println!("{:#?}\n", rule); } }, Err(error) => eprintln!("{}", error), }
Modules
error | This module contains error related structs. |
types | This module contains a collection of all types in the ABNF crate. The types can be used to manually construct new rules. |
Functions
rule | Parses a single ABNF rule.
Returns |
rulelist | Parses a list of multiple ABNF rules.
Returns |