rust-bakery / nom

Rust parser combinator framework
MIT License
9.38k stars 806 forks source link

Ease integration of custom error #1661

Open douglas-raillard-arm opened 1 year ago

douglas-raillard-arm commented 1 year ago

Nom currently supports custom error types, but that requires a lot of boilerplate on user side that I believe could simply be part of nom itself:

[inline]

pub fn failure<I, O, E, E2>(input: I, err: E) -> nom::IResult<I, O, E2> where E2: FromExternalError<I, E>, { Err(nom::Err::Failure(E2::from_external_error( input, ErrorKind::Fail, err, ))) }



nom version : 7.1.3