chore: update comments

This commit is contained in:
yuankunzhang
2025-07-23 14:10:29 +00:00
committed by Daniel Hofstetter
parent 0ddeec70b4
commit a48ad6aec3
3 changed files with 24 additions and 19 deletions
+22 -3
View File
@@ -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)
+1 -1
View File
@@ -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
View File
@@ -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(","))),