Convert all functions to using the wrapped input type.
Some checks failed
rust-test Build rust-test has failed
rust-build Build rust-build has failed

This commit is contained in:
Tom Alexander
2023-08-23 00:30:26 -04:00
parent b7a5dd48ea
commit dab598e5e7
45 changed files with 1217 additions and 572 deletions

View File

@@ -11,6 +11,7 @@ use nom::combinator::recognize;
use nom::combinator::verify;
use nom::sequence::tuple;
use super::org_source::OrgSource;
use super::Context;
use crate::error::Res;
use crate::parser::parser_with_context::parser_with_context;
@@ -19,7 +20,10 @@ use crate::parser::util::start_of_line;
use crate::parser::Clock;
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn clock<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Clock<'s>> {
pub fn clock<'r, 's>(
context: Context<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Clock<'s>> {
start_of_line(context, input)?;
let (remaining, _leading_whitespace) = space0(input)?;
let (remaining, _clock) = tag_no_case("clock:")(remaining)?;
@@ -31,14 +35,19 @@ pub fn clock<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, C
))(remaining)?;
let source = get_consumed(input, remaining);
Ok((remaining, Clock { source }))
Ok((
remaining,
Clock {
source: source.into(),
},
))
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn inactive_timestamp_range_duration<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, &'s str> {
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
recognize(tuple((
tag("["),
is_not("\r\n]"),
@@ -50,14 +59,17 @@ fn inactive_timestamp_range_duration<'r, 's>(
space1,
digit1,
tag(":"),
verify(digit1, |mm: &str| mm.len() == 2),
verify(digit1, |mm: &OrgSource<'_>| mm.len() == 2),
space0,
alt((line_ending, eof)),
)))(input)
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn inactive_timestamp<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
fn inactive_timestamp<'r, 's>(
context: Context<'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
recognize(tuple((
tag("["),
is_not("\r\n]"),