Adding lifetimes.
This commit is contained in:
parent
0cd3300444
commit
112aba3137
@ -3,15 +3,17 @@ use nom::error::VerboseError;
|
|||||||
use nom::IResult;
|
use nom::IResult;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct NomContext {
|
pub struct NomContext<'a> {
|
||||||
pub fail_matcher: &dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>,
|
pub fail_matcher: &'a dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>,
|
||||||
/// You can't have nested bolds or links in org-mode
|
/// You can't have nested bolds or links in org-mode
|
||||||
pub can_match_bold: bool,
|
pub can_match_bold: bool,
|
||||||
pub can_match_link: bool,
|
pub can_match_link: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NomContext {
|
impl<'a> NomContext<'a> {
|
||||||
pub fn new(fail_matcher: &dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>) -> Self {
|
pub fn new(
|
||||||
|
fail_matcher: &'a dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>,
|
||||||
|
) -> Self {
|
||||||
NomContext {
|
NomContext {
|
||||||
fail_matcher,
|
fail_matcher,
|
||||||
can_match_bold: true,
|
can_match_bold: true,
|
||||||
|
@ -20,3 +20,10 @@ use nom::error::VerboseError;
|
|||||||
use nom::multi::many_till;
|
use nom::multi::many_till;
|
||||||
use nom::sequence::tuple;
|
use nom::sequence::tuple;
|
||||||
use nom::IResult;
|
use nom::IResult;
|
||||||
|
|
||||||
|
fn flat_text_element<'s, 'r>(
|
||||||
|
i: &'s str,
|
||||||
|
context: &'r mut NomContext,
|
||||||
|
) -> Res<&'s str, TextElement<'s>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user