From 6fdd613bed287c024157ba350341dc9b4a5ab62f Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 10 Apr 2023 12:13:31 -0400 Subject: [PATCH] Cleanup. --- src/parser/document.rs | 2 -- src/parser/element.rs | 21 --------------------- src/parser/footnote_definition.rs | 4 ---- src/parser/greater_block.rs | 1 - src/parser/paragraph.rs | 2 -- src/parser/parser_context.rs | 1 - 6 files changed, 31 deletions(-) diff --git a/src/parser/document.rs b/src/parser/document.rs index 99eb460..cd12174 100644 --- a/src/parser/document.rs +++ b/src/parser/document.rs @@ -2,7 +2,6 @@ use nom::branch::alt; use nom::bytes::complete::tag; use nom::character::complete::line_ending; use nom::character::complete::space1; -use nom::combinator::eof; use nom::combinator::map; use nom::combinator::not; use nom::combinator::opt; @@ -20,7 +19,6 @@ use crate::parser::parser_context::ChainBehavior; use crate::parser::parser_context::ContextElement; use crate::parser::parser_context::ContextTree; use crate::parser::parser_context::ExitMatcherNode; -use crate::parser::util::element_trailing_whitespace; use crate::parser::util::maybe_consume_trailing_whitespace; use super::element::Element; diff --git a/src/parser/element.rs b/src/parser/element.rs index 902b2a4..f92a106 100644 --- a/src/parser/element.rs +++ b/src/parser/element.rs @@ -9,7 +9,6 @@ use super::paragraph::paragraph; use super::plain_list::plain_list; use super::source::Source; use super::Context; -use crate::parser::parser_context::ContextElement; use crate::parser::parser_with_context::parser_with_context; use nom::branch::alt; use nom::combinator::map; @@ -33,26 +32,6 @@ impl<'s> Source<'s> for Element<'s> { } } -#[tracing::instrument(ret, level = "debug")] -pub fn element_with_whitespace<'r, 's>( - context: Context<'r, 's>, - input: &'s str, -) -> Res<&'s str, Element<'s>> { - let parser_context = - context.with_additional_node(ContextElement::ConsumeTrailingWhitespace(true)); - element(&parser_context, input) -} - -#[tracing::instrument(ret, level = "debug")] -pub fn element_without_whitespace<'r, 's>( - context: Context<'r, 's>, - input: &'s str, -) -> Res<&'s str, Element<'s>> { - let parser_context = - context.with_additional_node(ContextElement::ConsumeTrailingWhitespace(false)); - element(&parser_context, input) -} - #[tracing::instrument(ret, level = "debug")] pub fn element<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Element<'s>> { let non_paragraph_matcher = parser_with_context!(non_paragraph_element)(context); diff --git a/src/parser/footnote_definition.rs b/src/parser/footnote_definition.rs index a16159a..0c7f714 100644 --- a/src/parser/footnote_definition.rs +++ b/src/parser/footnote_definition.rs @@ -8,20 +8,16 @@ use crate::parser::parser_context::ContextElement; use crate::parser::parser_context::ExitMatcherNode; use crate::parser::parser_with_context::parser_with_context; use crate::parser::util::blank_line; -use crate::parser::util::element_trailing_whitespace; use crate::parser::util::exit_matcher_parser; use crate::parser::util::get_consumed; use crate::parser::util::maybe_consume_trailing_whitespace; use crate::parser::util::start_of_line; -use crate::parser::util::whitespace_eof; use nom::branch::alt; use nom::bytes::complete::tag; use nom::bytes::complete::tag_no_case; use nom::bytes::complete::take_while; use nom::character::complete::digit1; -use nom::character::complete::multispace0; use nom::character::complete::space0; -use nom::combinator::opt; use nom::combinator::recognize; use nom::combinator::verify; use nom::multi::many1; diff --git a/src/parser/greater_block.rs b/src/parser/greater_block.rs index 8408740..8e324a7 100644 --- a/src/parser/greater_block.rs +++ b/src/parser/greater_block.rs @@ -8,7 +8,6 @@ use crate::parser::parser_context::ChainBehavior; use crate::parser::parser_context::ContextElement; use crate::parser::parser_context::ExitMatcherNode; use crate::parser::parser_with_context::parser_with_context; -use crate::parser::util::element_trailing_whitespace; use crate::parser::util::exit_matcher_parser; use crate::parser::util::get_consumed; use crate::parser::util::maybe_consume_trailing_whitespace; diff --git a/src/parser/paragraph.rs b/src/parser/paragraph.rs index 9922f8b..4a9a60e 100644 --- a/src/parser/paragraph.rs +++ b/src/parser/paragraph.rs @@ -1,6 +1,5 @@ use nom::branch::alt; use nom::combinator::eof; -use nom::combinator::opt; use nom::combinator::recognize; use nom::combinator::verify; use nom::multi::many1; @@ -12,7 +11,6 @@ use crate::parser::parser_context::ChainBehavior; use crate::parser::parser_context::ContextElement; use crate::parser::parser_context::ExitMatcherNode; use crate::parser::parser_with_context::parser_with_context; -use crate::parser::util::element_trailing_whitespace; use crate::parser::util::exit_matcher_parser; use crate::parser::util::maybe_consume_trailing_whitespace; use crate::parser::util::start_of_line; diff --git a/src/parser/parser_context.rs b/src/parser/parser_context.rs index 2810347..24d988d 100644 --- a/src/parser/parser_context.rs +++ b/src/parser/parser_context.rs @@ -1,6 +1,5 @@ use std::rc::Rc; -use nom::combinator::eof; use nom::IResult; use crate::parser::util::whitespace_eof;