Implement parser for active/inactive timestamp date ranges.

This commit is contained in:
Tom Alexander 2023-07-27 19:59:36 -04:00
parent b5a029e2bf
commit 1a5b7ca30c
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -136,8 +136,15 @@ fn active_date_range_timestamp<'r, 's>(
context: Context<'r, 's>, context: Context<'r, 's>,
input: &'s str, input: &'s str,
) -> Res<&'s str, Timestamp<'s>> { ) -> Res<&'s str, Timestamp<'s>> {
not_yet_implemented()?; let (remaining, _first_timestamp) = active_timestamp(context, input)?;
todo!() // TODO: Does the space0 at the end of the active/inactive timestamp parsers cause this to be incorrect? I could use a look-behind to make sure the preceding character is not whitespace
let (remaining, _separator) = tag("--")(remaining)?;
let (remaining, _second_timestamp) = active_timestamp(context, remaining)?;
let (remaining, _) = space0(remaining)?;
let source = get_consumed(input, remaining);
Ok((remaining, Timestamp { source }))
} }
#[tracing::instrument(ret, level = "debug")] #[tracing::instrument(ret, level = "debug")]
@ -154,8 +161,15 @@ fn inactive_date_range_timestamp<'r, 's>(
context: Context<'r, 's>, context: Context<'r, 's>,
input: &'s str, input: &'s str,
) -> Res<&'s str, Timestamp<'s>> { ) -> Res<&'s str, Timestamp<'s>> {
not_yet_implemented()?; let (remaining, _first_timestamp) = inactive_timestamp(context, input)?;
todo!() // TODO: Does the space0 at the end of the active/inactive timestamp parsers cause this to be incorrect? I could use a look-behind to make sure the preceding character is not whitespace
let (remaining, _separator) = tag("--")(remaining)?;
let (remaining, _second_timestamp) = inactive_timestamp(context, remaining)?;
let (remaining, _) = space0(remaining)?;
let source = get_consumed(input, remaining);
Ok((remaining, Timestamp { source }))
} }
#[tracing::instrument(ret, level = "debug")] #[tracing::instrument(ret, level = "debug")]