X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/177f020f122827214159c46dcfe7ded1e3c8d1c3..29db9a64a:/sbr/icalendar.l?ds=inline diff --git a/sbr/icalendar.l b/sbr/icalendar.l index dc75dace..8b0721bf 100644 --- a/sbr/icalendar.l +++ b/sbr/icalendar.l @@ -13,7 +13,7 @@ #include "sbr/icalparse.h" static char *unfold (char *, size_t *); -static void destroy_icallex (); +static void destroy_icallex(void); %} /* @@ -257,14 +257,34 @@ folded-value {VALUE-CHAR}*({fold}{VALUE-CHAR}*)+ . { /* By default, flex will just pass unmatched text. Catch it instead. */ - inform("unexpected input: |%s|\n", icaltext); + contentline *clines = vevents.last->contentlines; + contentline *cline; + + if (clines && (cline = clines->last)) { + if (cline->unexpected == NULL) { + cline->unexpected = charstring_create (0); + } + charstring_append_cstring (cline->unexpected, icaltext); + } } + <> { + /* See next rule for when start state is not INITIAL. */ destroy_icallex (); yyterminate (); } +<> { + /* Missing a final newline after a token. The input does not conform + to RFC 5545 § 3.1, which requires that each contentline end with a + CRLF. (Assume that the token is at the end of a contentline.) Be + liberal in what we accept by faking a newline here, and setting the + start state to terminate on the next call. */ + BEGIN (INITIAL); + return ICAL_CRLF; +} + %% static char * @@ -300,7 +320,7 @@ unfold (char *text, size_t *leng) { * with something other than flex. */ static void -destroy_icallex () { +destroy_icallex(void) { #if defined FLEX_SCANNER && defined YY_FLEX_SUBMINOR_VERSION /* Hack: rely on fact that the the YY_FLEX_SUBMINOR_VERSION #define was added to flex (flex.skl v. 2.163) after