organic/src/parser/parser_with_context.rs

12 lines
407 B
Rust
Raw Normal View History

2022-07-15 23:26:49 -04:00
macro_rules! parser_with_context {
2022-07-16 18:18:41 -04:00
($name:ident,$typ:ty,$inp:ident,$context:ident,$fnbody:block) => {
2022-07-16 18:09:43 -04:00
pub fn $name<'c, I: Clone, O, E: nom::error::ParseError<I>>(
$context: &mut NomContext<'c, I, O, E>,
2022-07-16 18:18:41 -04:00
) -> impl for<'a> FnMut(&'a str) -> IResult<&'a str, $typ, VerboseError<&'a str>> + 'c {
|$inp| $fnbody
2022-07-15 23:26:49 -04:00
}
};
}
pub(crate) use parser_with_context;