diff --git a/src/parser/nom_context.rs b/src/parser/nom_context.rs index efa431ee..1dab499d 100644 --- a/src/parser/nom_context.rs +++ b/src/parser/nom_context.rs @@ -3,15 +3,17 @@ use nom::error::VerboseError; use nom::IResult; #[derive(Clone)] -pub struct NomContext { - pub fail_matcher: &dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>, +pub struct NomContext<'a> { + pub fail_matcher: &'a dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>, /// You can't have nested bolds or links in org-mode pub can_match_bold: bool, pub can_match_link: bool, } -impl NomContext { - pub fn new(fail_matcher: &dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>) -> Self { +impl<'a> NomContext<'a> { + pub fn new( + fail_matcher: &'a dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>, + ) -> Self { NomContext { fail_matcher, can_match_bold: true, diff --git a/src/parser/text_element_parser.rs b/src/parser/text_element_parser.rs index 3c64f949..a51e3bc3 100644 --- a/src/parser/text_element_parser.rs +++ b/src/parser/text_element_parser.rs @@ -20,3 +20,10 @@ use nom::error::VerboseError; use nom::multi::many_till; use nom::sequence::tuple; use nom::IResult; + +fn flat_text_element<'s, 'r>( + i: &'s str, + context: &'r mut NomContext, +) -> Res<&'s str, TextElement<'s>> { + todo!() +}