Adding lifetimes.
This commit is contained in:
parent
0cd3300444
commit
112aba3137
@ -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,
|
||||
|
@ -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!()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user