use crate::{representation::Representation, Parser, ParserExtension}; pub fn map(parser: P, map_fn: F) -> impl Parser where P: Parser, F: Fn(O1) -> O2, { let production = parser.representation().production(); (move |input| { parser .parse(input) .map(|(result, rest)| (map_fn(result), rest)) }) .to_anno() .with_repr(Representation::new().with_production(production)) }