Files
organic/src/error/error.rs
Tom Alexander dab598e5e7
Some checks failed
rust-test Build rust-test has failed
rust-build Build rust-build has failed
Convert all functions to using the wrapped input type.
2023-08-24 16:06:29 -04:00

27 lines
721 B
Rust

use nom::error::ErrorKind;
use nom::error::ParseError;
use nom::IResult;
pub type Res<T, U> = IResult<T, U, CustomError<T>>;
// TODO: MyError probably shouldn't be based on the same type as the input type since it's used exclusively with static strings right now.
#[derive(Debug, PartialEq)]
pub enum CustomError<I> {
MyError(MyError<I>),
Nom(I, ErrorKind),
}
#[derive(Debug, PartialEq)]
pub struct MyError<I>(pub I);
impl<I> ParseError<I> for CustomError<I> {
fn from_error_kind(input: I, kind: ErrorKind) -> Self {
CustomError::Nom(input, kind)
}
fn append(_input: I, _kind: ErrorKind, /*mut*/ other: Self) -> Self {
// Doesn't do append like VerboseError
other
}
}