pub fn rule(input: &str) -> Result<Rule, ParseError>
Expand description
Parses a single ABNF rule.
Returns Ok(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::rule;
match rule("a = b / c / *d") {
Ok(rules) => println!("{:#?}", rules),
Err(error) => eprintln!("{}", error),
}