Macro nom::terminated[][src]

macro_rules! terminated {
    ($i : expr, $submac : ident! ($($args : tt) *), $submac2 : ident!
 ($($args2 : tt) *)) => { ... };
    ($i : expr, $submac : ident! ($($args : tt) *), $g : expr) => { ... };
    ($i : expr, $f : expr, $submac : ident! ($($args : tt) *)) => { ... };
    ($i : expr, $f : expr, $g : expr) => { ... };
}
Expand description

terminated!(I -> IResult<I,O>, I -> IResult<I,T>) => I -> IResult<I, O> terminated returns the result of its first parser if both succeed

named!(parser<&str, &str>, terminated!(alpha1, char!(';')));

assert_eq!(parser("abc;"), Ok(("", "abc")));
assert_eq!(parser("abc,"), Err(Err::Error((",", ErrorKind::Char))));
assert_eq!(parser("123;"), Err(Err::Error(("123;", ErrorKind::Alpha))));