Macro nom::take_while1_s[][src]

macro_rules! take_while1_s {
    ($input:expr, $submac:ident!( $($args:tt)* )) => { ... };
    ($input:expr, $f:expr) => { ... };
}
Deprecating in 4.0.0

: Please use take_while1 instead

take_while1_s!(char -> bool) => &str -> IResult<&str, &str> returns the longest (non empty) 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_while1_s!( alphabetic ) );

 let r = alpha("abcd\nefgh");
 assert_eq!(r, Ok(("\nefgh", "abcd")));