diff --git a/src/parser/combinator.rs b/src/parser/combinator.rs deleted file mode 100644 index ceab6c8..0000000 --- a/src/parser/combinator.rs +++ /dev/null @@ -1,38 +0,0 @@ -use nom::error::ParseError; -use nom::IResult; -use nom::InputLength; - -use super::Context; - -pub fn context_many1<'r: 's, 's, I, O, E, M>( - context: Context<'r, 's>, - mut many_matcher: M, -) -> impl FnMut(I) -> IResult, E> + 'r -where - I: Clone + InputLength, - E: ParseError, - M: for<'x> Fn(Context<'x, 's>, I) -> IResult + 'r, -{ - move |mut i: I| { - let mut err = None; - let mut elements: Vec = Vec::new(); - loop { - match many_matcher(&context, i.clone()) { - Ok((remaining, many_elem)) => { - i = remaining; - elements.push(many_elem); - } - the_error @ Err(_) => { - err = Some(the_error); - break; - } - } - } - if elements.is_empty() { - if let Some(err) = err { - err?; - } - } - Ok((i, elements)) - } -} diff --git a/src/parser/document.rs b/src/parser/document.rs index 7c002c8..33f683d 100644 --- a/src/parser/document.rs +++ b/src/parser/document.rs @@ -25,7 +25,6 @@ use crate::parser::util::element_trailing_whitespace; use super::element::Element; use super::error::Res; use super::object::Object; -use super::parser_context; use super::parser_with_context::parser_with_context; use super::source::Source; use super::util::exit_matcher_parser; diff --git a/src/parser/error.rs b/src/parser/error.rs index abe5d86..eb23965 100644 --- a/src/parser/error.rs +++ b/src/parser/error.rs @@ -18,7 +18,7 @@ impl ParseError for CustomError { CustomError::Nom(input, kind) } - fn append(input: I, kind: ErrorKind, mut other: Self) -> Self { + fn append(_input: I, _kind: ErrorKind, mut other: Self) -> Self { // Doesn't do append like VerboseError other } diff --git a/src/parser/mod.rs b/src/parser/mod.rs index bb384e4..276be7d 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -1,4 +1,3 @@ -mod combinator; mod document; mod element; mod error; diff --git a/src/parser/object.rs b/src/parser/object.rs index 50afeb4..36162a6 100644 --- a/src/parser/object.rs +++ b/src/parser/object.rs @@ -9,8 +9,12 @@ use super::Context; #[derive(Debug)] pub enum Object<'s> { + #[allow(dead_code)] TextMarkup(TextMarkup<'s>), + PlainText(PlainText<'s>), + + #[allow(dead_code)] RegularLink(RegularLink<'s>), } diff --git a/src/parser/paragraph.rs b/src/parser/paragraph.rs index bea0908..a6af51d 100644 --- a/src/parser/paragraph.rs +++ b/src/parser/paragraph.rs @@ -20,7 +20,6 @@ use super::error::Res; use super::lesser_element::Paragraph; use super::util::blank_line; use super::util::get_consumed; -use super::util::trailing_whitespace; use super::Context; #[tracing::instrument(ret, level = "debug")] diff --git a/src/parser/parser_context.rs b/src/parser/parser_context.rs index 8618e0e..5070d03 100644 --- a/src/parser/parser_context.rs +++ b/src/parser/parser_context.rs @@ -8,7 +8,6 @@ use super::error::MyError; use super::error::Res; use super::list::List; use super::list::Node; -use super::util::always_fail; use super::Context; type Matcher = dyn for<'r, 's> Fn(Context<'r, 's>, &'s str) -> Res<&'s str, &'s str>; @@ -139,7 +138,8 @@ pub struct ExitMatcherNode<'r> { #[derive(Clone)] pub enum ChainBehavior<'r> { AndParent(Option<&'r Matcher>), - #[allow(dead_code)] + + #[allow(dead_code)] // Will be used when inside code/quote blocks IgnoreParent(Option<&'r Matcher>), } diff --git a/src/parser/plain_list.rs b/src/parser/plain_list.rs index 9911f3f..f3e077f 100644 --- a/src/parser/plain_list.rs +++ b/src/parser/plain_list.rs @@ -12,19 +12,15 @@ use crate::parser::parser_context::ContextElement; use crate::parser::parser_context::ExitMatcherNode; use crate::parser::util::exit_matcher_parser; use crate::parser::util::get_consumed; -use crate::parser::util::regurgitate; use crate::parser::util::start_of_line; -use crate::parser::util::trailing_whitespace; use nom::branch::alt; use nom::bytes::complete::tag; use nom::character::complete::digit1; -use nom::character::complete::line_ending; use nom::character::complete::one_of; use nom::character::complete::space0; use nom::combinator::eof; use nom::combinator::recognize; use nom::combinator::verify; -use nom::multi::many0; use nom::multi::many_till; use nom::sequence::tuple;