organic/src/parser/parser_with_context.rs
2022-07-16 17:52:04 -04:00

12 lines
400 B
Rust

macro_rules! parser_with_context {
($name:ident,$typ:ty,$inp:ident,$context:ident,$fnbody:block) => {
pub fn $name<I: Clone, O, E: nom::error::ParseError<I>>(
$context: &mut NomContext<I, O, E>,
) -> impl for<'a> FnMut(&'a str) -> IResult<&'a str, $typ, VerboseError<&'a str>> {
|$inp: &str| $fnbody
}
};
}
pub(crate) use parser_with_context;