Move trailing whitespace parsing to a separate element.

I still need to parse the line break at the end of elements.
This commit is contained in:
Tom Alexander
2023-03-31 11:16:37 -04:00
parent 602cf4c374
commit 707eac5bf8
5 changed files with 42 additions and 5 deletions

View File

@@ -77,6 +77,15 @@ pub fn blank_line(input: &str) -> Res<&str, &str> {
recognize(tuple((space0, alt((line_ending, eof)))))(input)
}
#[tracing::instrument(ret, level = "debug")]
pub fn element_trailing_whitespace<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, &'s str> {
start_of_line(context, input)?;
alt((eof, recognize(many0(blank_line))))(input)
}
#[tracing::instrument(ret, level = "debug")]
pub fn trailing_whitespace(input: &str) -> Res<&str, &str> {
alt((eof, recognize(tuple((line_ending, many0(blank_line))))))(input)