Exit text markup if the parent exit matcher is triggering.

This commit is contained in:
Tom Alexander 2023-04-24 17:16:07 -04:00
parent ed174c1c41
commit 90a47b7b49
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 20 additions and 9 deletions

View File

@ -12,6 +12,7 @@ use nom::combinator::recognize;
use nom::combinator::verify;
use nom::multi::many_till;
use nom::sequence::terminated;
use tracing::span;
use super::Context;
use crate::error::CustomError;
@ -131,11 +132,15 @@ fn _text_markup_object<'r, 's, 'x>(
|(children, _exit_contents)| !children.is_empty(),
)(remaining)?;
{
let span = span!(tracing::Level::DEBUG, "Checking parent exit.");
let _enter = span.enter();
if exit_matcher_parser(context, remaining).is_ok() {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Parent exit matcher is triggering.",
))));
}
}
// TODO: Sometimes its plain text, not objects
let (remaining, _close) = text_markup_end_specialized(context, remaining)?;
@ -174,11 +179,15 @@ fn _text_markup_string<'r, 's, 'x>(
|(children, _exit_contents)| !children.is_empty(),
))(remaining)?;
{
let span = span!(tracing::Level::DEBUG, "Checking parent exit.");
let _enter = span.enter();
if exit_matcher_parser(context, remaining).is_ok() {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Parent exit matcher is triggering.",
))));
}
}
// TODO: Sometimes its plain text, not objects
let (remaining, _close) = text_markup_end_specialized(context, remaining)?;

View File

@ -1 +1,3 @@
*nesting *bold entrances* and* exits
foo *bar /baz *lorem* ipsum/ dolar* alpha
foo *bar /baz _lorem_ ipsum/ dolar* alpha