[][src]Function abnf::rulelist

pub fn rulelist(input: &str) -> Result<Vec<Rule>, ParseError>

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.)


use abnf::rulelist;

match rulelist("a = b\nc = *d\n") {
    Ok(rules) => println!("{:#?}", rules),
    Err(error) => eprintln!("{}", error),