Macro nom::ws
[−]
[src]
macro_rules! ws { ($i:expr, $($args:tt)*) => { ... }; }
ws!(I -> IResult<I,O>) => I -> IResult<I, O>
transforms a parser to automatically consume
whitespace between each token. By default,
it takes the following characters: " \t\r\n"
.
If you need a whitespace parser consuming a
different set of characters, you can make
your own by reusing the sep!
combinator.
To use ws!
, pass your parser as argument:
named!(tuple<&[u8], (&[u8], &[u8]) >, ws!(tuple!( take!(3), tag!("de") )) ); assert_eq!( tuple(&b" \t abc de fg"[..]), Ok((&b"fg"[..], (&b"abc"[..], &b"de"[..]))) );