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§
source§impl<'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>
sourcepub fn call<S>(
&mut self,
path: fn(reader: &mut ParserState<'b, T, E, Context>) -> ParserResult<S, E>
) -> ParserResult<S, E>
pub fn call<S>( &mut self, path: fn(reader: &mut ParserState<'b, T, E, Context>) -> ParserResult<S, E> ) -> ParserResult<S, E>
Useful for recursive functions (like for parsing negation and the unary minus).