<?xml version="1.0"?>

<!DOCTYPE MODE SYSTEM "xmode.dtd">

<MODE>
	<PROPS>
		<PROPERTY NAME="commentStart" VALUE="/*" />
		<PROPERTY NAME="commentEnd" VALUE="*/" />
		<PROPERTY NAME="lineComment" VALUE="//" />

		<!-- Auto indent -->
		<PROPERTY NAME="indentOpenBrackets" VALUE="{" />
		<PROPERTY NAME="indentCloseBrackets" VALUE="}" />
		<PROPERTY NAME="unalignedOpenBrackets" VALUE="(" />
		<PROPERTY NAME="unalignedCloseBrackets" VALUE=")" />
		<PROPERTY NAME="indentNextLine"
			VALUE="\s*(((if|while)\s*\(|else\s*|else\s+if\s*\(|for\s*\(.*\))[^{;]*)" />
		<PROPERTY NAME="unindentThisLine"
			VALUE="^.*(default:\s*|case.*:.*)$" />
		<PROPERTY NAME="electricKeys" VALUE=":" />
	</PROPS>
	<RULES IGNORE_CASE="FALSE"
		HIGHLIGHT_DIGITS="TRUE"
		DIGIT_RE="(0x[\p{XDigit}]+[lL]?|[\p{Digit}]+(e[\p{Digit}]*)?[lLdDfF]?)">
		
		<!-- Valadoc comment -->
		<SPAN TYPE="COMMENT3" DELEGATE="VALADOC">
			<BEGIN>/**</BEGIN>
			<END>*/</END>
		</SPAN>

		<SPAN TYPE="COMMENT1">
			<BEGIN>/*</BEGIN>
			<END>*/</END>
		</SPAN>

		<EOL_SPAN TYPE="COMMENT2">//</EOL_SPAN>

		<!-- string templates -->
		<SPAN TYPE="LITERAL2" NO_LINE_BREAK="TRUE">
			<BEGIN>@"</BEGIN>
			<END>"</END>
		</SPAN>
		
		<!-- verbatim strings -->
		<SPAN TYPE="LITERAL3" NO_LINE_BREAK="FALSE">
			<BEGIN>"""</BEGIN>
			<END>"""</END>
		</SPAN>

		<SPAN TYPE="LITERAL1" ESCAPE="\" NO_LINE_BREAK="TRUE">
			<BEGIN>"</BEGIN>
			<END>"</END>
		</SPAN>

		<SPAN TYPE="LITERAL1" ESCAPE="\" NO_LINE_BREAK="TRUE">
			<BEGIN>'</BEGIN>
			<END>'</END>
		</SPAN>

		<EOL_SPAN TYPE="KEYWORD2">#if</EOL_SPAN>
		<EOL_SPAN TYPE="KEYWORD2">#else</EOL_SPAN>
		<EOL_SPAN TYPE="KEYWORD2">#elif</EOL_SPAN>
		<EOL_SPAN TYPE="KEYWORD2">#endif</EOL_SPAN>
		<!-- TODO: check for other preprocessors? -->

		<SEQ TYPE="OPERATOR">~</SEQ>
		<SEQ TYPE="OPERATOR">!</SEQ>
		<SEQ TYPE="OPERATOR">:</SEQ>
		<SEQ TYPE="OPERATOR">;</SEQ>
		<SEQ TYPE="OPERATOR">{</SEQ>
		<SEQ TYPE="OPERATOR">}</SEQ>
		<SEQ TYPE="OPERATOR">,</SEQ>
		<SEQ TYPE="OPERATOR">.</SEQ>
		<SEQ TYPE="OPERATOR">!</SEQ>
		<SEQ TYPE="OPERATOR">[</SEQ>
		<SEQ TYPE="OPERATOR">]</SEQ>
		<SEQ TYPE="OPERATOR">+</SEQ>
		<SEQ TYPE="OPERATOR">-</SEQ>
		<SEQ TYPE="OPERATOR">&gt;</SEQ>
		<SEQ TYPE="OPERATOR">&lt;</SEQ>
		<SEQ TYPE="OPERATOR">=</SEQ>
		<SEQ TYPE="OPERATOR">*</SEQ>
		<SEQ TYPE="OPERATOR">/</SEQ>
		<SEQ TYPE="OPERATOR">\</SEQ>
		<SEQ TYPE="OPERATOR">^</SEQ>
		<SEQ TYPE="OPERATOR">|</SEQ>
		<SEQ TYPE="OPERATOR">&amp;</SEQ>
		<SEQ TYPE="OPERATOR">%</SEQ>
		<SEQ TYPE="OPERATOR">?</SEQ>

		<MARK_PREVIOUS TYPE="FUNCTION" MATCH_TYPE="OPERATOR">(</MARK_PREVIOUS>
		<SEQ TYPE="OPERATOR">)</SEQ>

		<KEYWORDS>
			<KEYWORD1>abstract</KEYWORD1>
			<KEYWORD1>as</KEYWORD1>
			<KEYWORD1>async</KEYWORD1>
			<KEYWORD1>base</KEYWORD1>
			<KEYWORD1>break</KEYWORD1>
			<KEYWORD1>case</KEYWORD1>
			<KEYWORD1>catch</KEYWORD1>
			<KEYWORD1>const</KEYWORD1>
			<KEYWORD1>construct</KEYWORD1>
			<KEYWORD1>continue</KEYWORD1>
			<KEYWORD1>default</KEYWORD1>
			<KEYWORD1>delegate</KEYWORD1>
			<KEYWORD1>delete</KEYWORD1>
			<KEYWORD1>do</KEYWORD1>
			<KEYWORD1>dynamic</KEYWORD1>
			<KEYWORD1>else</KEYWORD1>
			<KEYWORD1>ensures</KEYWORD1>
			<KEYWORD1>extern</KEYWORD1>
			<KEYWORD1>finally</KEYWORD1>
			<KEYWORD1>for</KEYWORD1>
			<KEYWORD1>foreach</KEYWORD1>
			<KEYWORD1>get</KEYWORD1>
			<KEYWORD1>global</KEYWORD1>
			<KEYWORD1>if</KEYWORD1>
			<KEYWORD1>in</KEYWORD1>
			<KEYWORD1>inline</KEYWORD1>
			<KEYWORD1>internal</KEYWORD1>
			<KEYWORD1>is</KEYWORD1>
			<KEYWORD1>lock</KEYWORD1>
			<KEYWORD1>new</KEYWORD1>
			<KEYWORD1>out</KEYWORD1>
			<KEYWORD1>override</KEYWORD1>
			<KEYWORD1>owned</KEYWORD1>
			<KEYWORD1>private</KEYWORD1>
			<KEYWORD1>protected</KEYWORD1>
			<KEYWORD1>public</KEYWORD1>
			<KEYWORD1>ref</KEYWORD1>
			<KEYWORD1>requires</KEYWORD1>
			<KEYWORD1>return</KEYWORD1>
			<KEYWORD1>set</KEYWORD1>
			<KEYWORD1>signal</KEYWORD1>
			<KEYWORD1>sizeof</KEYWORD1>
			<KEYWORD1>static</KEYWORD1>
			<KEYWORD1>switch</KEYWORD1>
			<KEYWORD1>throw</KEYWORD1>
			<KEYWORD1>throws</KEYWORD1>
			<KEYWORD1>try</KEYWORD1>
			<KEYWORD1>typeof</KEYWORD1>
			<KEYWORD1>unowned</KEYWORD1>
			<KEYWORD1>value</KEYWORD1>
			<KEYWORD1>virtual</KEYWORD1>
			<KEYWORD1>weak</KEYWORD1>
			<KEYWORD1>while</KEYWORD1>
			<KEYWORD1>yield</KEYWORD1>

			<KEYWORD2>using</KEYWORD2>
			<KEYWORD2>namespace</KEYWORD2>

			<KEYWORD3>bool</KEYWORD3>
			<KEYWORD3>char</KEYWORD3>
			<KEYWORD3>class</KEYWORD3>
			<KEYWORD3>delegate</KEYWORD3>
			<KEYWORD3>double</KEYWORD3>
			<KEYWORD3>dynamic</KEYWORD3>
			<KEYWORD3>enum</KEYWORD3>
			<KEYWORD3>errordomain</KEYWORD3>
			<KEYWORD3>float</KEYWORD3>
			<KEYWORD3>int</KEYWORD3>
			<KEYWORD3>int8</KEYWORD3>
			<KEYWORD3>int16</KEYWORD3>
			<KEYWORD3>int32</KEYWORD3>
			<KEYWORD3>int64</KEYWORD3>
			<KEYWORD3>interface</KEYWORD3>
			<KEYWORD3>long</KEYWORD3>
			<KEYWORD3>short</KEYWORD3>
			<KEYWORD3>string</KEYWORD3>
			<KEYWORD3>struct</KEYWORD3>
			<KEYWORD3>uchar</KEYWORD3>
			<KEYWORD3>uint</KEYWORD3>
			<KEYWORD3>uint8</KEYWORD3>
			<KEYWORD3>uint16</KEYWORD3>
			<KEYWORD3>uint32</KEYWORD3>
			<KEYWORD3>uint64</KEYWORD3>
			<KEYWORD3>ulong</KEYWORD3>
			<KEYWORD3>unichar</KEYWORD3>
			<KEYWORD3>ushort</KEYWORD3>
			<KEYWORD3>var</KEYWORD3>
			<KEYWORD3>void</KEYWORD3>

			<LITERAL2>false</LITERAL2>
			<LITERAL2>null</LITERAL2>
			<LITERAL2>this</LITERAL2>
			<LITERAL2>base</LITERAL2>
			<LITERAL2>true</LITERAL2>
		</KEYWORDS>
	</RULES>
	
	<!-- Copied from the Javadoc rules set -->
	<!-- TODO: verify these when http://live.gnome.org/Valadoc gets updated -->
	<RULES SET="VALADOC" DEFAULT="COMMENT3" IGNORE_CASE="TRUE">

		<!-- so that *@param is highlighted -->
		<SEQ TYPE="COMMENT3">*</SEQ>

		<!-- HTML comments -->
		<SPAN TYPE="COMMENT1">
			<BEGIN>&lt;!--</BEGIN>
			<END>--&gt;</END>
		</SPAN>

		<!-- Javadoc allows this -->
		<SEQ TYPE="COMMENT3">&lt;&lt;</SEQ>
		<SEQ TYPE="COMMENT3">&lt;=</SEQ>
		<SEQ TYPE="COMMENT3">&lt; </SEQ>

		<!-- strings in quotes -->
		<SPAN TYPE="LITERAL1" ESCAPE="\" NO_LINE_BREAK="TRUE">
		<BEGIN>&quot;</BEGIN>
		<END>&quot;</END>
		</SPAN>

		<!-- HTML tags -->
		<SPAN TYPE="MARKUP" DELEGATE="xml::TAGS"
			NO_LINE_BREAK="TRUE">
			<BEGIN>&lt;</BEGIN>
			<END>&gt;</END>
		</SPAN>

		<!-- so that @link{...} is highlighted -->
		<!-- XXX: this is wrong, {@link ..} is correct, see below -->
		<!--<SEQ TYPE="COMMENT3">{</SEQ>-->

		<SPAN_REGEXP TYPE="LABEL" HASH_CHAR="{@" NO_WORD_BREAK="FALSE" DELEGATE="VALADOC_PARAM">
			<BEGIN>\{@(link|linkplain|docRoot|code|literal)\s</BEGIN>
			<END>}</END>
		</SPAN_REGEXP>

		<!-- for the common usage of the cvs keyword $Id: java.xml 19829 2011-08-24 09:32:24Z kpouer $ -->
		<SPAN_REGEXP TYPE="LABEL" HASH_CHAR="@version" NO_WORD_BREAK="FALSE" DELEGATE="VALADOC_PARAM">
			<BEGIN>@version\s+\$</BEGIN>
			<END>$</END>
		</SPAN_REGEXP>

		<!-- This works only when you use the same whitespace before and after the param's name,
			 eg. a tab before and after, but mixing space and tab won't work.
			 The reason is that you can't enter a regexp in END, except for the backreference operator $n -->
		<SPAN_REGEXP TYPE="LABEL" HASH_CHAR="@" NO_WORD_BREAK="FALSE" DELEGATE="VALADOC_PARAM">
			<BEGIN>@(?:param|throws|exception|serialField)(\s)</BEGIN>
			<END>$1</END>
		</SPAN_REGEXP>

		<KEYWORDS>
		<!-- Note: the labels in comments are handled by SPANs above -->

		<!-- Official javadoc tags:
			 http://download.oracle.com/javase/6/docs/technotes/tools/windows/javadoc.html#javadoctags -->
			<LABEL>@author</LABEL>
			<LABEL>@deprecated</LABEL>
		<!--<LABEL>@docRoot</LABEL>-->
		<!--<LABEL>@exception</LABEL>-->
			<LABEL>{@inheritDoc}</LABEL>
		<!--<LABEL>@link</LABEL>-->
		<!--<LABEL>@linkplain</LABEL>-->
		<!--<LABEL>@param</LABEL>-->
			<LABEL>@return</LABEL>
			<LABEL>@see</LABEL>
			<LABEL>@serial</LABEL>
			<LABEL>@serialData</LABEL>
		<!--<LABEL>@serialField</LABEL>-->
			<LABEL>@since</LABEL>
		<!--<LABEL>@throws</LABEL>-->
			<LABEL>{@value}</LABEL>
			<LABEL>@version</LABEL>

		<!-- new in 1.5 -->
		<!--<LABEL>@code</LABEL>-->
		<!--<LABEL>@literal</LABEL>-->

		<!-- SUNs proposed tags:
			 http://java.sun.com/j2se/javadoc/proposed-tags.html -->
			<KEYWORD2>@category</KEYWORD2>
			<KEYWORD2>@example</KEYWORD2>
			<KEYWORD2>@exclude</KEYWORD2>
			<KEYWORD2>@index</KEYWORD2>
			<KEYWORD2>@internal</KEYWORD2>
			<KEYWORD2>@obsolete</KEYWORD2>
			<KEYWORD2>@threadsafety</KEYWORD2>
			<KEYWORD2>@tutorial</KEYWORD2>
			<KEYWORD2>@todo</KEYWORD2>

		<!-- Custom tags -->
			<KEYWORD4>@access</KEYWORD4>
			<KEYWORD4>@beaninfo</KEYWORD4>
			<KEYWORD4>@bon</KEYWORD4>
			<KEYWORD4>@bug</KEYWORD4>
			<KEYWORD4>@complexity</KEYWORD4>
			<KEYWORD4>@design</KEYWORD4>
			<KEYWORD4>@ensures</KEYWORD4>
			<KEYWORD4>@equivalent</KEYWORD4>
			<KEYWORD4>@generates</KEYWORD4>
			<KEYWORD4>@guard</KEYWORD4>
			<KEYWORD4>@hides</KEYWORD4>
			<KEYWORD4>@history</KEYWORD4>
			<KEYWORD4>@idea</KEYWORD4>
			<KEYWORD4>@invariant</KEYWORD4>
			<KEYWORD4>@modifies</KEYWORD4>
			<KEYWORD4>@overrides</KEYWORD4>
			<KEYWORD4>@post</KEYWORD4>
			<KEYWORD4>@pre</KEYWORD4>
			<KEYWORD4>@references</KEYWORD4>
			<KEYWORD4>@requires</KEYWORD4>
			<KEYWORD4>@review</KEYWORD4>
			<KEYWORD4>@spec</KEYWORD4>
			<KEYWORD4>@uses</KEYWORD4>
			<KEYWORD4>@values</KEYWORD4>
		</KEYWORDS>
	</RULES>
	<!-- just a dummy which makes use of the default token type COMMENT4 for highlighting the word after @param in javadoc -->
	<RULES SET="VALADOC_PARAM" DEFAULT="COMMENT4" IGNORE_CASE="TRUE" />

</MODE>

