diff --git a/src/parser/text_element_parser.rs b/src/parser/text_element_parser.rs index e680aaa..65e1505 100644 --- a/src/parser/text_element_parser.rs +++ b/src/parser/text_element_parser.rs @@ -276,29 +276,30 @@ fn flat_link<'s, 'r>(context: Context<'r, 's>, i: &'s str) -> Res<&'s str, Link< Ok((remaining, ret)) } +#[derive(Debug, PartialEq)] +pub enum CustomError { + MyError(MyError), + Nom(I, ErrorKind), +} + +#[derive(Debug, PartialEq)] pub struct MyError(I); -impl ParseError for MyError { +impl ParseError for CustomError { fn from_error_kind(input: I, kind: ErrorKind) -> Self { - // MyError((input, kind)) - todo!() + CustomError::Nom(input, kind) } fn append(input: I, kind: ErrorKind, mut other: Self) -> Self { // Doesn't do append like VerboseError other } - - fn from_char(input: I, c: char) -> Self { - // MyError((input, c)) - todo!() - } } // Err(nom::Err::Error(nom::error::Error::from_error_kind(input, nom::error::ErrorKind::Char))) -fn test_parser<'a>(i: &'a str) -> IResult<&'a str, &'a str, VerboseError<&'a str>> { - Err(nom::Err::Error(MyError(i)))?; +fn test_parser<'a>(i: &'a str) -> IResult<&'a str, &'a str, CustomError<&'a str>> { + Err(nom::Err::Error(CustomError::MyError(MyError(i))))?; tag("sdjfisdfjisudfjuwiefweufefefjwef")(i) }