<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="qlang" section="Sources"
          version="1.00" kateversion="2.4"
          indenter="cstyle"
          extensions="*.ql"
          mimetype="text/x-qlang"
		  package="qlang"
          priority="5"
          author="The Go Authors"
          license="BSD">
  <highlighting>
    <list name="keywords">
      <item> break </item>
      <item> case </item>
      <item> chan </item>
      <item> const </item>
      <item> continue </item>
      <item> default </item>
      <item> defer </item>
      <item> else </item>
      <item> fallthrough </item>
      <item> for </item>
      <item> fn </item>
      <item> go </item>
      <item> goto </item>
      <item> if </item>
      <item> import </item>
	  <item> export </item>
      <item> map </item>
      <item> include </item>
	  <item> import </item>
      <item> range </item>
      <item> return </item>
      <item> select </item>
      <item> class </item>
      <item> switch </item>
      <item> type </item>
	  <item> new </item>
    </list>
    <list name="predeclared">
	  <item> undefined </item>
      <item> false </item>
      <item> iota </item>
      <item> nil </item>
      <item> true </item>
    </list>
    <list name="types">
      <item> bool </item>
      <item> byte </item>
      <item> float </item>
      <item> int </item>
      <item> int8 </item>
      <item> int16 </item>
      <item> int32 </item>
      <item> int64 </item>
      <item> uint </item>
      <item> uint8 </item>
      <item> uint16 </item>
      <item> uint32 </item>
      <item> uint64 </item>
      <item> string </item>
    </list>
    <list name="builtin">
      <item> append </item>
	  <item> copy </item>
  	  <item> delete </item>
      <item> get </item>
      <item> len </item>	
      <item> cap </item>
      <item> mkmap </item>
      <item> mapFrom </item>	
	  <item> mapOf </item>
	  <item> panic </item>
	  <item> panicf </item>
      <item> printf </item>
      <item> println </item>
	  <item> set </item>
      <item> mkslice </item>
      <item> slice </item>
      <item> sliceFrom </item>
	  <item> sliceOf </item>
      <item> sub </item>
      <item> type </item>
	  <item> min </item>
	  <item> max </item>
      <item> main </item>	
    </list>
    <contexts>
      <context attribute="Normal Text" lineEndContext="#pop" name="Normal">
        <DetectSpaces/>
        <RegExpr attribute="Keyword" context="FuncDecl" String="^func\s*"/>
        <keyword attribute="Keyword" context="#pop" String="keywords"/>
        <keyword attribute="Predeclared Identifier" context="#stay" String="predeclared"/>
        <keyword attribute="Data Type" context="#stay" String="types"/>
        <keyword attribute="Builtin Function" context="#stay" String="builtin"/>
        <DetectIdentifier/>
        <DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="Brace1" />
        <DetectChar attribute="Symbol" context="#stay" char="}" endRegion="Brace1" />
        <DetectChar attribute="Symbol" context="#stay" char="(" beginRegion="Brace2" />
        <DetectChar attribute="Symbol" context="#stay" char=")" endRegion="Brace2" />
        <DetectChar attribute="Symbol" context="#stay" char="[" beginRegion="Brace3" />
        <DetectChar attribute="Symbol" context="#stay" char="]" endRegion="Brace3" />
        <RegExpr attribute="Numbers"  context="#stay" String="\-?\.\d*(e|e\-|e\+)?\d+i?\b"/>
        <RegExpr attribute="Numbers"  context="#stay" String="\-\d*\.?\d*(e|e\-|e\+)?\d+i?\b"/>
        <RegExpr attribute="Numbers"  context="#stay" String="\b\d*\.?\d*(e|e\-|e\+)?\d+i?\b"/>
        <RegExpr attribute="Numbers"  context="#stay" String="\b-?0[xX][0-9a-fA-F]+\b"/>
        <HlCOct attribute="Octal" context="#stay"/>
        <HlCHex attribute="Hex" context="#stay"/>
        <HlCChar attribute="Char" context="#stay"/>
        <DetectChar attribute="String" context="String" char="&quot;"/>
        <DetectChar attribute="String" context="Multiline String" char="`"/>
        <Detect2Chars attribute="Comment" context="Comment 1" char="/" char1="/"/>
        <Detect2Chars attribute="Comment" context="Comment 2" char="/" char1="*" beginRegion="Comment"/>
        <AnyChar attribute="Symbol" context="#stay" String=":!%&amp;()+,-/.*&lt;=&gt;?[]|~^&#59;"/>
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="FuncDecl">
        <DetectChar attribute="Symbol" context="MethodDecl" char="(" beginRegion="Brace2" />
        <DetectChar attribute="Symbol" context="#pop" char=")" endRegion="Brace2" />
        <RegExpr attribute="FuncDecl" context="#pop" String="[\w]+"/>
      </context>
      <context attribute="Normal Text" lineEndContext="#pop" name="MethodDecl">
        <DetectChar attribute="Symbol" context="#stay" char="(" beginRegion="Brace2" />
        <DetectChar attribute="Symbol" context="#pop" char=")" endRegion="Brace2" />
        <RegExpr attribute="Normal Text" context="#stay" String="\b[\w]+\s*\*?\w+\b"/>
        <RegExpr attribute="FuncDecl" context="#pop" String="[\w]+"/>
      </context>
      <context attribute="String" lineEndContext="#pop" name="String">
        <!--LineContinue attribute="String" context="#stay"/-->
        <HlCStringChar attribute="String Char" context="#stay"/>
        <RegExpr attribute="String Fmt" String="\%[+\-# 0]*(?:[0-9]*|\*)\.?(?:[0-9]*|\*)[vT%tbcdoqxXUeEfgGsp]" context="#stay"/>
        <DetectChar attribute="String" context="#pop" char="&quot;"/>
      </context>
      <context attribute="String" lineEndContext="#stay" name="Multiline String">
        <!--LineContinue attribute="String" context="#stay"/-->
        <!-- HlCStringChar attribute="String Char" context="#stay"/-->
        <DetectChar attribute="String" context="#pop" char="`"/>
      </context>
      <context attribute="Comment" lineEndContext="#pop" name="Comment 1">
        <!--LineContinue attribute="Comment" context="#stay"/-->
        <RegExpr attribute="TODO" String="\bTODO(?:\([^\)]+\)|\b)\:?" insensitive="true" context="#stay"/>
        <RegExpr attribute="TODO" String="\bBUG(?:\([^\)]+\)|\b)\:?" context="#stay"/>
        <RegExpr attribute="TODO" String="\bNOTE(?:\([^\)]+\)|\b)\:?" context="#stay"/>
        <RegExpr attribute="TODO" String="\bSECBUG(?:\([^\)]+\)|\b)\:?" context="#stay"/>
        <RegExpr attribute="TODO" String="\bFIXME(?:\([^\)]+\)|\b)\:?" context="#stay"/>
        <RegExpr attribute="TODO" String="\W!!!\:" context="#stay"/>
        <RegExpr attribute="TODO" String="\W\?\?\?\:" context="#stay"/>
      </context>
      <context attribute="Comment" lineEndContext="#stay" name="Comment 2">
        <RegExpr attribute="TODO" String="\bTODO(?:\([^\)]+\)|\b)\:?" insensitive="true" context="#stay"/>
        <RegExpr attribute="TODO" String="\bBUG(?:\([^\)]+\)|\b)\:?" context="#stay"/>
        <RegExpr attribute="TODO" String="\bNOTE(?:\([^\)]+\)|\b)\:?" context="#stay"/>
        <RegExpr attribute="TODO" String="\bSECBUG(?:\([^\)]+\)|\b)\:?" context="#stay"/>
        <RegExpr attribute="TODO" String="\bFIXME(?:\([^\)]+\)|\b)\:?" context="#stay"/>
        <RegExpr attribute="TODO" String="\W!!!\:" context="#stay"/>
        <RegExpr attribute="TODO" String="\W\?\?\?\:" context="#stay"/>
        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/>
      </context>
    </contexts>
    <itemDatas>
      <itemData name="Normal Text"  defStyleNum="dsNormal" spellChecking="false"/>
      <itemData name="Keyword"      defStyleNum="dsKeyword" spellChecking="false"/>
      <itemData name="Predeclared Identifier" defStyleNum="dsPredeclared" spellChecking="false"/>
      <itemData name="Builtin Function" defStyleNum="dsBuiltinFunc" spellChecking="false"/>
      <itemData name="Data Type"    defStyleNum="dsDataType" spellChecking="false"/>
      <itemData name="Numbers"      defStyleNum="dsDecVal" spellChecking="false"/>
      <itemData name="Decimal"      defStyleNum="dsDecVal" spellChecking="false"/>
      <itemData name="Octal"        defStyleNum="dsBaseN" spellChecking="false"/>
      <itemData name="Hex"          defStyleNum="dsBaseN" spellChecking="false"/>
      <itemData name="Float"        defStyleNum="dsFloat" spellChecking="false"/>
      <itemData name="Char"         defStyleNum="dsChar" spellChecking="false"/>
      <itemData name="String"       defStyleNum="dsString"/>
      <itemData name="FuncDecl"     defStyleNum="dsFuncDecl"/>
      <itemData name="String Char"  defStyleNum="dsChar"/>
      <itemData name="String Fmt"   defStyleNum="dsPlaceholder"/>
      <itemData name="Comment"      defStyleNum="dsComment"/>
      <itemData name="TODO"         defStyleNum="dsToDo"/>
      <itemData name="Symbol"       defStyleNum="dsSymbol" spellChecking="false"/>
      <itemData name="Error"        defStyleNum="dsError" spellChecking="false"/>
    </itemDatas>
  </highlighting>
  <general>
    <comments>
      <comment name="singleLine" start="//" />
      <comment name="multiLine" start="/*" end="*/" />
    </comments>
    <keywords casesensitive="1" additionalDeliminator="'&quot;" />
  </general>
</language>
