Blocks found in the order that they appear in an iCal file. Some editing for line length. The file contained 60 lines numbered 0 to 59 as is customary in javascript.
digraph { // http://ward.dojo.fed.wiki/ical-blocks-as-parsed.html node [ shape=box style=filled fillcolor=palegreen ] 0 [label=calendar] 7 [label=timezone] 10 [label=daylight] 17 [label=standard] 25 [label=event] 39 [label=alarm] 45 [label=event] 0 -> 7 0 -> 25 0 -> 45 7 -> 10 7 -> 17 25 -> 39 }
This parse shows the line suspended at the BEGIN on line 7 and then repeatedly resumed only to find another BEGIN at lines 25 and 45.
[ [ "0: BEGIN:VCALENDAR", "1: PRODID:-//Google Inc//Calendar 70.9054//EN", "2: VERSION:2.0", "3: CALSCALE:GREGORIAN", "4: METHOD:PUBLISH", "5: X-WR-CALNAME:Single Dojo", "6: X-WR-TIMEZONE:America/Toronto", "7: BEGIN:VTIMEZONE", "25: BEGIN:VEVENT", "45: BEGIN:VEVENT", "59: END:VCALENDAR" ], [ "7: BEGIN:VTIMEZONE", "8: TZID:America/New_York", "9: X-LIC-LOCATION:America/New_York", "10: BEGIN:DAYLIGHT", "17: BEGIN:STANDARD", "24: END:VTIMEZONE" ], [ "10: BEGIN:DAYLIGHT", "11: TZOFFSETFROM:-0500", "12: TZOFFSETTO:-0400", "13: TZNAME:EDT", "14: DTSTART:19700308T020000", "15: RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU", "16: END:DAYLIGHT" ], [ "17: BEGIN:STANDARD", "18: TZOFFSETFROM:-0400", "19: TZOFFSETTO:-0500", "20: TZNAME:EST", "21: DTSTART:19701101T020000", "22: RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU", "23: END:STANDARD" ], [ "25: BEGIN:VEVENT", "26: DTSTART;TZID=New_York:20200712T120000", "27: DTEND;TZID=/New_York:20200712T140000", "28: RRULE:FREQ=WEEKLY;BYDAY=SU", "29: DTSTAMP:20220108T204706Z", "30: UID:121043uui9fgaigtmim@google.com", "31: CREATED:20220108T203334Z", "32: DESCRIPTION:https://hangouts.google.com", "33: LAST-MODIFIED:20220108T203357Z", "34: LOCATION:https://hangouts.google.com", "35: SEQUENCE:0", "36: STATUS:CONFIRMED", "37: SUMMARY:Wiki Dojo", "38: TRANSP:OPAQUE", "39: BEGIN:VALARM", "44: END:VEVENT" ], [ "39: BEGIN:VALARM", "40: ACTION:DISPLAY", "41: DESCRIPTION:This is an event reminder", "42: TRIGGER:-P0DT0H5M0S", "43: END:VALARM" ], [ "45: BEGIN:VEVENT", "46: DTSTART:20220109T160000Z", "47: DTEND:20220109T170000Z", "48: DTSTAMP:20220108T204706Z", "49: UID:15kvfjgjqe9hb5qbv92kb4vhbb@google.com", "50: CREATED:20220108T203431Z", "51: DESCRIPTION:", "52: LAST-MODIFIED:20220108T203431Z", "53: LOCATION:", "54: SEQUENCE:0", "55: STATUS:CONFIRMED", "56: SUMMARY:pre-dojo (single event test)", "57: TRANSP:OPAQUE", "58: END:VEVENT" ] ]
I composed the parse tree diagram above in dot using line numbers to stand for objects present in the file. edotor
Notice that there are two events in the file and they have a unique identity based on their position in the file. Here we have preserved this by noting on what line they begin and carry that identity forward in the dot notation.
0 -> 7 0 -> 25 0 -> 45 7 -> 10 7 -> 17 25 -> 39
Marc Pierson is the first I have known to exploit this simplification of complex diagrams where the numbers are given their node names with label assignments.