Struct pahs::ParseDriver [−][src]
Maintains (optional) parsing state/context and serves as an easy entry point for some of the combinators.
Fields
state: S
The parser state
Implementations
impl ParseDriver<()>
[src]
impl<S> ParseDriver<S>
[src]
pub fn with_state(state: S) -> Self
[src]
Creates a new ParseDriver
with state
as initial state.
pub fn optional<P, T, E, F>(
&mut self,
pos: P,
parser: F
) -> Progress<P, Option<T>, E> where
P: Pos,
E: Recoverable,
F: FnOnce(&mut ParseDriver<S>, P) -> Progress<P, T, E>,
[src]
&mut self,
pos: P,
parser: F
) -> Progress<P, Option<T>, E> where
P: Pos,
E: Recoverable,
F: FnOnce(&mut ParseDriver<S>, P) -> Progress<P, T, E>,
Wraps the specified parser
, making it optional.
If parser
was successful, the value is mapped to Some(value)
.
Recoverable failures are mapped to successes, with None
as value.
Irrecoverable failures stay that way.
pub fn alternate<P, T, E>(
&mut self,
pos: P
) -> Alternate<'_, P, T, E, S, LastErrorOnly<E>> where
P: Pos,
E: Recoverable,
[src]
&mut self,
pos: P
) -> Alternate<'_, P, T, E, S, LastErrorOnly<E>> where
P: Pos,
E: Recoverable,
Tries all parsers supplied via one
, in order,
until one matches.
If none of the parsers were successful, returns the error of the
last run parser. If you want to retrieve the errors of the other parsers as well,
see alternate_accumulate_errors
.
See Alternate
.
pub fn alternate_accumulate_errors<P, T, E, A>(
&mut self,
pos: P,
error_accumulator: A
) -> Alternate<'_, P, T, E, S, A> where
P: Pos,
E: Recoverable,
A: ErrorAccumulator<P, E>,
[src]
&mut self,
pos: P,
error_accumulator: A
) -> Alternate<'_, P, T, E, S, A> where
P: Pos,
E: Recoverable,
A: ErrorAccumulator<P, E>,
Trait Implementations
impl<S: Debug> Debug for ParseDriver<S>
[src]
impl Default for ParseDriver<()>
[src]
Auto Trait Implementations
impl<S> RefUnwindSafe for ParseDriver<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for ParseDriver<S> where
S: Send,
S: Send,
impl<S> Sync for ParseDriver<S> where
S: Sync,
S: Sync,
impl<S> Unpin for ParseDriver<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for ParseDriver<S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,