Ran into a bigger issue.

This commit is contained in:
Tom Alexander 2023-04-14 20:17:53 -04:00
parent 8549a6b0db
commit be64eb92af
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -58,6 +58,7 @@ pub fn plain_list<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s s
Consume, additional item Consume, additional item
*/ */
{ {
// Don't consume, yes exit matcher
let span = span!(tracing::Level::DEBUG, "first"); let span = span!(tracing::Level::DEBUG, "first");
let _enter = span.enter(); let _enter = span.enter();
@ -76,6 +77,7 @@ pub fn plain_list<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s s
} }
{ {
// Consume, additional item
let span = span!(tracing::Level::DEBUG, "second"); let span = span!(tracing::Level::DEBUG, "second");
let _enter = span.enter(); let _enter = span.enter();
@ -97,10 +99,10 @@ pub fn plain_list<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s s
} }
{ {
// Don't consume, no additional item
let span = span!(tracing::Level::DEBUG, "third"); let span = span!(tracing::Level::DEBUG, "third");
let _enter = span.enter(); let _enter = span.enter();
// If its not (don't consume, exit) and its not (consume, see another item) then it must be (don't consume, no additional item)
let last_item_then_exit = without_consume_matcher(remaining); let last_item_then_exit = without_consume_matcher(remaining);
match last_item_then_exit { match last_item_then_exit {
Ok((remain, item)) Ok((remain, item))
@ -157,7 +159,7 @@ pub fn plain_list_item<'r, 's>(
})); }));
let with_consume_matcher = parser_with_context!(element)(&with_consume_context); let with_consume_matcher = parser_with_context!(element)(&with_consume_context);
let without_consume_matcher = parser_with_context!(element)(&with_consume_context); let without_consume_matcher = parser_with_context!(element)(&without_consume_context);
let exit_matcher = parser_with_context!(exit_matcher_parser)(&with_consume_context); let exit_matcher = parser_with_context!(exit_matcher_parser)(&with_consume_context);
let (remaining, bull) = let (remaining, bull) =
verify(bullet, |bull: &str| bull != "*" || indent_level > 0)(remaining)?; verify(bullet, |bull: &str| bull != "*" || indent_level > 0)(remaining)?;