use core::{
convert::Infallible,
error::Error,
fmt::{Debug, Display, Formatter},
ops::{ControlFlow, FromResidual, Range, Try},
};
use crate::{ParseState, Parsed};
mod from_std;
mod methods;
mod reason;
mod residual;
#[derive(Eq, PartialEq)]
pub enum ParseResult<'i, T> {
Pending(ParseState<'i>, T),
Stop(StopBecause),
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub enum StopBecause {
Uninitialized,
ExpectEOF {
position: usize,
},
ExpectRepeats {
min: usize,
current: usize,
position: usize,
},
MissingCharacterRange {
start: char,
end: char,
position: usize,
},
MissingCharacterSet {
expected: &'static str,
position: usize,
},
MissingString {
message: &'static str,
position: usize,
},
MustBe {
message: &'static str,
position: usize,
},
ShouldNotBe {
message: &'static str,
position: usize,
},
Custom(CustomError<'static>),
}
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
pub struct CustomError<'i> {
pub message: &'i str,
pub start: usize,
pub end: usize,
}