MCPcopy Create free account
hub / github.com/cosdata/cosdata / parse_rule

Function parse_rule

src/cosql/rule.rs:32–53  ·  view source on GitHub ↗
(input: &str)

Source from the content-addressed store, hash-verified

30}
31
32pub fn parse_rule(input: &str) -> IResult<&str, Rule> {
33 let (input, name) = ws(parse_identifier)(input)?;
34 let (input, _) = ws(tag("as"))(input)?;
35 let (input, _) = ws(tag("match"))(input)?;
36
37 let (input, patterns) = parse_patterns0(input)?;
38
39 let (input, _) = ws(tag("infer"))(input)?;
40 let (input, inference_type) = parse_inference_type(input)?;
41 let (input, inferences) = parse_inferences1(input)?;
42 let (input, _) = ws(char(';'))(input)?;
43
44 let rule = Rule {
45 name: name.to_string(),
46 patterns,
47 compute_clauses: None,
48 inference_type,
49 inferences,
50 };
51
52 Ok((input, rule))
53}
54
55#[cfg(test)]
56mod tests {

Callers 1

test_rule_parserFunction · 0.85

Calls 4

parse_patterns0Function · 0.85
parse_inference_typeFunction · 0.85
parse_inferences1Function · 0.85
wsFunction · 0.70

Tested by 1

test_rule_parserFunction · 0.68