| Crates.io | iCalendar_parser |
| lib.rs | iCalendar_parser |
| version | 0.1.10 |
| created_at | 2024-11-11 21:54:48.460333+00 |
| updated_at | 2024-11-13 22:03:19.972972+00 |
| description | iCalendar (.ical) file parsing and putting into handy structure |
| homepage | |
| repository | https://github.com/trokhymchuk/rustParser |
| max_upload_size | |
| id | 1444256 |
| size | 55,583 |
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:VCALENDARVERSION2.0.VERSION:2.0PRODID-//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//ENBEGIN:VEVENT / END:VEVENTUIDUID:a.trokhymchuk@gmail.comORGANIZERCN=Artem Trokhymchuk) and the email address (MAILTO:a.trokhymchuk@gmail.com).ORGANIZER;CN=John Doe:MAILTO:john.doe@example.comDTSTARTYYYYMMDDTHHMMSSZ.DTSTART:19970714T170000Z (July 14, 1997, 17:00 UTC)DTENDDTEND:19970715T040000Z (July 15, 1997, 04:00 UTC)SUMMARYSUMMARY:NaUKMA birthdayGEOGEO: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:VCALENDARVERSIONPRODIDBEGIN:VEVENT / END:VEVENTUIDORGANIZERDTSTARTDTENDSUMMARYGEOvc_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 | " " | "-" | "/" | "." | "," | ":")* }