Cleaning up.

This commit is contained in:
Tom Alexander
2022-07-16 21:36:06 -04:00
parent 8357837571
commit b3b2874cc2
4 changed files with 24 additions and 75 deletions

View File

@@ -3,7 +3,6 @@ use crate::parser::parser_with_context::parser_with_context;
use crate::parser::text::paragraph_end;
use super::nom_context::NomContext;
// use super::parser_with_context::parser_with_context;
use super::text::line_break;
use super::text::space;
use super::text::span;
@@ -17,30 +16,6 @@ use nom::error::VerboseError;
use nom::multi::many_till;
use nom::IResult;
// parser_with_context!(text_element, TextElement, i, context, {
// // not(|j| {
// // // tood
// // (context.fail_matcher)(j)
// // })(i)?;
// // not(|i| (context.fail_matcher)(i))(i)?;
// alt((
// // map(
// // BoldParser::new(slf.context.fail_matcher.clone()),
// // TextElement::Bold,
// // ),
// // map(
// // LinkParser::new(slf.context.fail_matcher.clone()),
// // TextElement::Link,
// // ),
// map(span, TextElement::Span),
// map(symbol("*"), TextElement::Symbol),
// map(symbol("["), TextElement::Symbol),
// map(symbol("]"), TextElement::Symbol),
// map(space, TextElement::Space),
// map(line_break, TextElement::LineBreak),
// ))(i)
// });
pub fn flat_text_element<'a, F>(
i: &'a str,
context: &mut NomContext<F>,
@@ -48,9 +23,23 @@ pub fn flat_text_element<'a, F>(
where
F: for<'b> FnMut(&'b str) -> IResult<&'b str, &'b str, VerboseError<&'b str>>,
{
// not(context.fail_matcher)(i)?;
// todo
todo!()
not(&mut context.fail_matcher)(i)?;
alt((
// map(
// BoldParser::new(slf.context.fail_matcher.clone()),
// TextElement::Bold,
// ),
// map(
// LinkParser::new(slf.context.fail_matcher.clone()),
// TextElement::Link,
// ),
map(span, TextElement::Span),
map(symbol("*"), TextElement::Symbol),
map(symbol("["), TextElement::Symbol),
map(symbol("]"), TextElement::Symbol),
map(space, TextElement::Space),
map(line_break, TextElement::LineBreak),
))(i)
}
pub fn paragraph(input: &str) -> Res<&str, (Vec<TextElement>, &str)> {