pub fn rulelist(input: &str) -> Result<Vec<Rule>, ParseError>
Expand description
Parses a list of multiple ABNF rules.
Returns Ok(Vec<Rule>)
when everything went well and Err(ParsingError)
in case of syntax errors.
Note: input
must end with a newline and whitespace must not appear before the rulename.
(This may be relaxed in the future.)
Example
use abnf::rulelist;
// Note: mind the trailing newline!
match rulelist("a = b\nc = *d\n") {
Ok(rules) => println!("{:#?}", rules),
Err(error) => eprintln!("{}", error),
}