You've already forked parse_datetime
mirror of
https://github.com/uutils/parse_datetime.git
synced 2026-06-10 16:13:15 -07:00
chore: update comments
This commit is contained in:
committed by
Daniel Hofstetter
parent
0ddeec70b4
commit
a48ad6aec3
+22
-3
@@ -114,9 +114,9 @@ pub(crate) fn at_local(
|
||||
/// literal2_date = literal_month , [ { whitespace } ] , day , [ [ literal2_date_delim ] , year ] ;
|
||||
/// literal2_date_delim = { whitespace } | [ { whitespace } ] , "," , [ { whitespace } ] ;
|
||||
///
|
||||
/// year = dec_int ;
|
||||
/// month = dec_int ;
|
||||
/// day = dec_int ;
|
||||
/// year = dec_uint ;
|
||||
/// month = dec_uint ;
|
||||
/// day = dec_uint ;
|
||||
///
|
||||
/// literal_month = "january" | "jan"
|
||||
/// | "february" | "feb"
|
||||
@@ -130,6 +130,25 @@ pub(crate) fn at_local(
|
||||
/// | "october" | "oct"
|
||||
/// | "november" | "nov"
|
||||
/// | "december" | "dec" ;
|
||||
///
|
||||
/// weekday = [ ordinal ] day [ "," ] ;
|
||||
///
|
||||
/// ordinal = number_ordinal | text_ordinal ;
|
||||
///
|
||||
/// number_ordinal = [ "+" | "-" ] , dec_uint ;
|
||||
///
|
||||
/// text_ordinal = "last" | "this" | "next" | "first"
|
||||
/// | "third" | "fourth" | "fifth" | "sixth"
|
||||
/// | "seventh" | "eighth" | "ninth" | "tenth"
|
||||
/// | "eleventh" | "twelfth" ;
|
||||
///
|
||||
/// day = "monday" | "mon" | "mon."
|
||||
/// | "tuesday" | "tue" | "tue." | "tues"
|
||||
/// | "wednesday" | "wed" | "wed." | "wednes"
|
||||
/// | "thursday" | "thu" | "thu." | "thur" | "thurs"
|
||||
/// | "friday" | "fri" | "fri."
|
||||
/// | "saturday" | "sat" | "sat."
|
||||
/// | "sunday" | "sun" | "sun." ;
|
||||
/// ```
|
||||
pub(crate) fn parse(input: &mut &str) -> ModalResult<DateTimeBuilder> {
|
||||
trace("parse", alt((parse_timestamp, parse_items))).parse_next(input)
|
||||
|
||||
@@ -9,7 +9,7 @@ use winnow::{
|
||||
|
||||
use super::primitive::{dec_uint, s};
|
||||
|
||||
pub fn ordinal(input: &mut &str) -> ModalResult<i32> {
|
||||
pub(super) fn ordinal(input: &mut &str) -> ModalResult<i32> {
|
||||
alt((text_ordinal, number_ordinal)).parse_next(input)
|
||||
}
|
||||
|
||||
|
||||
+1
-15
@@ -61,21 +61,7 @@ impl From<Day> for chrono::Weekday {
|
||||
}
|
||||
|
||||
/// Parse a weekday item.
|
||||
///
|
||||
/// Grammar:
|
||||
///
|
||||
/// ```ebnf
|
||||
/// weekday = [ ordinal ] day [ "," ] ;
|
||||
///
|
||||
/// day = "monday" | "mon" | "mon."
|
||||
/// | "tuesday" | "tue" | "tue." | "tues"
|
||||
/// | "wednesday" | "wed" | "wed." | "wednes"
|
||||
/// | "thursday" | "thu" | "thu." | "thur" | "thurs"
|
||||
/// | "friday" | "fri" | "fri."
|
||||
/// | "saturday" | "sat" | "sat."
|
||||
/// | "sunday" | "sun" | "sun." ;
|
||||
/// ```
|
||||
pub fn parse(input: &mut &str) -> ModalResult<Weekday> {
|
||||
pub(super) fn parse(input: &mut &str) -> ModalResult<Weekday> {
|
||||
seq!(Weekday {
|
||||
offset: opt(ordinal).map(|o| o.unwrap_or_default()),
|
||||
day: terminated(day, opt(s(","))),
|
||||
|
||||
Reference in New Issue
Block a user