Lifetime issue not general enough.

This commit is contained in:
Tom Alexander 2022-10-15 14:28:24 -04:00
parent 1d571acc17
commit 30042ddcfe
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 17 additions and 0 deletions

View File

@ -49,6 +49,15 @@ impl<'r> NomContext<'r> {
} }
} }
pub fn without_bold(&self, other: MatcherRef) -> NomContext {
NomContext {
parent: Some(&self),
fail_matcher: ChainBehavior::AndParent(Some(other)),
match_bold_allowed: false,
match_link_allowed: self.match_link_allowed,
}
}
pub fn not_matching_fail<'s>(&self, i: &'s str) -> IResult<&'s str, (), VerboseError<&'s str>> { pub fn not_matching_fail<'s>(&self, i: &'s str) -> IResult<&'s str, (), VerboseError<&'s str>> {
not(FailChecker::new(self))(i) not(FailChecker::new(self))(i)
} }

View File

@ -1,4 +1,7 @@
//! A single element of text. //! A single element of text.
use std::cell::RefCell;
use std::rc::Rc;
use crate::parser::parser_with_context::parser_with_context; use crate::parser::parser_with_context::parser_with_context;
use crate::parser::text::paragraph_end; use crate::parser::text::paragraph_end;
@ -34,6 +37,11 @@ fn flat_text_element<'s, 'r>(i: &'s str, context: &'r NomContext) -> Res<&'s str
))(i) ))(i)
} }
fn flat_bold<'s, 'r>(i: &'s str, context: &'r NomContext) -> Res<&'s str, TextElement<'s>> {
let new_context = context.without_bold(Rc::new(RefCell::new(recognize(bold_end))));
todo!()
}
pub fn paragraph<'s, 'r>( pub fn paragraph<'s, 'r>(
i: &'s str, i: &'s str,
context: &'r NomContext, context: &'r NomContext,