Compare commits

..

No commits in common. "a29973a110f81482a0459239bfd9a447a51523f2" and "129228c5c5d6f8b47165d3f4d33588d8aeee837f" have entirely different histories.

5 changed files with 7 additions and 27 deletions

View File

@ -33,10 +33,6 @@ release:
clean:
> cargo clean
.PHONY: format
format:
> $(MAKE) -C docker/cargo_fmt run
.PHONY: test
test:
> cargo test --no-default-features --features compare --no-fail-fast --lib --test test_loader -- --test-threads $(TESTJOBS)

View File

@ -1 +0,0 @@
foo ** bar ** baz

View File

@ -1 +0,0 @@
foo ~~ bar ~~ baz

View File

@ -59,10 +59,6 @@ impl<'s> OrgSource<'s> {
self.end - self.start
}
pub(crate) fn get_byte_offset(&self) -> usize {
self.start
}
pub(crate) fn get_preceding_character(&self) -> Option<char> {
self.preceding_character
}

View File

@ -163,7 +163,8 @@ fn text_markup_object<'c>(
OrgSource<'s>,
) -> Res<OrgSource<'s>, Vec<Object<'s>>>
+ 'c {
move |context, input: OrgSource<'_>| _text_markup_object(context, input, marker_symbol)
let marker_symbol = marker_symbol.to_owned();
move |context, input: OrgSource<'_>| _text_markup_object(context, input, marker_symbol.as_str())
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
@ -182,7 +183,7 @@ fn _text_markup_object<'b, 'g, 'r, 's, 'c>(
let (remaining, open) = tag(marker_symbol)(remaining)?;
let (remaining, _peek_not_whitespace) =
peek(verify(anychar, |c| !c.is_whitespace() && *c != '\u{200B}'))(remaining)?;
let text_markup_end_specialized = text_markup_end(open.into(), remaining.get_byte_offset());
let text_markup_end_specialized = text_markup_end(open.into());
let contexts = [
ContextElement::ContextObject(marker_symbol),
ContextElement::ExitMatcherNode(ExitMatcherNode {
@ -244,7 +245,7 @@ fn _text_markup_string<'b, 'g, 'r, 's, 'c>(
let (remaining, open) = tag(marker_symbol)(remaining)?;
let (remaining, _peek_not_whitespace) =
peek(verify(anychar, |c| !c.is_whitespace() && *c != '\u{200B}'))(remaining)?;
let text_markup_end_specialized = text_markup_end(open.into(), remaining.get_byte_offset());
let text_markup_end_specialized = text_markup_end(open.into());
let contexts = [
ContextElement::ContextObject(marker_symbol),
ContextElement::ExitMatcherNode(ExitMatcherNode {
@ -315,13 +316,8 @@ fn post<'b, 'g, 'r, 's>(
Ok((remaining, ()))
}
fn text_markup_end<'c>(
marker_symbol: &'c str,
contents_start_offset: usize,
) -> impl ContextMatcher + 'c {
move |context, input: OrgSource<'_>| {
_text_markup_end(context, input, marker_symbol, contents_start_offset)
}
fn text_markup_end<'c>(marker_symbol: &'c str) -> impl ContextMatcher + 'c {
move |context, input: OrgSource<'_>| _text_markup_end(context, input, marker_symbol)
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
@ -329,13 +325,7 @@ fn _text_markup_end<'b, 'g, 'r, 's, 'c>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
marker_symbol: &'c str,
contents_start_offset: usize,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
if input.get_byte_offset() == contents_start_offset {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Text markup cannot be empty".into(),
))));
}
not(preceded_by_whitespace(false))(input)?;
let (remaining, _marker) = terminated(
tag(marker_symbol),
@ -435,7 +425,7 @@ fn _rematch_text_markup_object<'b, 'g, 'r, 's, 'x>(
let (remaining, _) = pre(context, input)?;
let (remaining, open) = tag(marker_symbol)(remaining)?;
let (remaining, _peek_not_whitespace) = peek(not(multispace1))(remaining)?;
let text_markup_end_specialized = text_markup_end(open.into(), remaining.get_byte_offset());
let text_markup_end_specialized = text_markup_end(open.into());
let parser_context = ContextElement::ExitMatcherNode(ExitMatcherNode {
class: ExitClass::Gamma,
exit_matcher: &text_markup_end_specialized,