Update RefContext to three lifetimes.

This commit is contained in:
Tom Alexander
2023-09-02 22:45:46 -04:00
parent ba57eb16fd
commit 74a6101de7
41 changed files with 200 additions and 200 deletions

View File

@@ -24,7 +24,7 @@ use crate::types::Timestamp;
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn timestamp<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Timestamp<'s>> {
// TODO: This would be more efficient if we didn't throw away the parse result of the first half of an active/inactive date range timestamp if the parse fails (as in, the first thing active_date_range_timestamp parses is a active_timestamp but then we throw that away if it doesn't turn out to be a full active_date_range_timestamp despite the active_timestamp parse being completely valid). I am going with the simplest/cleanest approach for the first implementation.
@@ -42,7 +42,7 @@ pub fn timestamp<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn diary_timestamp<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Timestamp<'s>> {
let (remaining, _) = tag("<%%(")(input)?;
@@ -62,7 +62,7 @@ fn diary_timestamp<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn sexp<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let parser_context =
@@ -84,7 +84,7 @@ fn sexp<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn sexp_end<'r, 's>(
_context: RefContext<'r, 's>,
_context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
alt((tag(")>"), recognize(one_of(">\n"))))(input)
@@ -92,7 +92,7 @@ fn sexp_end<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn active_timestamp<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Timestamp<'s>> {
let (remaining, _) = tag("<")(input)?;
@@ -126,7 +126,7 @@ fn active_timestamp<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn inactive_timestamp<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Timestamp<'s>> {
let (remaining, _) = tag("[")(input)?;
@@ -160,7 +160,7 @@ fn inactive_timestamp<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn active_date_range_timestamp<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Timestamp<'s>> {
let (remaining, _first_timestamp) = active_timestamp(context, input)?;
@@ -182,7 +182,7 @@ fn active_date_range_timestamp<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn active_time_range_timestamp<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Timestamp<'s>> {
let (remaining, _) = tag("<")(input)?;
@@ -223,7 +223,7 @@ fn active_time_range_timestamp<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn inactive_date_range_timestamp<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Timestamp<'s>> {
let (remaining, _first_timestamp) = inactive_timestamp(context, input)?;
@@ -245,7 +245,7 @@ fn inactive_date_range_timestamp<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn inactive_time_range_timestamp<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Timestamp<'s>> {
let (remaining, _) = tag("[")(input)?;
@@ -286,7 +286,7 @@ fn inactive_time_range_timestamp<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn date<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (remaining, _year) = verify(digit1, |year: &OrgSource<'_>| year.len() == 4)(input)?;
@@ -304,7 +304,7 @@ fn date<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn dayname<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let parser_context =
@@ -326,7 +326,7 @@ fn dayname<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn dayname_end<'r, 's>(
_context: RefContext<'r, 's>,
_context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
recognize(verify(anychar, |c| {
@@ -336,7 +336,7 @@ fn dayname_end<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn time<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (remaining, _hour) = verify(digit1, |hour: &OrgSource<'_>| {
@@ -352,7 +352,7 @@ fn time<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn time_rest<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let (remaining, body) = recognize(verify(
@@ -365,7 +365,7 @@ fn time_rest<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn active_time_rest_end<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
alt((
@@ -380,7 +380,7 @@ fn active_time_rest_end<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn inactive_time_rest_end<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
alt((
@@ -395,7 +395,7 @@ fn inactive_time_rest_end<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn time_range_rest_end<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
// We pop off the most recent context element to get a context tree with just the active/inactive_time_rest_end exit matcher (removing this function from the exit matcher chain) because the 2nd time in the range does not end when a "-TIME" pattern is found.
@@ -407,7 +407,7 @@ fn time_range_rest_end<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn repeater<'r, 's>(
_context: RefContext<'r, 's>,
_context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
// + for cumulative type
@@ -423,7 +423,7 @@ fn repeater<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn warning_delay<'r, 's>(
_context: RefContext<'r, 's>,
_context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
// - for all type