diff --git a/src/parser/text_element_parser.rs b/src/parser/text_element_parser.rs index 876ef3ef..e680aaa9 100644 --- a/src/parser/text_element_parser.rs +++ b/src/parser/text_element_parser.rs @@ -32,6 +32,7 @@ use nom::combinator::peek; use nom::combinator::recognize; use nom::error::ErrorKind; use nom::error::ParseError; +use nom::error::VerboseError; use nom::multi::many1; use nom::multi::many_till; use nom::sequence::tuple; @@ -274,3 +275,30 @@ fn flat_link<'s, 'r>(context: Context<'r, 's>, i: &'s str) -> Res<&'s str, Link< let ret = Link { contents: captured }; Ok((remaining, ret)) } + +pub struct MyError(I); + +impl ParseError for MyError { + fn from_error_kind(input: I, kind: ErrorKind) -> Self { + // MyError((input, kind)) + todo!() + } + + 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)))?; + tag("sdjfisdfjisudfjuwiefweufefefjwef")(i) +}