Function chomp::parsers::scan
[−]
[src]
pub fn scan<I: Copy, S, F>(i: Input<I>, s: S, f: F) -> SimpleResult<I, &[I]> where F: FnMut(S, I) -> Option<S>
The predicate consumes and transforms a state argument, this parser will match everything until
the predicate returns None
.
use chomp::{Input, scan}; let p = Input::new(b"/*test*of*scan*/ foo"); let r = scan(p, false, |s, c| match (s, c) { (true, b'/') => None, (_, b'*') => Some(true), (_, _) => Some(false), }); assert_eq!(r.unwrap(), b"/*test*of*scan*");