macro_rules! generate_rule { ($name: ident, $struct: path, $new: expr) => { ... }; }
Expand description
Used in parsing.
ยงExamples
See crate::literal_rule!
and crate::not_prefix!
.
use elipdotter::*;
use elipdotter::query::Part;
use elipdotter::query::parse::LiteralRule;
generate_rule!(EllerLiteral, LiteralRule, LiteralRule::new("eller", query::parse::Op::Or));
let opts = elipdotter::query::ParseOptions::new().populate_literals().insert(EllerLiteral::default()).populate_not().populate_and_space();
let part = elipdotter::query::parse("elipdotter eller search", opts).unwrap();
assert_eq!(part, Part::or("elipdotter", "search"));