Struct expry::parser::ParserState
source · [−]pub struct ParserState<'b, T, E, Context = ()> where
T: PartialEq + Debug, {
pub reader: &'b str,
pub context: Context,
/* private fields */
}
Fields
reader: &'b str
context: Context
Implementations
sourceimpl<'b, T, E, Context> ParserState<'b, T, E, Context> where
T: PartialEq + Copy + Clone + Debug,
E: Copy + Clone + Debug,
impl<'b, T, E, Context> ParserState<'b, T, E, Context> where
T: PartialEq + Copy + Clone + Debug,
E: Copy + Clone + Debug,
pub fn repeat<P>(&mut self, path: P) -> ParserResult<(), E> where
P: FnMut(&mut Self) -> ParserResult<bool, E>,
pub fn opt<S, P>(&mut self, path: P) -> ParserResult<Option<S>, E> where
P: FnOnce(&mut Self) -> ParserResult<S, E>,
pub fn choose<S>(
&mut self,
paths: &[fn(reader: &mut ParserState<'b, T, E, Context>) -> ParserResult<S, E>],
err: fn() -> E
) -> ParserResult<S, E>
pub fn choose_with_state<S, State>(
&mut self,
paths: &[fn(parser: &mut ParserState<'b, T, E, Context>, state: &mut State) -> ParserResult<S, E>],
state: &mut State,
err: fn() -> E
) -> ParserResult<S, E>
pub fn accept<F>(
&mut self,
expected: T,
info: Option<&TokenInfo>,
err: F
) -> ParserResult<TokenInfo, E> where
F: Fn() -> E,
pub fn get(&mut self) -> ParserResult<(T, TokenInfo), E>
pub fn undo_get(&mut self, token: T, info: TokenInfo)
pub fn error_token<F>(
&mut self,
token: T,
info: TokenInfo,
err: F
) -> ParserStatus<E> where
F: FnOnce(&mut Self) -> E,
pub fn error_other(&mut self, info: &TokenInfo, err: E) -> ParserStatus<E>
pub fn token_info(&mut self) -> ParserResult<TokenInfo, E>
pub fn context(&mut self) -> &mut Context
pub fn new_with(
reader: &'b str,
tokenize: fn(reader: &mut &'b str, context: &mut Context) -> Result<(T, usize), (E, usize, usize)>,
context: Context
) -> Self
pub fn parse<R>(
&mut self,
f: fn(_: &mut Self) -> ParserResult<R, E>,
unexpected_token: E,
depth_limit_reached: E
) -> Result<R, (E, usize, usize, Option<(usize, usize)>)>
Trait Implementations
Auto Trait Implementations
impl<'b, T, E, Context> RefUnwindSafe for ParserState<'b, T, E, Context> where
Context: RefUnwindSafe,
T: RefUnwindSafe,
impl<'b, T, E, Context> Send for ParserState<'b, T, E, Context> where
Context: Send,
T: Send,
impl<'b, T, E, Context> Sync for ParserState<'b, T, E, Context> where
Context: Sync,
T: Sync,
impl<'b, T, E, Context> Unpin for ParserState<'b, T, E, Context> where
Context: Unpin,
T: Unpin,
impl<'b, T, E, Context> UnwindSafe for ParserState<'b, T, E, Context> where
Context: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more