Reputation: 71
I'm trying to parse an iCal input file according to RFC 5545. Specifically: -Property name -Optional parameters, each starting with semicolon ";" and possibly having multiple comma-separated values (parameter values may be double-quoted in which case they could contain colons, semicolons, and commas) -Colon ":" -Property value
Example line:
> ORGANIZER;CN=Obi-WanKenobi;SENTBY="mailto:[email protected]":mailto:[email protected]
in this case the line would be read into a buffer and parsed (using strtok currently) like this: Organizer is the property name; CN=Obi-WanKenobi and SENTBY="mailto:[email protected]" are parameters; mailto:[email protected] is the property value.
I have no idea where to start. The different input cases are almost infinite and I haven't been able to figure out an effective algorithm to cover all of said cases. Is strtok the way to go? or is there another C library that has a more intelligent parser? Need someone to put me on the right track.
Upvotes: 0
Views: 279
Reputation: 4775
I'd suggest that you start with looking at existing C implementation:
Above answers are addressing your immediate question but you might hit other issues as you progress through the RFC5545 standard and looking at what others have done may be helpful
Upvotes: 1