nom::alt!
[−]
[src]
macro_rules! alt { ($i:expr, $($rest:tt)*) => { ... }; }
try a list of parser, return the result of the first successful one
Incomplete results are ignored
named!( test, alt!( tag!( "abcd" ) | tag!( "efgh" ) ) ); let r1 = test(b"abcdefgh"); assert_eq!(r1, Done(&b"efgh"[..], &b"abcd"[..])); let r2 = test(&b"efghijkl"[..]); assert_eq!(r2, Done(&b"ijkl"[..], &b"efgh"[..]));