<?xml version="1.0"?>

<!DOCTYPE MODE SYSTEM "xmode.dtd">

<!-- iCalendar mode by Victor Engmark <victor.engmark@gmail.com> -->

<MODE>
	<PROPS>
		<PROPERTY NAME="lineComment" VALUE="COMMENT"/>

		<PROPERTY NAME="wordBreakChars" VALUE=",;:=+/?^*&amp;"/>

		<!-- Indentation -->
		<PROPERTY NAME="maxLineLen" VALUE="75"/>
		<PROPERTY NAME="wrap" VALUE="hard"/>
		<PROPERTY NAME="indentSize" VALUE="1"/>

		<!-- Use single space instead of tabs -->
		<PROPERTY NAME="noTabs" VALUE="1"/>
		<PROPERTY NAME="tabSize" VALUE="1"/>
	</PROPS>
	
	<!-- General rules -->
	<RULES IGNORE_CASE="FALSE">
		<SPAN AT_LINE_START="TRUE" DELEGATE="VCALENDAR" NO_LINE_BREAK="FALSE" MATCH_TYPE="KEYWORD1">
			<BEGIN>BEGIN:VCALENDAR</BEGIN>
			<END>END:VCALENDAR</END>
		</SPAN>
	</RULES>

	<!-- Entire calendar -->
	<RULES SET="VCALENDAR" IGNORE_CASE="FALSE">
		<!-- Time zone settings -->
		<SPAN AT_LINE_START="TRUE" DELEGATE="VTIMEZONE" NO_LINE_BREAK="FALSE" MATCH_TYPE="KEYWORD1">
			<BEGIN>BEGIN:VTIMEZONE</BEGIN>
			<END>END:VTIMEZONE</END>
		</SPAN>

		<!-- Event -->
		<SPAN AT_LINE_START="TRUE" DELEGATE="VEVENT" NO_LINE_BREAK="FALSE" MATCH_TYPE="KEYWORD1">
			<BEGIN>BEGIN:VEVENT</BEGIN>
			<END>END:VEVENT</END>
		</SPAN>

		<!-- TODO (treated like event for now) -->
		<SPAN AT_LINE_START="TRUE" DELEGATE="VEVENT" NO_LINE_BREAK="FALSE" MATCH_TYPE="KEYWORD1">
			<BEGIN>BEGIN:VTODO</BEGIN>
			<END>END:VTODO</END>
		</SPAN>

		<!-- Journal (treated like event for now) -->
		<SPAN AT_LINE_START="TRUE" DELEGATE="VEVENT" NO_LINE_BREAK="FALSE" MATCH_TYPE="KEYWORD1">
			<BEGIN>BEGIN:VJOURNAL</BEGIN>
			<END>END:VJOURNAL</END>
		</SPAN>

		<KEYWORDS>
			<KEYWORD2>CALSCALE</KEYWORD2>
			<LITERAL2>GREGORIAN</LITERAL2>
			<KEYWORD2>METHOD</KEYWORD2>
			<KEYWORD2>PRODID</KEYWORD2>
			<KEYWORD2>VERSION</KEYWORD2>
			<LITERAL2>2.0</LITERAL2>
		</KEYWORDS>
	</RULES>

	<!-- Time zone settings -->
	<RULES SET="VTIMEZONE" IGNORE_CASE="FALSE">
		<!-- Daylight savings settings -->
		<SPAN AT_LINE_START="TRUE" DELEGATE="DAYLIGHT" NO_LINE_BREAK="FALSE" MATCH_TYPE="KEYWORD1">
			<BEGIN>BEGIN:DAYLIGHT</BEGIN>
			<END>END:DAYLIGHT</END>
		</SPAN>

		<!-- Time zone standard settings -->
		<SPAN AT_LINE_START="TRUE" DELEGATE="STANDARD" NO_LINE_BREAK="FALSE" MATCH_TYPE="KEYWORD1">
			<BEGIN>BEGIN:STANDARD</BEGIN>
			<END>END:STANDARD</END>
		</SPAN>

		<IMPORT DELEGATE="CUSTOM_KEYWORDS"/>

		<KEYWORDS>
			<KEYWORD2>TZID</KEYWORD2>
		</KEYWORDS>
	</RULES>

	<!-- Daylight savings settings -->
	<RULES SET="DAYLIGHT" IGNORE_CASE="FALSE">
		<IMPORT DELEGATE="VCALENDAR_KEYWORDS"/>
		<IMPORT DELEGATE="VTIMEZONE_KEYWORDS"/>
	</RULES>

	<!-- Time zone standard settings -->
	<RULES SET="STANDARD" IGNORE_CASE="FALSE">
		<IMPORT DELEGATE="VCALENDAR_KEYWORDS"/>
		<IMPORT DELEGATE="VTIMEZONE_KEYWORDS"/>
	</RULES>
	
	<!-- Event -->
	<RULES SET="VEVENT" IGNORE_CASE="FALSE">
		<!-- Alarm -->
		<SPAN AT_LINE_START="TRUE" DELEGATE="VALARM" NO_LINE_BREAK="FALSE" MATCH_TYPE="KEYWORD1">
			<BEGIN>BEGIN:VALARM</BEGIN>
			<END>END:VALARM</END>
		</SPAN>

		<IMPORT DELEGATE="VCALENDAR_KEYWORDS"/>
		<IMPORT DELEGATE="CUSTOM_KEYWORDS"/>
		<IMPORT DELEGATE="VEVENT_KEYWORDS"/>

		<KEYWORDS>
			<KEYWORD2>ATTENDEE</KEYWORD2>
			<KEYWORD2>CATEGORIES</KEYWORD2>
			<KEYWORD2>CLASS</KEYWORD2>
			<LITERAL2>CONFIDENTIAL</LITERAL2>
			<LITERAL2>PRIVATE</LITERAL2>
			<LITERAL2>PUBLIC</LITERAL2>
			<KEYWORD2>COMPLETED</KEYWORD2>
			<KEYWORD2>CREATED</KEYWORD2>
			<KEYWORD2>DESCRIPTION</KEYWORD2>
			<KEYWORD2>DTEND</KEYWORD2>
			<KEYWORD2>DTSTAMP</KEYWORD2>
			<KEYWORD2>DTSTART</KEYWORD2>
			<KEYWORD2>DUE</KEYWORD2>
			<KEYWORD2>LAST-MODIFIED</KEYWORD2>
			<KEYWORD2>LOCATION</KEYWORD2>
			<KEYWORD2>PERCENT-COMPLETE</KEYWORD2>
			<KEYWORD2>PRIORITY</KEYWORD2>
			<KEYWORD2>RECURRENCE-ID</KEYWORD2>
			<KEYWORD3>RSVP</KEYWORD3>
			<LITERAL3>FALSE</LITERAL3>
			<LITERAL3>TRUE</LITERAL3>
			<KEYWORD2>SEQUENCE</KEYWORD2>
			<KEYWORD2>STATUS</KEYWORD2>
			<KEYWORD2>SUMMARY</KEYWORD2>
			<KEYWORD2>TRANSP</KEYWORD2>
			<LITERAL2>OPAQUE</LITERAL2>
			<LITERAL2>TRANSPARENT</LITERAL2>
			<KEYWORD2>UID</KEYWORD2>
			<KEYWORD2>URL</KEYWORD2>
			<KEYWORD3>TZID</KEYWORD3>
		</KEYWORDS>
	</RULES>

	<!-- Alarm -->
	<RULES SET="VALARM" IGNORE_CASE="FALSE">
		<IMPORT DELEGATE="RIGHT"/>
		<IMPORT DELEGATE="CUSTOM_KEYWORDS"/>
		<IMPORT DELEGATE="VEVENT_KEYWORDS"/>

		<KEYWORDS>
			<KEYWORD2>ACTION</KEYWORD2>
			<KEYWORD2>DESCRIPTION</KEYWORD2>
			<KEYWORD2>TRIGGER</KEYWORD2>
		</KEYWORDS>
	</RULES>

	<!-- Colon + right side text -->
	<RULES SET="RIGHT" IGNORE_CASE="FALSE">
		<EOL_SPAN AT_LINE_START="FALSE" MATCH_TYPE="OPERATOR" DELEGATE="RIGHT_TEXT">:</EOL_SPAN>
	</RULES>

	<!-- Right side of the colon -->
	<RULES SET="RIGHT_TEXT" IGNORE_CASE="FALSE" DEFAULT="LITERAL4">
	</RULES>

	<RULES SET="VCALENDAR_KEYWORDS" IGNORE_CASE="FALSE">
		<KEYWORDS>
			<KEYWORD2>RRULE</KEYWORD2>
			<KEYWORD4>BYDAY</KEYWORD4>
			<KEYWORD4>BYMONTH</KEYWORD4>
			<KEYWORD4>FREQ</KEYWORD4>
			<KEYWORD4>INTERVAL</KEYWORD4>
			<LITERAL4>YEARLY</LITERAL4>
		</KEYWORDS>
	</RULES>

	<RULES SET="VTIMEZONE_KEYWORDS" IGNORE_CASE="FALSE">
		<KEYWORDS>
			<KEYWORD2>DTSTART</KEYWORD2>
			<KEYWORD2>TZNAME</KEYWORD2>
			<KEYWORD2>TZOFFSETFROM</KEYWORD2>
			<KEYWORD2>TZOFFSETTO</KEYWORD2>
		</KEYWORDS>
	</RULES>

	<RULES SET="VEVENT_KEYWORDS" IGNORE_CASE="FALSE">
		<KEYWORDS>
			<LITERAL2>CONFIRMED</LITERAL2>
			<LITERAL2>PRIVATE</LITERAL2>
			<KEYWORD3>VALUE</KEYWORD3>
			<LITERAL3>DATE</LITERAL3>
			<LITERAL3>DURATION</LITERAL3>
		</KEYWORDS>
	</RULES>

	<!-- Custom keywords -->
	<RULES SET="CUSTOM_KEYWORDS" IGNORE_CASE="FALSE">
		<SEQ_REGEXP HASH_CHAR="X" AT_LINE_START="TRUE" TYPE="INVALID">X-[A-Za-z-]+</SEQ_REGEXP>
	</RULES>
</MODE>

 	  	 
