Struct peresil::ParseMaster [−][src]
pub struct ParseMaster<P, E, S = ()> { pub state: S, // some fields omitted }
The main entrypoint to parsing.
This tracks the collection of outstanding errors and provides helper methods for parsing alternative paths and sequences of other parsers.
Fields
state: S
Methods
impl<'a, P, E> ParseMaster<P, E> where
P: Point,
E: Recoverable,
[src]
impl<'a, P, E> ParseMaster<P, E> where
P: Point,
E: Recoverable,
pub fn new() -> ParseMaster<P, E, ()>
[src]
pub fn new() -> ParseMaster<P, E, ()>
impl<'a, P, E, S> ParseMaster<P, E, S> where
P: Point,
E: Recoverable,
[src]
impl<'a, P, E, S> ParseMaster<P, E, S> where
P: Point,
E: Recoverable,
pub fn with_state(state: S) -> ParseMaster<P, E, S>
[src]
pub fn with_state(state: S) -> ParseMaster<P, E, S>
pub fn optional<T, F>(
&mut self,
point: P,
parser: F
) -> Progress<P, Option<T>, E> where
F: FnOnce(&mut ParseMaster<P, E, S>, P) -> Progress<P, T, E>,
[src]
pub fn optional<T, F>(
&mut self,
point: P,
parser: F
) -> Progress<P, Option<T>, E> where
F: FnOnce(&mut ParseMaster<P, E, S>, P) -> Progress<P, T, E>,
Returns the value on success, or rewinds the point and returns
None
on a recoverable failure. Non-recoverable failures are
propagated.
pub fn alternate<'pm, T>(&'pm mut self, pt: P) -> Alternate<'pm, P, T, E, S>
[src]
pub fn alternate<'pm, T>(&'pm mut self, pt: P) -> Alternate<'pm, P, T, E, S>
Run sub-parsers in order until one succeeds.
pub fn zero_or_more<F, T>(
&mut self,
point: P,
parser: F
) -> Progress<P, Vec<T>, E> where
F: FnMut(&mut ParseMaster<P, E, S>, P) -> Progress<P, T, E>,
[src]
pub fn zero_or_more<F, T>(
&mut self,
point: P,
parser: F
) -> Progress<P, Vec<T>, E> where
F: FnMut(&mut ParseMaster<P, E, S>, P) -> Progress<P, T, E>,
Runs the parser until it fails.
If the parser fails due to a recoverable error, a collection of values will be returned and the point will be at the end of the last successful parse. If the error is not recoverable, the error will be passed through directly.
pub fn finish<T>(
&mut self,
progress: Progress<P, T, E>
) -> Progress<P, T, Vec<E>>
[src]
pub fn finish<T>(
&mut self,
progress: Progress<P, T, E>
) -> Progress<P, T, Vec<E>>
When parsing is complete, provide the final result and gain access to all failures. Will be recycled and may be used for further parsing.
Trait Implementations
impl<P: Debug, E: Debug, S: Debug> Debug for ParseMaster<P, E, S>
[src]
impl<P: Debug, E: Debug, S: Debug> Debug for ParseMaster<P, E, S>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<P: PartialEq, E: PartialEq, S: PartialEq> PartialEq for ParseMaster<P, E, S>
[src]
impl<P: PartialEq, E: PartialEq, S: PartialEq> PartialEq for ParseMaster<P, E, S>
fn eq(&self, other: &ParseMaster<P, E, S>) -> bool
[src]
fn eq(&self, other: &ParseMaster<P, E, S>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &ParseMaster<P, E, S>) -> bool
[src]
fn ne(&self, other: &ParseMaster<P, E, S>) -> bool
This method tests for !=
.
Auto Trait Implementations
impl<P, E, S> Send for ParseMaster<P, E, S> where
E: Send,
P: Send,
S: Send,
impl<P, E, S> Send for ParseMaster<P, E, S> where
E: Send,
P: Send,
S: Send,
impl<P, E, S> Sync for ParseMaster<P, E, S> where
E: Sync,
P: Sync,
S: Sync,
impl<P, E, S> Sync for ParseMaster<P, E, S> where
E: Sync,
P: Sync,
S: Sync,