<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (c) 2015 The Rust Project Developers

    Permission is hereby granted, free of charge, to any
    person obtaining a copy of this software and associated
    documentation files (the "Software"), to deal in the
    Software without restriction, including without
    limitation the rights to use, copy, modify, merge,
    publish, distribute, sublicense, and/or sell copies of
    the Software, and to permit persons to whom the Software
    is furnished to do so, subject to the following
    conditions:

    The above copyright notice and this permission notice
    shall be included in all copies or substantial portions
    of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
    ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
    TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
    PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
    SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
    IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.
-->
<!DOCTYPE language SYSTEM "language.dtd"
[
	<!-- FIXME: Kate's regex engine has very limited support for
	predefined char classes, so making rustIdent consistent with actual
	Rust identifiers will be a bit difficult -->
	<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
	<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?">
]>
<language name="Rust" version="1.0" kateversion="2.4" section="Sources" extensions="*.rs" mimetype="text/rust" priority="15">
<highlighting>
	<list name="fn">
		<item> fn </item>
	</list>
	<list name="type">
		<item> type </item>
	</list>
	<list name="reserved">
		<item> abstract </item>
		<item> alignof </item>
		<item> become </item>
		<item> do </item>
		<item> final </item>
		<item> offsetof </item>
		<item> override </item>
		<item> priv </item>
		<item> pure </item>
		<item> sizeof </item>
		<item> typeof </item>
		<item> unsized </item>
		<item> yield </item>
	</list>
	<list name="keywords">
		<item> as </item>
		<item> box </item>
		<item> break </item>
		<item> const </item>
		<item> continue </item>
		<item> crate </item>
		<item> else </item>
		<item> enum </item>
		<item> extern </item>
		<item> for </item>
		<item> if </item>
		<item> impl </item>
		<item> in </item>
		<item> let </item>
		<item> loop </item>
		<item> match </item>
		<item> mod </item>
		<item> move </item>
		<item> mut </item>
		<item> pub </item>
		<item> ref </item>
		<item> return </item>
		<item> static </item>
		<item> struct </item>
		<item> super </item>
		<item> trait </item>
		<item> unsafe </item>
		<item> use </item>
		<item> virtual </item>
		<item> where </item>
		<item> while </item>
	</list>
	<list name="traits">
		<item> AsSlice </item>
		<item> CharExt </item>
		<item> Clone </item>
		<item> Copy </item>
		<item> Debug </item>
		<item> Decodable </item>
		<item> Default </item>
		<item> Display </item>
		<item> DoubleEndedIterator </item>
		<item> Drop </item>
		<item> Encodable </item>
		<item> Eq </item>
		<item> Default </item>
		<item> Extend </item>
		<item> Fn </item>
		<item> FnMut </item>
		<item> FnOnce </item>
		<item> FromPrimitive </item>
		<item> Hash </item>
		<item> Iterator </item>
		<item> IteratorExt </item>
		<item> MutPtrExt </item>
		<item> Ord </item>
		<item> PartialEq </item>
		<item> PartialOrd </item>
		<item> PtrExt </item>
		<item> Rand </item>
		<item> Send </item>
		<item> Sized </item>
		<item> SliceConcatExt </item>
		<item> SliceExt </item>
		<item> Str </item>
		<item> StrExt </item>
		<item> Sync </item>
		<item> ToString </item>
	</list>
	<list name="types">
		<item> bool </item>
		<item> int </item>
		<item> isize </item>
		<item> uint </item>
		<item> usize </item>
		<item> i8 </item>
		<item> i16 </item>
		<item> i32 </item>
		<item> i64 </item>
		<item> u8 </item>
		<item> u16 </item>
		<item> u32 </item>
		<item> u64 </item>
		<item> f32 </item>
		<item> f64 </item>
		<item> float </item>
		<item> char </item>
		<item> str </item>
		<item> Option </item>
		<item> Result </item>
		<item> Self </item>
		<item> Box </item>
		<item> Vec </item>
		<item> String </item>
	</list>
	<list name="ctypes">
		<item> c_float </item>
		<item> c_double </item>
		<item> c_void </item>
		<item> FILE </item>
		<item> fpos_t </item>
		<item> DIR </item>
		<item> dirent </item>
		<item> c_char </item>
		<item> c_schar </item>
		<item> c_uchar </item>
		<item> c_short </item>
		<item> c_ushort </item>
		<item> c_int </item>
		<item> c_uint </item>
		<item> c_long </item>
		<item> c_ulong </item>
		<item> size_t </item>
		<item> ptrdiff_t </item>
		<item> clock_t </item>
		<item> time_t </item>
		<item> c_longlong </item>
		<item> c_ulonglong </item>
		<item> intptr_t </item>
		<item> uintptr_t </item>
		<item> off_t </item>
		<item> dev_t </item>
		<item> ino_t </item>
		<item> pid_t </item>
		<item> mode_t </item>
		<item> ssize_t </item>
	</list>
	<list name="self">
		<item> self </item>
	</list>
	<list name="constants">
		<item> true </item>
		<item> false </item>
		<item> Some </item>
		<item> None </item>
		<item> Ok </item>
		<item> Err </item>
		<item> Success </item>
		<item> Failure </item>
		<item> Cons </item>
		<item> Nil </item>
	</list>
	<list name="cconstants">
		<item> EXIT_FAILURE </item>
		<item> EXIT_SUCCESS </item>
		<item> RAND_MAX </item>
		<item> EOF </item>
		<item> SEEK_SET </item>
		<item> SEEK_CUR </item>
		<item> SEEK_END </item>
		<item> _IOFBF </item>
		<item> _IONBF </item>
		<item> _IOLBF </item>
		<item> BUFSIZ </item>
		<item> FOPEN_MAX </item>
		<item> FILENAME_MAX </item>
		<item> L_tmpnam </item>
		<item> TMP_MAX </item>
		<item> O_RDONLY </item>
		<item> O_WRONLY </item>
		<item> O_RDWR </item>
		<item> O_APPEND </item>
		<item> O_CREAT </item>
		<item> O_EXCL </item>
		<item> O_TRUNC </item>
		<item> S_IFIFO </item>
		<item> S_IFCHR </item>
		<item> S_IFBLK </item>
		<item> S_IFDIR </item>
		<item> S_IFREG </item>
		<item> S_IFMT </item>
		<item> S_IEXEC </item>
		<item> S_IWRITE </item>
		<item> S_IREAD </item>
		<item> S_IRWXU </item>
		<item> S_IXUSR </item>
		<item> S_IWUSR </item>
		<item> S_IRUSR </item>
		<item> F_OK </item>
		<item> R_OK </item>
		<item> W_OK </item>
		<item> X_OK </item>
		<item> STDIN_FILENO </item>
		<item> STDOUT_FILENO </item>
		<item> STDERR_FILENO </item>
	</list>
	<contexts>
		<context attribute="Normal Text" lineEndContext="#stay" name="Normal">
			<DetectSpaces/>
			<keyword String="fn" attribute="Keyword" context="Function"/>
			<keyword String="type" attribute="Keyword" context="Type"/>
			<keyword String="reserved" attribute="Keyword" context="#stay"/>
			<keyword String="keywords" attribute="Keyword" context="#stay"/>
			<keyword String="types" attribute="Type" context="#stay"/>
			<keyword String="traits" attribute="Trait" context="#stay"/>
			<keyword String="ctypes" attribute="CType" context="#stay"/>
			<keyword String="self" attribute="Self" context="#stay"/>
			<keyword String="constants" attribute="Constant" context="#stay"/>
			<keyword String="cconstants" attribute="CConstant" context="#stay"/>
			<Detect2Chars char="/" char1="/" attribute="Comment" context="Commentar 1"/>
			<Detect2Chars char="/" char1="*" attribute="Comment" context="Commentar 2" beginRegion="Comment"/>
			<RegExpr String="0x[0-9a-fA-F_]+&rustIntSuf;" attribute="Number" context="#stay"/>
			<RegExpr String="0o[0-7_]+&rustIntSuf;" attribute="Number" context="#stay"/>
			<RegExpr String="0b[0-1_]+&rustIntSuf;" attribute="Number" context="#stay"/>
			<RegExpr String="[0-9][0-9_]*\.[0-9_]*([eE][+-]?[0-9_]+)?(f32|f64|f)?" attribute="Number" context="#stay"/>
			<RegExpr String="[0-9][0-9_]*&rustIntSuf;" attribute="Number" context="#stay"/>
			<Detect2Chars char="#" char1="[" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
			<StringDetect String="#![" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
			<RegExpr String="&rustIdent;::" attribute="Scope"/>
			<RegExpr String="&rustIdent;!" attribute="Macro"/>
			<RegExpr String="&apos;&rustIdent;(?!&apos;)" attribute="Lifetime"/>
			<DetectChar char="{" attribute="Symbol" context="#stay" beginRegion="Brace" />
			<DetectChar char="}" attribute="Symbol" context="#stay" endRegion="Brace" />
                        <Detect2Chars char="r" char1="&quot;" attribute="String" context="RawString"/>
                        <StringDetect String="r##&quot;" attribute="String" context="RawHashed2"/>
                        <StringDetect String="r#&quot;" attribute="String" context="RawHashed1"/>
			<DetectChar char="&quot;" attribute="String" context="String"/>
			<DetectChar char="&apos;" attribute="Character" context="Character"/>
			<DetectChar char="[" attribute="Symbol" context="#stay" beginRegion="Bracket" />
			<DetectChar char="]" attribute="Symbol" context="#stay" endRegion="Bracket" />
			<DetectIdentifier/>
		</context>
		<context attribute="Attribute" lineEndContext="#stay" name="Attribute">
			<DetectChar char="]" attribute="Attribute" context="#pop" endRegion="Attribute"/>
			<IncludeRules context="Normal"/>
		</context>
		<context attribute="Definition" lineEndContext="#stay" name="Function">
			<DetectSpaces/>
			<DetectChar char="(" attribute="Normal Text" context="#pop"/>
			<DetectChar char="&lt;" attribute="Normal Text" context="#pop"/>
		</context>
		<context attribute="Definition" lineEndContext="#stay" name="Type">
			<DetectSpaces/>
			<DetectChar char="=" attribute="Normal Text" context="#pop"/>
			<DetectChar char="&lt;" attribute="Normal Text" context="#pop"/>
			<DetectChar char=";" attribute="Normal Text" context="#pop"/>
		</context>
                <!-- Rustc allows strings to extend over multiple lines, and the
                only thing a backshash at end-of-line does is remove the whitespace. -->
                <context attribute="String" lineEndContext="#stay" name="String">
                        <DetectChar char="\" attribute="CharEscape" context="CharEscape"/>
                        <DetectChar attribute="String" context="#pop" char="&quot;"/>
                </context>
		<context attribute="String" lineEndContext="#stay" name="RawString">
			<DetectChar attribute="String" context="#pop" char="&quot;"/>
		</context>
                <!-- These rules are't complete: they won't match r###"abc"### -->
                <context attribute="String" lineEndContext="#stay" name="RawHashed1">
                        <Detect2Chars attribute="String" context="#pop" char="&quot;" char1="#"/>
                </context>
                <context attribute="String" lineEndContext="#stay" name="RawHashed2">
                        <StringDetect attribute="String" context="#pop" String="&quot;##"/>
                </context>
		<context attribute="Character" lineEndContext="#pop" name="Character">
			<DetectChar char="\" attribute="CharEscape" context="CharEscape"/>
			<DetectChar attribute="Character" context="#pop" char="&apos;"/>
		</context>
		<context attribute="CharEscape" lineEndContext="#pop" name="CharEscape">
			<AnyChar String="nrt\&apos;&quot;" attribute="CharEscape" context="#pop"/>
			<RegExpr String="x[0-9a-fA-F]{2}" attribute="CharEscape" context="#pop"/>
			<RegExpr String="u\{[0-9a-fA-F]{1,6}\}" attribute="CharEscape" context="#pop"/>
			<RegExpr String="u[0-9a-fA-F]{4}" attribute="CharEscape" context="#pop"/>
			<RegExpr String="U[0-9a-fA-F]{8}" attribute="CharEscape" context="#pop"/>
			<RegExpr String="." attribute="Error" context="#pop"/>
		</context>
		<context attribute="Comment" lineEndContext="#pop" name="Commentar 1"/>
		<context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
			<DetectSpaces/>
			<Detect2Chars char="*" char1="/" attribute="Comment" context="#pop" endRegion="Comment"/>
		</context>
	</contexts>
	<itemDatas>
		<itemData name="Normal Text"  defStyleNum="dsNormal"/>
		<itemData name="Keyword"      defStyleNum="dsKeyword" color="#770088" bold="1"/>
		<itemData name="Self"         defStyleNum="dsKeyword" color="#FF0000" bold="1"/>
		<itemData name="Type"         defStyleNum="dsKeyword" color="#4e9a06" bold="1"/>
		<itemData name="Trait"        defStyleNum="dsKeyword" color="#4e9a06" bold="1"/>
		<itemData name="CType"        defStyleNum="dsNormal" color="#4e9a06"/>
		<itemData name="Constant"     defStyleNum="dsKeyword" color="#116644"/>
		<itemData name="CConstant"    defStyleNum="dsNormal" color="#116644"/>
		<itemData name="Definition"   defStyleNum="dsNormal" color="#0000FF"/>
		<itemData name="Comment"      defStyleNum="dsComment" color="#AA5500"/>
		<itemData name="Scope"        defStyleNum="dsNormal" color="#0055AA"/>
		<itemData name="Number"       defStyleNum="dsDecVal" color="#116644"/>
		<itemData name="String"       defStyleNum="dsString" color="#FF0000"/>
		<itemData name="CharEscape"   defStyleNum="dsChar" color="#FF0000" bold="1"/>
		<itemData name="Character"    defStyleNum="dsChar" color="#FF0000"/>
		<itemData name="Macro"        defStyleNum="dsOthers"/>
		<itemData name="Attribute"    defStyleNum="dsOthers"/>
		<itemData name="Lifetime"     defStyleNum="dsOthers" bold="1"/>
		<itemData name="Error"        defStyleNum="dsError"/>
	</itemDatas>
</highlighting>
<general>
	<comments>
		<comment name="singleLine" start="//" />
		<comment name="multiLine" start="/*" end="*/" region="Comment"/>
	</comments>
	<keywords casesensitive="1" />
</general>
</language>

