Going to try to make the functions in the context more generic.
This commit is contained in:
@@ -25,7 +25,6 @@ use nom::IResult;
|
||||
|
||||
use super::nom_context::NomContext;
|
||||
use super::parser_with_context::parser_with_context;
|
||||
use super::text_element_parser::paragraph;
|
||||
|
||||
pub type Res<T, U> = IResult<T, U, VerboseError<T>>;
|
||||
|
||||
@@ -129,17 +128,12 @@ pub fn link_end(input: &str) -> Res<&str, TextElement> {
|
||||
map(symbol("]"), TextElement::Symbol)(input)
|
||||
}
|
||||
|
||||
// pub fn paragraph(input: &str) -> Res<&str, (Vec<TextElement>, &str)> {
|
||||
// // let initial_context = NomContext::new(¶graph_end);
|
||||
// // many_till(text_element(initial_context), paragraph_end)(input)
|
||||
// todo!()
|
||||
// }
|
||||
|
||||
pub fn paragraph_end(input: &str) -> Res<&str, &str> {
|
||||
recognize(tuple((map(line_break, TextElement::LineBreak), blank_line)))(input)
|
||||
}
|
||||
|
||||
pub fn document(input: &str) -> Res<&str, Vec<(Vec<TextElement>, &str)>> {
|
||||
let initial_context = NomContext::new(¶graph_end);
|
||||
many1(parser_with_context!(paragraph)(initial_context))(input)
|
||||
todo!()
|
||||
// many1(parser_with_context!(paragraph)(initial_context))(input)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user