Trait parser_combinators::Parser
[−]
[src]
pub trait Parser { type Input: Stream; type Output; fn parse_state(&mut self, input: State<Self::Input>) -> ParseResult<Self::Output, Self::Input>; fn parse(&mut self, input: Self::Input) -> Result<(Self::Output, Self::Input), ParseError> { ... } }
By implementing the Parser
trait a type says that it can be used to parse an input stream into
the type Output
.
Associated Types
type Input: Stream
A type implementing the Stream
trait which is the specific type
that is parsed.
type Output
The type which is returned when the parsing is successful.
Required Methods
fn parse_state(&mut self, input: State<Self::Input>) -> ParseResult<Self::Output, Self::Input>
Parses using the state input
by calling Stream::uncons one or more times
On success returns Ok((value, new_state))
on failure it returns Err(error)
Provided Methods
fn parse(&mut self, input: Self::Input) -> Result<(Self::Output, Self::Input), ParseError>
Entrypoint of the parser
Takes some input and tries to parse it returning a ParseResult
Implementors
impl<'a, I, O, P: ?Sized> Parser for &'a mut P where I: Stream, P: Parser<Input=I, Output=O>
impl<I, O, P: ?Sized> Parser for Box<P> where I: Stream, P: Parser<Input=I, Output=O>
impl<'a, I, O, P> Parser for ChoiceSlice<'a, P> where I: Stream, P: Parser<Input=I, Output=O> + 'a
impl<I, O, P> Parser for ChoiceVec<P> where I: Stream, P: Parser<Input=I, Output=O>
impl<I> Parser for Unexpected<I> where I: Stream
impl<I, T> Parser for Value<I, T> where I: Stream, T: Clone
impl<P> Parser for NotFollowedBy<P> where P: Parser
impl<F, P> Parser for Many<F, P> where P: Parser, F: FromIterator<P::Output>
impl<F, P> Parser for Many1<F, P> where F: FromIterator<P::Output>, P: Parser
impl<P> Parser for SkipMany<P> where P: Parser
impl<P> Parser for SkipMany1<P> where P: Parser
impl<F, P, S> Parser for SepBy<F, P, S> where F: FromIterator<P::Output>, P: Parser, S: Parser<Input=P::Input>
impl<'a, I: Stream, O> Parser for FnMut(State<I>) -> ParseResult<O, I> + 'a
impl<I, O, F> Parser for FnParser<I, F> where I: Stream, F: FnMut(State<I>) -> ParseResult<O, I>
impl<I, O> Parser for fn(State<I>) -> ParseResult<O, I> where I: Stream
impl<P> Parser for Optional<P> where P: Parser
impl<L, R, P> Parser for Between<L, R, P> where L: Parser, R: Parser<Input=L::Input>, P: Parser<Input=L::Input>
impl<'a, I, O, P, Op> Parser for Chainl1<P, Op> where I: Stream, P: Parser<Input=I, Output=O>, Op: Parser<Input=I, Output=Box<FnMut(O, O) -> O + 'a>>
impl<'a, I, O, P, Op> Parser for Chainr1<P, Op> where I: Stream, P: Parser<Input=I, Output=O>, Op: Parser<Input=I, Output=Box<FnMut(O, O) -> O + 'a>>
impl<I, O, P> Parser for Try<P> where I: Stream, P: Parser<Input=I, Output=O>
impl<I, A, B, P1, P2> Parser for And<P1, P2> where I: Stream, P1: Parser<Input=I, Output=A>, P2: Parser<Input=I, Output=B>
impl<I, P1, P2> Parser for With<P1, P2> where I: Stream, P1: Parser<Input=I>, P2: Parser<Input=I>
impl<I, P1, P2> Parser for Skip<P1, P2> where I: Stream, P1: Parser<Input=I>, P2: Parser<Input=I>
impl<I, P> Parser for Message<P> where I: Stream, P: Parser<Input=I>
impl<I, O, P1, P2> Parser for Or<P1, P2> where I: Stream, P1: Parser<Input=I, Output=O>, P2: Parser<Input=I, Output=O>
impl<I, A, B, P, F> Parser for Map<P, F> where I: Stream, P: Parser<Input=I, Output=A>, F: FnMut(A) -> B
impl<P, N, F> Parser for Then<P, F> where F: FnMut(P::Output) -> N, P: Parser, N: Parser<Input=P::Input>
impl<P> Parser for Expected<P> where P: Parser
impl<I, Pred> Parser for Satisfy<I, Pred> where I: Stream<Item=char>, Pred: FnMut(char) -> bool
impl<I> Parser for Digit<I> where I: Stream<Item=char>
impl<I> Parser for Space<I> where I: Stream<Item=char>
impl<I> Parser for Spaces<I> where I: Stream<Item=char>
impl<I> Parser for NewLine<I> where I: Stream<Item=char>
impl<I> Parser for CrLf<I> where I: Stream<Item=char>
impl<I> Parser for Tab<I> where I: Stream<Item=char>
impl<I> Parser for Upper<I> where I: Stream<Item=char>
impl<I> Parser for Lower<I> where I: Stream<Item=char>
impl<I> Parser for AlphaNum<I> where I: Stream<Item=char>
impl<I> Parser for Letter<I> where I: Stream<Item=char>
impl<I> Parser for OctDigit<I> where I: Stream<Item=char>
impl<I> Parser for HexDigit<I> where I: Stream<Item=char>
impl<I> Parser for String<I> where I: Stream<Item=char>