Call out to the parsers for the various timestamp types.
The parsers for those types remain unimplemented.
This commit is contained in:
parent
fa5fc41121
commit
49d5a4e4b5
@ -1,10 +1,85 @@
|
|||||||
|
use nom::branch::alt;
|
||||||
|
|
||||||
use super::Context;
|
use super::Context;
|
||||||
use crate::error::Res;
|
use crate::error::Res;
|
||||||
|
use crate::parser::parser_with_context::parser_with_context;
|
||||||
use crate::parser::util::not_yet_implemented;
|
use crate::parser::util::not_yet_implemented;
|
||||||
use crate::parser::Timestamp;
|
use crate::parser::Timestamp;
|
||||||
|
|
||||||
#[tracing::instrument(ret, level = "debug")]
|
#[tracing::instrument(ret, level = "debug")]
|
||||||
pub fn timestamp<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Timestamp<'s>> {
|
pub fn timestamp<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, 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.
|
||||||
|
alt((
|
||||||
|
// Order matters here. If its a date range, we need to parse the entire date range instead of just the first timestamp. If its a time range, we need to make sure thats parsed as a time range instead of as the "rest" portion of a single timestamp.
|
||||||
|
parser_with_context!(diary_timestamp)(context),
|
||||||
|
parser_with_context!(active_time_range_timestamp)(context),
|
||||||
|
parser_with_context!(inactive_time_range_timestamp)(context),
|
||||||
|
parser_with_context!(active_date_range_timestamp)(context),
|
||||||
|
parser_with_context!(inactive_date_range_timestamp)(context),
|
||||||
|
parser_with_context!(active_timestamp)(context),
|
||||||
|
parser_with_context!(inactive_timestamp)(context),
|
||||||
|
))(input)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(ret, level = "debug")]
|
||||||
|
fn diary_timestamp<'r, 's>(
|
||||||
|
context: Context<'r, 's>,
|
||||||
|
input: &'s str,
|
||||||
|
) -> Res<&'s str, Timestamp<'s>> {
|
||||||
|
not_yet_implemented()?;
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(ret, level = "debug")]
|
||||||
|
fn active_timestamp<'r, 's>(
|
||||||
|
context: Context<'r, 's>,
|
||||||
|
input: &'s str,
|
||||||
|
) -> Res<&'s str, Timestamp<'s>> {
|
||||||
|
not_yet_implemented()?;
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(ret, level = "debug")]
|
||||||
|
fn inactive_timestamp<'r, 's>(
|
||||||
|
context: Context<'r, 's>,
|
||||||
|
input: &'s str,
|
||||||
|
) -> Res<&'s str, Timestamp<'s>> {
|
||||||
|
not_yet_implemented()?;
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(ret, level = "debug")]
|
||||||
|
fn active_date_range_timestamp<'r, 's>(
|
||||||
|
context: Context<'r, 's>,
|
||||||
|
input: &'s str,
|
||||||
|
) -> Res<&'s str, Timestamp<'s>> {
|
||||||
|
not_yet_implemented()?;
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(ret, level = "debug")]
|
||||||
|
fn active_time_range_timestamp<'r, 's>(
|
||||||
|
context: Context<'r, 's>,
|
||||||
|
input: &'s str,
|
||||||
|
) -> Res<&'s str, Timestamp<'s>> {
|
||||||
|
not_yet_implemented()?;
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(ret, level = "debug")]
|
||||||
|
fn inactive_date_range_timestamp<'r, 's>(
|
||||||
|
context: Context<'r, 's>,
|
||||||
|
input: &'s str,
|
||||||
|
) -> Res<&'s str, Timestamp<'s>> {
|
||||||
|
not_yet_implemented()?;
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(ret, level = "debug")]
|
||||||
|
fn inactive_time_range_timestamp<'r, 's>(
|
||||||
|
context: Context<'r, 's>,
|
||||||
|
input: &'s str,
|
||||||
|
) -> Res<&'s str, Timestamp<'s>> {
|
||||||
not_yet_implemented()?;
|
not_yet_implemented()?;
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user