Trait peruse::parsers::ParserCombinator
[−]
[src]
pub trait ParserCombinator: Parser + Clone { fn then<P: Parser<I = Self::I>>(&self, p: P) -> ChainedParser<Self, P> { ... } fn then_r<P: ParserCombinator<I = Self::I>>(
&self,
p: P
) -> MapParser<Self::I, ChainedParser<Self, P>, P::O> { ... } fn then_l<P: ParserCombinator<I = Self::I>>(
&self,
p: P
) -> MapParser<Self::I, ChainedParser<Self, P>, Self::O> { ... } fn repeat(&self) -> RepeatParser<Self> { ... } fn map<T, F: 'static + Fn(Self::O) -> T>(
&self,
f: F
) -> MapParser<Self::I, Self, T> { ... } fn or<P: Parser<I = Self::I, O = Self::O>>(&self, p: P) -> OrParser<Self, P> { ... } }
Combinator methods for slice parsers. In most cases, these methods copy the caller into a higher-order parser
Provided Methods
fn then<P: Parser<I = Self::I>>(&self, p: P) -> ChainedParser<Self, P>
Chain this parser with another parser, creating new parser that returns a tuple of their results
fn then_r<P: ParserCombinator<I = Self::I>>(
&self,
p: P
) -> MapParser<Self::I, ChainedParser<Self, P>, P::O>
&self,
p: P
) -> MapParser<Self::I, ChainedParser<Self, P>, P::O>
Chain this parser with another parser, but toss the value from this parser
fn then_l<P: ParserCombinator<I = Self::I>>(
&self,
p: P
) -> MapParser<Self::I, ChainedParser<Self, P>, Self::O>
&self,
p: P
) -> MapParser<Self::I, ChainedParser<Self, P>, Self::O>
Chain this parser with another parser, but toss the value from the other parser
fn repeat(&self) -> RepeatParser<Self>
Create a new parser that will repeat this parser until it returns an error
fn map<T, F: 'static + Fn(Self::O) -> T>(
&self,
f: F
) -> MapParser<Self::I, Self, T>
&self,
f: F
) -> MapParser<Self::I, Self, T>
Map the value of this parser
fn or<P: Parser<I = Self::I, O = Self::O>>(&self, p: P) -> OrParser<Self, P>
Create a disjunction with another parser. If this parser produces an error, the other parser will be used
Implementors
impl<C: ?Sized, A: ParserCombinator<I = C>, B: ParserCombinator<I = C>> ParserCombinator for ChainedParser<A, B>
impl<T: ParserCombinator> ParserCombinator for RepeatParser<T>
impl<I: ?Sized, P: ParserCombinator<I = I>, T> ParserCombinator for MapParser<I, P, T>
impl<I: ?Sized, O, S: ParserCombinator<I = I, O = O>, T: ParserCombinator<I = I, O = O>> ParserCombinator for OrParser<S, T>
impl<P: ParserCombinator> ParserCombinator for OptionParser<P>
impl<I: ?Sized, O, F> ParserCombinator for RecursiveParser<I, O, F> where
F: Fn() -> Box<Parser<I = I, O = O>>,impl<I: ?Sized, A: ParserCombinator<I = I>, B: ParserCombinator<I = I>> ParserCombinator for RepSepParser<A, B>
impl<T: ParserCombinator> ParserCombinator for OneOfParser<T>
impl<I: ?Sized, O> ParserCombinator for BoxedParser<I, O>
impl<T: Eq + Clone> ParserCombinator for LiteralParser<T>
impl<T: Clone, U> ParserCombinator for MatchParser<T, U>
impl<T: Clone> ParserCombinator for RegexLiteralParser<T>
impl<T: Clone, F: Fn(Captures) -> T> ParserCombinator for RegexCapturesParser<T, F>