Function parse_rule

Source
pub fn parse_rule(input: &str) -> Result<Rule>
Expand description

Parse a rule from a string according to the AIM grammar.

This function parses a complete rule definition from a string, including its identifier, optional quick evaluation status, type definition, operand, and optional value.

The grammar for a rule is: rule = WS?, identifier, WS?, ':', WS?, typedef, WS?, '=', WS?, value, WS?, EOL

§Parameters

  • input: The string to parse as a rule definition

§Returns

Ok(Rule) if parsing was successful, or an error with details if parsing failed

§Examples

let rule = parse_rule(r#"test_rule: Number = 42"#).unwrap();
assert_eq!(rule.identifier(), "test_rule");