Put back in needed pubs.
This commit is contained in:
@@ -21,11 +21,11 @@ use crate::error::CustomError;
|
||||
use crate::error::MyError;
|
||||
use crate::error::Res;
|
||||
|
||||
const WORD_CONSTITUENT_CHARACTERS: &str =
|
||||
pub(crate) const WORD_CONSTITUENT_CHARACTERS: &str =
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
/// Check if we are below a section of the given section type regardless of depth
|
||||
fn in_section<'b, 'g, 'r, 's, 'x>(
|
||||
pub(crate) fn in_section<'b, 'g, 'r, 's, 'x>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
section_name: &'x str,
|
||||
) -> bool {
|
||||
@@ -39,7 +39,7 @@ use crate::error::Res;
|
||||
}
|
||||
|
||||
/// Checks if we are currently an immediate child of the given section type
|
||||
fn immediate_in_section<'b, 'g, 'r, 's, 'x>(
|
||||
pub(crate) fn immediate_in_section<'b, 'g, 'r, 's, 'x>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
section_name: &'x str,
|
||||
) -> bool {
|
||||
@@ -54,7 +54,7 @@ use crate::error::Res;
|
||||
}
|
||||
|
||||
/// Check if we are below a section of the given section type regardless of depth
|
||||
fn in_object_section<'b, 'g, 'r, 's, 'x>(
|
||||
pub(crate) fn in_object_section<'b, 'g, 'r, 's, 'x>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
section_name: &'x str,
|
||||
) -> bool {
|
||||
@@ -68,7 +68,7 @@ use crate::error::Res;
|
||||
}
|
||||
|
||||
/// Get a slice of the string that was consumed in a parser using the original input to the parser and the remaining input after the parser.
|
||||
fn get_consumed<'s>(input: OrgSource<'s>, remaining: OrgSource<'s>) -> OrgSource<'s> {
|
||||
pub(crate) fn get_consumed<'s>(input: OrgSource<'s>, remaining: OrgSource<'s>) -> OrgSource<'s> {
|
||||
input.get_until(remaining)
|
||||
}
|
||||
|
||||
@@ -76,19 +76,19 @@ use crate::error::Res;
|
||||
///
|
||||
/// It is up to the caller to ensure this is called at the start of a line.
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn blank_line(input: OrgSource<'_>) -> Res<OrgSource<'_>, OrgSource<'_>> {
|
||||
pub(crate) fn blank_line(input: OrgSource<'_>) -> Res<OrgSource<'_>, OrgSource<'_>> {
|
||||
not(eof)(input)?;
|
||||
recognize(tuple((space0, alt((line_ending, eof)))))(input)
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn element_trailing_whitespace<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
fn element_trailing_whitespace<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
start_of_line(input)?;
|
||||
alt((eof, recognize(many0(blank_line))))(input)
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn maybe_consume_object_trailing_whitespace_if_not_exiting<'b, 'g, 'r, 's>(
|
||||
pub(crate) fn maybe_consume_object_trailing_whitespace_if_not_exiting<'b, 'g, 'r, 's>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, Option<OrgSource<'s>>> {
|
||||
@@ -104,7 +104,7 @@ use crate::error::Res;
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn maybe_consume_trailing_whitespace_if_not_exiting<'b, 'g, 'r, 's>(
|
||||
pub(crate) fn maybe_consume_trailing_whitespace_if_not_exiting<'b, 'g, 'r, 's>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, Option<OrgSource<'s>>> {
|
||||
@@ -117,7 +117,7 @@ use crate::error::Res;
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn maybe_consume_trailing_whitespace<'b, 'g, 'r, 's>(
|
||||
pub(crate) fn maybe_consume_trailing_whitespace<'b, 'g, 'r, 's>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, Option<OrgSource<'s>>> {
|
||||
@@ -130,7 +130,7 @@ use crate::error::Res;
|
||||
|
||||
/// Check that we are at the start of a line
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn start_of_line<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
|
||||
pub(crate) fn start_of_line<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
|
||||
if input.is_at_start_of_line() {
|
||||
Ok((input, ()))
|
||||
} else {
|
||||
@@ -140,7 +140,7 @@ use crate::error::Res;
|
||||
}
|
||||
}
|
||||
|
||||
fn preceded_by_whitespace(
|
||||
pub(crate) fn preceded_by_whitespace(
|
||||
allow_start_of_file: bool,
|
||||
) -> impl for<'s> Fn(OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
|
||||
move |input| _preceded_by_whitespace(allow_start_of_file, input)
|
||||
@@ -168,13 +168,13 @@ fn _preceded_by_whitespace<'s>(
|
||||
///
|
||||
/// This function only operates on spaces, tabs, carriage returns, and line feeds. It does not handle fancy unicode whitespace.
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn non_whitespace_character(input: OrgSource<'_>) -> Res<OrgSource<'_>, char> {
|
||||
pub(crate) fn non_whitespace_character(input: OrgSource<'_>) -> Res<OrgSource<'_>, char> {
|
||||
none_of(" \t\r\n")(input)
|
||||
}
|
||||
|
||||
/// Check that we are at the start of a line
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn exit_matcher_parser<'b, 'g, 'r, 's>(
|
||||
pub(crate) fn exit_matcher_parser<'b, 'g, 'r, 's>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
@@ -182,7 +182,7 @@ fn _preceded_by_whitespace<'s>(
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn text_until_exit<'b, 'g, 'r, 's>(
|
||||
pub(crate) fn text_until_exit<'b, 'g, 'r, 's>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
@@ -193,7 +193,7 @@ fn _preceded_by_whitespace<'s>(
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn not_yet_implemented() -> Res<OrgSource<'static>, ()> {
|
||||
fn not_yet_implemented() -> Res<OrgSource<'static>, ()> {
|
||||
return Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||
"Not implemented yet.".into(),
|
||||
))));
|
||||
@@ -204,7 +204,7 @@ fn _preceded_by_whitespace<'s>(
|
||||
/// Text from the current point until the next line break or end of file
|
||||
///
|
||||
/// Useful for debugging.
|
||||
fn text_until_eol<'r, 's>(
|
||||
fn text_until_eol<'r, 's>(
|
||||
input: OrgSource<'s>,
|
||||
) -> Result<&'s str, nom::Err<CustomError<OrgSource<'s>>>> {
|
||||
let line = recognize(many_till(anychar, alt((line_ending, eof))))(input)
|
||||
@@ -212,7 +212,7 @@ fn _preceded_by_whitespace<'s>(
|
||||
Ok(line.trim())
|
||||
}
|
||||
|
||||
fn include_input<'s, F, O>(
|
||||
pub(crate) fn include_input<'s, F, O>(
|
||||
mut inner: F,
|
||||
) -> impl FnMut(OrgSource<'s>) -> Res<OrgSource<'s>, (OrgSource<'s>, O)>
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user