Macro abortable_parser::either [−][src]
macro_rules! either { ($i:expr, $f:ident!( $( $args:tt )* ), $( $rest:tt)* ) => { ... }; ($i:expr, $f:ident, $($rest:tt)* ) => { ... }; ($i:expr, $f:ident!( $( $args:tt )* )) => { ... }; ($i:expr, $f:ident) => { ... }; (__impl $i:expr, $f:ident) => { ... }; (__impl $i:expr, $f:ident,) => { ... }; (__impl $i:expr, $f:ident!( $( $args:tt )* ),) => { ... }; (__impl $i:expr, $f:ident!( $( $args:tt )* )) => { ... }; (__impl $i:expr, $f:ident!( $( $args:tt )* ), $( $rest:tt )* ) => { ... }; (__impl $i:expr, $f:ident, $( $rest:tt )* ) => { ... }; }
Returns the output of the first sub parser to succeed.
use abortable_parser::iter; let input_str = "foo"; let iter = iter::SliceIter::new(input_str.as_bytes()); let result = either!(iter, text_token!("bar"), text_token!("foo"));