pub struct MATCHER { /* fields omitted */ }
Returns Some(Match)
if the grammar can parse the string. Note that
unless the grammar is string-bounded, this only means it can parse
the string at some point.
let m = grammar!{
(?bB)
S -> r(r"\A") <subject> <VP> r(r"\.\z")
subject => [["Amy", "Bob", "Carter", "Dianne"]]
VP -> <verb_intransitive> | <verb_transitive> <object>
verb_intransitive => [["naps", "doodles", "exercises", "meditates"]]
verb_transitive => [["eats", "programs", "sees", "throws"]]
object => (?w) [["a sandwich", "eggs", "the sunset"]]
}.matcher()?;
let parse_tree = m.parse("Amy programs the sunset.").unwrap();
println!("{}", parse_tree);
Returns whether the grammar can parse the string. This is a cheaper
operation than parsing.
let m = grammar!{
(?bB)
S -> r(r"\A") <subject> <VP> r(r"\.\z")
subject => [["Amy", "Bob", "Carter", "Dianne"]]
VP -> <verb_intransitive> | <verb_transitive> <object>
verb_intransitive => [["naps", "doodles", "exercises", "meditates"]]
verb_transitive => [["eats", "programs", "sees", "throws"]]
object => (?w) [["a sandwich", "eggs", "the sunset"]]
}.matcher()?;
assert!(m.is_match("Bob doodles."));
The resulting type after dereferencing.
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static