itod / pegkit

'Parsing Expression Grammar' toolkit for Cocoa/Objective-C
MIT License
390 stars 37 forks source link

iCalendar grammar #19

Open sarambasich opened 9 years ago

sarambasich commented 9 years ago

I'm using PEGKit to make an iCalendar (RFC 5545) parser. It takes in a .ics file and reads it and will parse out the first class objects. I am running into an issue, however. How is one to handle EOFs? I'm having difficulty with this. My code gets stuck in an infinite loop when it finds them:

No viable alternative found in rule 'calprops'.
Line : 9223372036854775807
Near : «EOF» «EOF» 
Found : «EOF»

Is there any handling of this? I've tried searching for EOF but with no luck.

yepher commented 7 years ago

This looks pretty old and I think PegKit did not handle this sort of parsing very well at the time. I am doing some very similar parsing in a DSL I am working on.

I found this post on StackOverflow to be very valuable when figuring out how to do that sort or parsing.

I would assume this issue can be closed since the StackOverFlow response from PegKit author has a good working example that is very easily adapted to iCal parsing.

It would be nice to have an iCal grammar as one of the samples.