/// Parses the opening delimiter, calls the `inner` function, and parses the
/// closing delimiter. Properly recovers to and including the closing
/// delimiter if the `inner` function throws an error.
Parses the opening delimiter, calls the `inner` function, and parses the
closing delimiter. Properly recovers to and including the closing
delimiter if the `inner` function throws an error.
Parses the opening delimiter calls the ` inner ` function and parses the closing delimiter . Properly recovers to and including the closing delimiter if the ` inner ` function throws an error .
pub fn flanked<P: Parser, R, F>(p: &mut P, delim: DelimToken, mut inner: F) -> RecoveredResult<R>
where
    F: FnMut(&mut P) -> ReportedResult<R>,
{
    require(p, OpenDelim(delim)).map_err(|_| Recovered)?;
    match inner(p) {
        Ok(r) => match require(p, CloseDelim(delim)) {
            Ok(_) => Ok(r),
            Err(Reported) => {
                recover(p, &[CloseDelim(delim)], true);
                Err(Recovered)
            }
        },
        Err(Reported) => {
            recover(p, &[CloseDelim(delim)], true);
            Err(Recovered)
        }
    }
}
pub fn flanked < P : Parser , R , F > ( p : & mut P , delim : DelimToken , mut inner : F ) -> RecoveredResult < R > where F : FnMut ( & mut P ) -> ReportedResult < R > , { require ( p , OpenDelim ( delim ) ) . map_err ( | _ | Recovered ) ? ; match inner ( p ) { Ok ( r ) => match require ( p , CloseDelim ( delim ) ) { Ok ( _ ) => Ok ( r ) , Err ( Reported ) => { recover ( p , & [ CloseDelim ( delim ) ] , true ) ; Err ( Recovered ) } } , Err ( Reported ) => { recover ( p , & [ CloseDelim ( delim ) ] , true ) ; Err ( Recovered ) } } }
Parses the opening delimiter, calls the `inner` function, and parses the
closing delimiter.
Parses the opening delimiter calls the ` inner ` function and parses the closing delimiter .
p
&mut P
delim
DelimToken
inner
F