Macro abortable_parser::until
source · macro_rules! until {
($i:expr, $rule:ident!( $( $args:tt )* ) ) => { ... };
($i:expr, $rule:ident) => { ... };
}
Expand description
Consumes an input until it reaches a term that the contained rule matches. It does not consume the subrule.
If the term never matches then returns incomplete.
use abortable_parser::iter;
use std::convert::From;
let iter: iter::SliceIter<u8> = "foo;".into();
let tok = until!(iter, text_token!(";"));
if let Result::Complete(i, o) = tok {
assert_eq!(i.get_offset(), 3);
}