Skip to content

Commit d71c6ea

Browse files
committed
docs: update comments
1 parent 3b6362e commit d71c6ea

File tree

1 file changed

+73
-43
lines changed

1 file changed

+73
-43
lines changed

src/items/mod.rs

Lines changed: 73 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -92,63 +92,93 @@ pub(crate) fn at_local(
9292
/// Grammar:
9393
///
9494
/// ```ebnf
95-
/// spec = timestamp | items ;
95+
/// spec = timestamp | items ;
9696
///
97-
/// timestamp = "@" , dec_int ;
97+
/// timestamp = "@" , float ;
9898
///
99-
/// items = item , { item } ;
100-
/// item = datetime | date | time | relative | weekday | timezone | year ;
99+
/// items = item , { item } ;
100+
/// item = datetime | date | time | relative | weekday | timezone | year ;
101101
///
102-
/// datetime = date , [ "T" | "t" | whitespace ] , iso_time ;
103-
/// date = iso_date | us_date | literal1_date | literal2_date ;
102+
/// datetime = date , [ "t" | whitespace ] , iso_time ;
104103
///
105-
/// iso_date = year , [ iso_date_delim ] , month , [ iso_date_delim ] , day ;
106-
/// iso_date_delim = [ { whitespace } ] , "-" , [ { whitespace } ] ;
104+
/// date = iso_date | us_date | literal1_date | literal2_date ;
107105
///
108-
/// us_date = month , [ us_date_delim ] , day , [ [ us_date_delim ] , year ];
109-
/// us_date_delim = [ { whitespace } ] , "/" , [ { whitespace } ] ;
106+
/// iso_date = year , [ iso_date_delim ] , month , [ iso_date_delim ] , day ;
107+
/// iso_date_delim = optional_whitespace , "-" , optional_whitespace ;
110108
///
111-
/// literal1_date = day , [ literal1_date_delim ] , literal_month , [ [ literal1_date_delim ] , year ] ;
112-
/// literal1_date_delim = { whitespace } | [ { whitespace } ] , "-" , [ { whitespace } ] ;
109+
/// us_date = month , [ us_date_delim ] , day , [ us_date_delim , year ];
110+
/// us_date_delim = optional_whitespace , "/" , optional_whitespace ;
113111
///
114-
/// literal2_date = literal_month , [ { whitespace } ] , day , [ [ literal2_date_delim ] , year ] ;
115-
/// literal2_date_delim = { whitespace } | [ { whitespace } ] , "," , [ { whitespace } ] ;
112+
/// literal1_date = day , [ literal1_date_delim ] , literal_month , [ literal1_date_delim , year ] ;
113+
/// literal1_date_delim = (optional_whitespace , "-" , optional_whitespace) | optional_whitespace ;
116114
///
117-
/// year = dec_uint ;
118-
/// month = dec_uint ;
119-
/// day = dec_uint ;
115+
/// literal2_date = literal_month , optional_whitespace , day , [ literal2_date_delim , year ] ;
116+
/// literal2_date_delim = (optional_whitespace , "," , optional_whitespace) | optional_whitespace ;
120117
///
121-
/// literal_month = "january" | "jan"
122-
/// | "february" | "feb"
123-
/// | "march" | "mar"
124-
/// | "april" | "apr"
125-
/// | "may"
126-
/// | "june" | "jun"
127-
/// | "july" | "jul"
128-
/// | "august" | "aug"
129-
/// | "september" | "sept" | "sep"
130-
/// | "october" | "oct"
131-
/// | "november" | "nov"
132-
/// | "december" | "dec" ;
118+
/// year = dec_uint ;
119+
/// month = dec_uint ;
120+
/// day = dec_uint ;
133121
///
134-
/// weekday = [ ordinal ] day [ "," ] ;
122+
/// literal_month = "january" | "jan"
123+
/// | "february" | "feb"
124+
/// | "march" | "mar"
125+
/// | "april" | "apr"
126+
/// | "may"
127+
/// | "june" | "jun"
128+
/// | "july" | "jul"
129+
/// | "august" | "aug"
130+
/// | "september" | "sept" | "sep"
131+
/// | "october" | "oct"
132+
/// | "november" | "nov"
133+
/// | "december" | "dec" ;
135134
///
136-
/// ordinal = number_ordinal | text_ordinal ;
135+
/// time = iso_time | meridiem_time ;
137136
///
138-
/// number_ordinal = [ "+" | "-" ] , dec_uint ;
137+
/// iso_time = hour24 , [ ":" , minute , [ ":" , second ] ] , [ time_offset ] ;
139138
///
140-
/// text_ordinal = "last" | "this" | "next" | "first"
141-
/// | "third" | "fourth" | "fifth" | "sixth"
142-
/// | "seventh" | "eighth" | "ninth" | "tenth"
143-
/// | "eleventh" | "twelfth" ;
139+
/// meridiem_time = hour12 , [ ":" , minute , [ ":" , second ] ] , meridiem ;
140+
/// meridiem = "am" | "pm" | "a.m." | "p.m." ;
144141
///
145-
/// day = "monday" | "mon" | "mon."
146-
/// | "tuesday" | "tue" | "tue." | "tues"
147-
/// | "wednesday" | "wed" | "wed." | "wednes"
148-
/// | "thursday" | "thu" | "thu." | "thur" | "thurs"
149-
/// | "friday" | "fri" | "fri."
150-
/// | "saturday" | "sat" | "sat."
151-
/// | "sunday" | "sun" | "sun." ;
142+
/// hour24 = dec_uint ;
143+
/// hour12 = dec_uint ;
144+
/// minute = dec_uint ;
145+
/// second = dec_uint ;
146+
///
147+
/// time_offset = ( "+" | "-" ) , dec_uint , [ ":" , dec_uint ] ;
148+
///
149+
/// relative = [ numeric_ordinal ] , unit , [ "ago" ] | day_shift ;
150+
///
151+
/// unit = "year" | "years"
152+
/// | "month" | "months"
153+
/// | "fortnight" | "fortnights"
154+
/// | "week" | "weeks"
155+
/// | "day" | "days"
156+
/// | "hour" | "hours"
157+
/// | "minute" | "minutes" | "min" | "mins"
158+
/// | "second" | "seconds" | "sec" | "secs" ;
159+
///
160+
/// day_shift = "tomorrow" | "yesterday" | "today" | "now" ;
161+
///
162+
/// weekday = [ ordinal ] , day , [ "," ] ;
163+
///
164+
/// ordinal = numeric_ordinal | text_ordinal ;
165+
/// numeric_ordinal = [ "+" | "-" ] , dec_uint ;
166+
/// text_ordinal = "last" | "this" | "next" | "first"
167+
/// | "third" | "fourth" | "fifth" | "sixth"
168+
/// | "seventh" | "eighth" | "ninth" | "tenth"
169+
/// | "eleventh" | "twelfth" ;
170+
///
171+
/// day = "monday" | "mon" | "mon."
172+
/// | "tuesday" | "tue" | "tue." | "tues"
173+
/// | "wednesday" | "wed" | "wed." | "wednes"
174+
/// | "thursday" | "thu" | "thu." | "thur" | "thurs"
175+
/// | "friday" | "fri" | "fri."
176+
/// | "saturday" | "sat" | "sat."
177+
/// | "sunday" | "sun" | "sun." ;
178+
///
179+
/// timezone = named_zone , [ time_offset ] ;
180+
///
181+
/// optional_whitespace = { whitespace } ;
152182
/// ```
153183
pub(crate) fn parse(input: &mut &str) -> ModalResult<DateTimeBuilder> {
154184
trace("parse", alt((parse_timestamp, parse_items))).parse_next(input)

0 commit comments

Comments
 (0)