organic/src/parser/parser_with_context.rs

15 lines
454 B
Rust
Raw Normal View History

2022-07-16 03:26:49 +00:00
macro_rules! parser_with_context {
($name:ident,$typ:ty,$inp:ident,$context:ident,$fnbody:block) => {
pub fn $name<F>(
$context: &NomContext<F>,
) -> impl for<'a> FnMut(&'a str) -> IResult<&'a str, $typ, VerboseError<&'a str>> + '_
where
F: for<'a> nom::Parser<&'a str, &'a str, VerboseError<&'a str>>,
{
|$inp: &str| $fnbody
}
};
}
pub(crate) use parser_with_context;