nom::take_while_s
[−]
[src]
macro_rules! take_while_s { ($input:expr, $submac:ident!( $($args:tt)* )) => { ... }; ($input:expr, $f:expr) => { ... }; }
take_while_s!(char -> bool) => &str -> IResult<&str, &str>
returns the longest list of characters until the provided function fails.
The argument is either a function char -> bool
or a macro returning a `bool
fn alphabetic(chr: char) -> bool { (chr >= 0x41 as char && chr <= 0x5A as char) || (chr >= 0x61 as char && chr <= 0x7A as char) } named!( alpha<&str,&str>, take_while_s!( alphabetic ) ); let r = alpha("abcd\nefgh"); assert_eq!(r, Done("\nefgh", "abcd"));