Macro dynparser::rep [−][src]
macro_rules! rep { ($e:expr, $min:expr) => { ... }; ($e:expr, $min:expr, $max:expr) => { ... }; }
repeat expression. You have to define minimum repetitions and opionally maximum repetitions (if missing, infinite)
example
#[macro_use] extern crate dynparser; use dynparser::parse; fn main() { let rules = rules!{ "main" => rep!(lit!("a"), 0) }; assert!(parse("aaaaaaaa", &rules).is_ok()) }
repeating from 0 to infinite
#[macro_use] extern crate dynparser; use dynparser::parse; fn main() { let rules = rules!{ "main" => rep!(lit!("a"), 0, 3) }; assert!(parse("aaa", &rules).is_ok()) }