The iCalendar file contains event with useful information such as begin/end date, invitee, summary and so on.
The parser is inteneded to take that file and parse it into a Rust struct for easier manipulation of the data. The result of the parsed file would be used to determine in which day a particular person have the most events.
See ASCIINEMA of the parser!
BEGIN:VCALENDAR
/ END:VCALENDAR
VERSION
2.0
.VERSION:2.0
PRODID
-//hacksw/handcal//NONSGML v1.0//EN
is typically used as a placeholder for this example, representing a non-standard or generic product ID.PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
/ END:VEVENT
UID
UID:a.trokhymchuk@gmail.com
ORGANIZER
CN=Artem Trokhymchuk
) and the email address (MAILTO:a.trokhymchuk@gmail.com
).ORGANIZER;CN=John Doe:MAILTO:john.doe@example.com
DTSTART
YYYYMMDDTHHMMSSZ
.DTSTART:19970714T170000Z
(July 14, 1997, 17:00 UTC)DTEND
DTEND:19970715T040000Z
(July 15, 1997, 04:00 UTC)SUMMARY
SUMMARY:NaUKMA birthday
GEO
GEO:48.85299,2.36885
(Coordinates for a location in Paris, France)These are the core fields present in the provided iCalendar file. The required fields include:
BEGIN:VCALENDAR
/ END:VCALENDAR
VERSION
PRODID
BEGIN:VEVENT
/ END:VEVENT
UID
ORGANIZER
DTSTART
DTEND
SUMMARY
GEO
vc_calendar = { "BEGIN:VCALENDAR" ~ method? ~ ((version ~ prodid) | (prodid ~ version)) ~ event* ~ "END:VCALENDAR" }
version = { "VERSION:" ~ float }
prodid = { "PRODID:" ~ line }
event = { "BEGIN:VEVENT" ~ uid ~ organizer ~ dtstart ~ dtend ~ summary ~ geo ~ dsc? ~ "END:VEVENT" }
uid = { "UID:" ~ email_address }
organizer = { "ORGANIZER;" ~ "CN=" ~ identifier ~ ":" ~ "MAILTO:" ~ email_address }
dtstart = { "DTSTART:" ~ datetime }
dtend = { "DTEND:" ~ datetime }
dsc = { "DESCRIPTION:" ~ line }
summary = { "SUMMARY:" ~ line }
geo = { "GEO:" ~ float ~ "," ~ float }
method = @{ "METHOD:" ~ ("PUBLISH" | "REQUEST") }
email_address = @{ (letter_or_digit | "." | "_")+ ~ "@" ~ letter_or_digit+ ~ "." ~ letter_or_digit+ }
datetime = @{ digit{8} ~ "T" ~ digit{6} ~ "Z" }
identifier = @{ letter_or_digit+ ~ (" " ~ letter_or_digit+)* }
float = @{ digit+ ~ "." ~ digit+ }
quoted_string = @{ "\"" ~ (printable_char ~ ANY)* ~ "\"" }
ascii_alphanumeric = @{ ASCII_ALPHANUMERIC }
printable_char = @{ '\u{20}'..'\u{21}' | '\u{23}'..'\u{5B}' | '\u{5D}'..'\u{7A}' }
digit = @{ '0'..'9' }
letter_or_digit = @{ 'a'..'z' | 'A'..'Z' | '0'..'9' }
comment = { ";" ~ (ANY ~ "\n")* }
WHITESPACE = _{ comment | " " | "\t" | "\n" }
line = @{ (letter_or_digit | " " | "-" | "/" | "." | "," | ":")* }