2022-01-16 20:31:50 +00:00
|
|
|
use nom::error::ErrorKind;
|
|
|
|
use nom::error::ParseError;
|
|
|
|
use nom::Err;
|
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum Error<I> {
|
2023-01-08 17:11:35 +00:00
|
|
|
Parser(I),
|
|
|
|
Field(I, String),
|
|
|
|
Split(I, String),
|
|
|
|
Order(I, String),
|
|
|
|
Group(I, String),
|
2022-01-16 20:31:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub type IResult<I, O, E = Error<I>> = Result<(I, O), Err<E>>;
|
|
|
|
|
|
|
|
impl<I> ParseError<I> for Error<I> {
|
|
|
|
fn from_error_kind(input: I, _: ErrorKind) -> Self {
|
2023-01-08 17:11:35 +00:00
|
|
|
Self::Parser(input)
|
2022-01-16 20:31:50 +00:00
|
|
|
}
|
|
|
|
fn append(_: I, _: ErrorKind, other: Self) -> Self {
|
|
|
|
other
|
|
|
|
}
|
|
|
|
}
|