This commit is contained in:
Tom Alexander 2023-04-10 12:13:31 -04:00
parent 9c832053d4
commit 6fdd613bed
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
6 changed files with 0 additions and 31 deletions

View File

@ -2,7 +2,6 @@ use nom::branch::alt;
use nom::bytes::complete::tag; use nom::bytes::complete::tag;
use nom::character::complete::line_ending; use nom::character::complete::line_ending;
use nom::character::complete::space1; use nom::character::complete::space1;
use nom::combinator::eof;
use nom::combinator::map; use nom::combinator::map;
use nom::combinator::not; use nom::combinator::not;
use nom::combinator::opt; 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::ContextElement;
use crate::parser::parser_context::ContextTree; use crate::parser::parser_context::ContextTree;
use crate::parser::parser_context::ExitMatcherNode; use crate::parser::parser_context::ExitMatcherNode;
use crate::parser::util::element_trailing_whitespace;
use crate::parser::util::maybe_consume_trailing_whitespace; use crate::parser::util::maybe_consume_trailing_whitespace;
use super::element::Element; use super::element::Element;

View File

@ -9,7 +9,6 @@ use super::paragraph::paragraph;
use super::plain_list::plain_list; use super::plain_list::plain_list;
use super::source::Source; use super::source::Source;
use super::Context; use super::Context;
use crate::parser::parser_context::ContextElement;
use crate::parser::parser_with_context::parser_with_context; use crate::parser::parser_with_context::parser_with_context;
use nom::branch::alt; use nom::branch::alt;
use nom::combinator::map; 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")] #[tracing::instrument(ret, level = "debug")]
pub fn element<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Element<'s>> { 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); let non_paragraph_matcher = parser_with_context!(non_paragraph_element)(context);

View File

@ -8,20 +8,16 @@ use crate::parser::parser_context::ContextElement;
use crate::parser::parser_context::ExitMatcherNode; use crate::parser::parser_context::ExitMatcherNode;
use crate::parser::parser_with_context::parser_with_context; use crate::parser::parser_with_context::parser_with_context;
use crate::parser::util::blank_line; use crate::parser::util::blank_line;
use crate::parser::util::element_trailing_whitespace;
use crate::parser::util::exit_matcher_parser; use crate::parser::util::exit_matcher_parser;
use crate::parser::util::get_consumed; use crate::parser::util::get_consumed;
use crate::parser::util::maybe_consume_trailing_whitespace; use crate::parser::util::maybe_consume_trailing_whitespace;
use crate::parser::util::start_of_line; use crate::parser::util::start_of_line;
use crate::parser::util::whitespace_eof;
use nom::branch::alt; use nom::branch::alt;
use nom::bytes::complete::tag; use nom::bytes::complete::tag;
use nom::bytes::complete::tag_no_case; use nom::bytes::complete::tag_no_case;
use nom::bytes::complete::take_while; use nom::bytes::complete::take_while;
use nom::character::complete::digit1; use nom::character::complete::digit1;
use nom::character::complete::multispace0;
use nom::character::complete::space0; use nom::character::complete::space0;
use nom::combinator::opt;
use nom::combinator::recognize; use nom::combinator::recognize;
use nom::combinator::verify; use nom::combinator::verify;
use nom::multi::many1; use nom::multi::many1;

View File

@ -8,7 +8,6 @@ use crate::parser::parser_context::ChainBehavior;
use crate::parser::parser_context::ContextElement; use crate::parser::parser_context::ContextElement;
use crate::parser::parser_context::ExitMatcherNode; use crate::parser::parser_context::ExitMatcherNode;
use crate::parser::parser_with_context::parser_with_context; 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::exit_matcher_parser;
use crate::parser::util::get_consumed; use crate::parser::util::get_consumed;
use crate::parser::util::maybe_consume_trailing_whitespace; use crate::parser::util::maybe_consume_trailing_whitespace;

View File

@ -1,6 +1,5 @@
use nom::branch::alt; use nom::branch::alt;
use nom::combinator::eof; use nom::combinator::eof;
use nom::combinator::opt;
use nom::combinator::recognize; use nom::combinator::recognize;
use nom::combinator::verify; use nom::combinator::verify;
use nom::multi::many1; 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::ContextElement;
use crate::parser::parser_context::ExitMatcherNode; use crate::parser::parser_context::ExitMatcherNode;
use crate::parser::parser_with_context::parser_with_context; 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::exit_matcher_parser;
use crate::parser::util::maybe_consume_trailing_whitespace; use crate::parser::util::maybe_consume_trailing_whitespace;
use crate::parser::util::start_of_line; use crate::parser::util::start_of_line;

View File

@ -1,6 +1,5 @@
use std::rc::Rc; use std::rc::Rc;
use nom::combinator::eof;
use nom::IResult; use nom::IResult;
use crate::parser::util::whitespace_eof; use crate::parser::util::whitespace_eof;