pub trait Parser<'a>: Debug {
type Error: Error;
type Output;
type Requirement: Debug + Display;
type RequirementContext;
fn parse(
&self,
src: &'a str,
pos: &mut usize
) -> Result<Self::Output, Self::Error>;
fn requirement(
&self,
context: Option<&Self::RequirementContext>
) -> Self::Requirement;
fn skip(&self, src: &'a str, pos: &mut usize) -> Result<(), Self::Error> { ... }
fn and_then<P>(self, next: P) -> SequenceParser<'a, Self, P>
where
Self: Sized,
P: Parser<'a>,
{ ... }
fn or<P>(self, next: P) -> OrderParser<'a, Self, P>
where
Self: Sized,
P: Parser<'a>,
{ ... }
fn map<R>(
self,
mapper: &'a dyn Fn(Self::Output) -> R
) -> MapParser<'a, Self, R>
where
Self: Sized,
{ ... }
fn and_gen<P>(
self,
generator: &'a dyn Fn(&Self::Output) -> P
) -> GenParser<'a, Self, P>
where
Self: Sized,
P: Parser<'a>,
{ ... }
fn repeat(self, min: usize, max: usize) -> RepetitionParser<'a, Self>
where
Self: Sized,
{ ... }
fn zero_or_more(self) -> RepetitionParser<'a, Self>
where
Self: Sized,
{ ... }
fn one_or_more(self) -> RepetitionParser<'a, Self>
where
Self: Sized,
{ ... }
fn stringify(self) -> StringifyParser<'a, Self>
where
Self: Sized,
{ ... }
}