Give global options their own lifetime.

This commit is contained in:
Tom Alexander
2023-09-03 15:44:18 -04:00
parent a7b9eb9db4
commit df79cbd0b7
48 changed files with 470 additions and 466 deletions

View File

@@ -26,7 +26,10 @@ pub const WORD_CONSTITUENT_CHARACTERS: &str =
/// Check if we are below a section of the given section type regardless of depth
#[allow(dead_code)]
pub fn in_section<'r, 's, 'x>(context: RefContext<'_, 'r, 's>, section_name: &'x str) -> bool {
pub fn in_section<'b, 'g, 'r, 's, 'x>(
context: RefContext<'b, 'g, 'r, 's>,
section_name: &'x str,
) -> bool {
for thing in context.iter() {
match thing {
ContextElement::Context(name) if *name == section_name => return true,
@@ -37,8 +40,8 @@ pub fn in_section<'r, 's, 'x>(context: RefContext<'_, 'r, 's>, section_name: &'x
}
/// Checks if we are currently an immediate child of the given section type
pub fn immediate_in_section<'r, 's, 'x>(
context: RefContext<'_, 'r, 's>,
pub fn immediate_in_section<'b, 'g, 'r, 's, 'x>(
context: RefContext<'b, 'g, 'r, 's>,
section_name: &'x str,
) -> bool {
for thing in context.iter() {
@@ -72,8 +75,8 @@ pub fn element_trailing_whitespace<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn maybe_consume_object_trailing_whitespace_if_not_exiting<'r, 's>(
context: RefContext<'_, 'r, 's>,
pub 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>>> {
if exit_matcher_parser(context, input).is_err() {
@@ -84,8 +87,8 @@ pub fn maybe_consume_object_trailing_whitespace_if_not_exiting<'r, 's>(
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn maybe_consume_trailing_whitespace_if_not_exiting<'r, 's>(
context: RefContext<'_, 'r, 's>,
pub 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>>> {
if context.should_consume_trailing_whitespace() && exit_matcher_parser(context, input).is_err()
@@ -97,8 +100,8 @@ pub fn maybe_consume_trailing_whitespace_if_not_exiting<'r, 's>(
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn maybe_consume_trailing_whitespace<'r, 's>(
context: RefContext<'_, 'r, 's>,
pub fn maybe_consume_trailing_whitespace<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Option<OrgSource<'s>>> {
if context.should_consume_trailing_whitespace() {
@@ -146,16 +149,16 @@ pub fn non_whitespace_character(input: OrgSource<'_>) -> Res<OrgSource<'_>, char
/// Check that we are at the start of a line
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn exit_matcher_parser<'r, 's>(
context: RefContext<'_, 'r, 's>,
pub fn exit_matcher_parser<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
peek(|i| context.check_exit_matcher(i))(input)
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn text_until_exit<'r, 's>(
context: RefContext<'_, 'r, 's>,
pub fn text_until_exit<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
recognize(verify(