Integrate plain list parser into the parser tree.

This commit is contained in:
Tom Alexander
2023-03-27 13:06:41 -04:00
parent 81a9a754de
commit 22a2ed29f1
4 changed files with 49 additions and 31 deletions

View File

@@ -11,6 +11,7 @@ use crate::parser::parser_context::ContextElement;
use crate::parser::parser_context::ExitMatcherNode;
use crate::parser::parser_with_context::parser_with_context;
use super::element::non_paragraph_element;
use super::error::Res;
use super::lesser_element::Paragraph;
use super::util::blank_line;
@@ -35,6 +36,10 @@ pub fn paragraph<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s st
}
fn paragraph_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
// TODO: Other elements should also end paragraphs
alt((recognize(tuple((line_ending, many1(blank_line)))), eof))(input)
let non_paragraph_element_matcher = parser_with_context!(non_paragraph_element)(context);
alt((
recognize(tuple((line_ending, many1(blank_line)))),
recognize(non_paragraph_element_matcher),
eof,
))(input)
}