Do not consume trailing whitespace if the parent exit matcher is matching.
This commit is contained in:
@@ -92,6 +92,21 @@ pub fn element_trailing_whitespace<'r, 's>(
|
||||
alt((eof, recognize(many0(blank_line))))(input)
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
pub fn maybe_consume_trailing_whitespace_if_not_exiting<'r, 's>(
|
||||
context: Context<'r, 's>,
|
||||
input: &'s str,
|
||||
) -> Res<&'s str, Option<&'s str>> {
|
||||
if context.should_consume_trailing_whitespace() && exit_matcher_parser(context, input).is_err()
|
||||
{
|
||||
Ok(opt(parser_with_context!(element_trailing_whitespace)(
|
||||
context,
|
||||
))(input)?)
|
||||
} else {
|
||||
Ok((input, None))
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
pub fn maybe_consume_trailing_whitespace<'r, 's>(
|
||||
context: Context<'r, 's>,
|
||||
|
||||
Reference in New Issue
Block a user