bkiers / icalparser Goto Github PK
View Code? Open in Web Editor NEWAn iCalendar (RFC 5545) parser backed up by an ANTLR v4 grammar.
An iCalendar (RFC 5545) parser backed up by an ANTLR v4 grammar.
When parsing the RRULE recurrence there is a part in the grammar that says:
recur_rule_part
: k_freq ASSIGN freq
| k_until ASSIGN enddate
| k_count ASSIGN digits
| k_interval ASSIGN digits
| k_bysecond ASSIGN byseclist
| k_byminute ASSIGN byminlist
| k_byhour ASSIGN byhrlist
| k_byday ASSIGN bywdaylist
| k_bymonthday ASSIGN bymodaylist
| k_byyearday ASSIGN byyrdaylist
| k_byweekno ASSIGN bywknolist
| k_bymonth ASSIGN bymolist
| k_bysetpos ASSIGN bysplist
| k_wkst ASSIGN weekday
;
however in here both 'count' and 'interval' are assigned to 'digits'. It is possible to have both 'count' and 'interval' in the same rule, in which case we lose information.
Hello, I'm looking to create an ical parser for nodejs using the grammar that is provided. Reading the spec, it is under the impression that a line should be folded every so many (75) octets; a folded line is one where there is a CLRF followed by a space. Does this grammar properly account for that?
It appears that there is a problem when the escape character is the last character in a line of a multi-line string. For example:
LOCATION:Sabai Thai, 165-169 Princes House, Princes Place, North Street
, Brighton. BN1 1EA
In this situation the parser generates an error:
[java] line 1524:74 extraneous input '' expecting {LINE_FOLD, WSP, ESCAPED_CHAR, CRLF, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, '!', '"', '#', '$', '%', '&', ''', '(', ')', '*', '+', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', '<', '=', '>', '?', '@', '[', ']', '^', '_', '`', '{', '|', '}', '~', NON_US_ASCII}
I'm encountering a problem with the grammar rule for parsing the SENT-BY
parameter in compliance with RFC5545 section 3.8.4.1 last example. The rule is defined as follows:
sentbyparam
: k_sent_by ASSIGN DQUOTE cal_address DQUOTE
;
The issue arises when double quotes are missing from the SENT-BY
parameter in an input, as shown in the last example from the section 3.8.4.1 of the RFC:
ATTENDEE;SENT-BY=mailto:[email protected];CN=John Smith:
mailto:[email protected]
The example does not include double quotes around the email address, leading my parser to incorrectly identify SENT-BY=mailto:[email protected]
as other_param
. While the RFC specifies that double quotes should be present, the given example lacks them (which I believe is a mistake?).
Changing the rule to this makes it work properly:
k_sent_by ASSIGN DQUOTE? cal_address DQUOTE?
it solves the parsing issue, but it does not adhere to the RFC's requirement for double quotes.
Below is the full rule for context:
// 3.8.4.1 - Attendee
attendee
: k_attendee attparam* COL cal_address CRLF
;
attparam
: SCOL cutypeparam
| SCOL memberparam
| SCOL roleparam
| SCOL partstatparam
| SCOL rsvpparam
| SCOL deltoparam
| SCOL delfromparam
| SCOL sentbyparam
| SCOL cnparam
| SCOL dirparam
| SCOL languageparam
| SCOL other_param
;
So my question is how can I possibly throw an error if the double quotes are missing after a SENT-BY
is matched? This is a possible issue for other params as well
More of a question that an issue, probably.
iCalendar has a number of characters which it escapes in text strings, for example the comma is escaped as , and the semicolon is escaped as ;
Should I expect the lexer to recognise these escaped sequence and unescape them, or is this something that I would need to do myself in the parser?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.