<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="AWK" version="0.93" kateversion="3.3" section="Scripts"
  extensions="*.awk" mimetype="text/x-awk" indenter="cstyle"
  license="LGPL">
<!-- patched by igli#kate@irc:chat.freenode.net -->
  <highlighting>
    <list name="keywords">
      <item>if</item>
      <item>else</item>
      <item>while</item>
      <item>do</item>
      <item>for</item>
      <item>in</item>
      <item>continue</item>
      <item>break</item>
      <item>print</item>
      <item>printf</item>
      <item>getline</item>
      <item>function</item>
      <item>return</item>
      <item>next</item>
      <item>exit</item>
    </list>
    <list name="builtins">
      <item>ARGC</item>
      <item>ARGV</item>
      <item>CONVFMT</item>
      <item>ENVIRON</item>
      <item>FILENAME</item>
      <item>FNR</item>
      <item>FS</item>
      <item>NF</item>
      <item>NR</item>
      <item>OFMT</item>
      <item>OFS</item>
      <item>ORS</item>
      <item>RS</item>
      <item>RSTART</item>
      <item>RLENGTH</item>
      <item>SUBSEP</item>
    </list>
    <list name="functions">
      <item>gsub</item>
      <item>gensub</item>
      <item>index</item>
      <item>length</item>
      <item>match</item>
      <item>split</item>
      <item>sprintf</item>
      <item>sub</item>
      <item>substr</item>
      <item>tolower</item>
      <item>toupper</item>
      <item>atan2</item>
      <item>cos</item>
      <item>exp</item>
      <item>int</item>
      <item>log</item>
      <item>rand</item>
      <item>sin</item>
      <item>sqrt</item>
      <item>srand</item>
      <item>close</item>
      <item>fflush</item>
      <item>system</item>
    </list>
    <list name="special">
      <item> BEGIN </item>
      <item> END </item>
    </list>

<contexts>
<!-- START CONTEXTS -->
<context name="Pattern" attribute="Normal" lineEndContext="#stay">
	<DetectChar char="{" context="Block" attribute="Keyword" beginRegion="block" />
	<DetectChar char="}" attribute="Error" context="#stay"/>
	<DetectChar char="/" firstNonSpace="true" lookAhead="true" context="MatchPattern"/>
	<IncludeRules context="base" />
	<keyword String="special" attribute="Special" context="#stay"/>
</context>

<context name="Block" attribute="Normal" lineEndContext="#stay">
	<DetectChar char="}" attribute="Keyword" context="#pop" endRegion="block" />
	<DetectChar char="{" context="Block" attribute="Keyword" beginRegion="block" />
	<IncludeRules context="base" />
	<keyword String="special" attribute="Error" context="#stay"/>
</context>

<context name="base" attribute="Normal" lineEndContext="#stay">
	<DetectSpaces />
	<DetectChar char="#" context="Comment" attribute="Comment"/>
	<DetectChar char="~" context="Match" attribute="Operator"/>
	<DetectChar char="&quot;" context="String" attribute="String"/>
	<AnyChar String="!%&amp;*+,-./:;&lt;=&gt;?^|" attribute="Operator" context="#stay"/>
	<keyword String="keywords" attribute="Keyword" context="#stay"/>
	<keyword String="builtins" attribute="Builtin" context="#stay"/>
	<keyword String="functions" attribute="Function" context="#stay"/>
	<Float attribute="Float"   context="#stay"/>
	<Int   attribute="Decimal" context="#stay"/>
	<RegExpr String="\$[A-Za-z0-9_]+" attribute="Field" context="#stay"/>
</context>

<context name="String" attribute="String" lineEndContext="#stay">
	<DetectChar char="&quot;" attribute="String" context="#pop"/>
	<HlCStringChar attribute="Escape" context="#stay"/>
	<DetectChar char="\" context="Escape" attribute="Operator"/>
</context>

<context name="Comment" attribute="Comment" lineEndContext="#pop">
	<IncludeRules context="##Alerts"/>
</context>

<context name="Escape" attribute="Normal" lineEndContext="#pop">
	<RegExpr String="." attribute="String" context="#pop"/>
</context>

<context name="Match" attribute="Normal" lineEndContext="#pop"
   fallthrough="true" fallthroughContext="#pop">
	<DetectSpaces />
	<Detect2Chars char="/" char1="^" attribute="Regex Op" context="Regex"/>
	<DetectChar char="/" attribute="Regex Op" context="Regex"/>
</context>
<context name="Regex" attribute="Regex" lineEndContext="#stay">
	<IncludeRules context="regex"/>
	<DetectChar char="/" context="#pop#pop" attribute="Regex Op"/>
</context>
<context name="regex" attribute="Normal" lineEndContext="#stay">
	<HlCStringChar attribute="Escape" context="#stay"/>
	<DetectChar char="\" context="Regex Escape" attribute="Regex Op"/>
	<Detect2Chars char="[" char1="^" context="RegexChar" attribute="Regex Op"/>
	<DetectChar char="[" context="RegexChar" attribute="Regex Op"/>
	<AnyChar String="$.+?*()|" context="#stay" attribute="Regex Op"/>
</context>
<context name="Regex Escape" attribute="Normal" lineEndContext="#pop">
	<RegExpr String="." attribute="Regex" context="#pop"/>
</context>

<context name="RegexChar" attribute="Regex" lineEndContext="#pop"
   fallthrough="true" fallthroughContext="InChar">
	<Detect2Chars char="-" char1="]" context="InChar" attribute="Regex"/>
	<AnyChar String="-]" context="InChar" attribute="Regex"/>
</context>
<context name="InChar" attribute="Regex" lineEndContext="#stay">
	<HlCStringChar attribute="String" context="#stay"/>
	<DetectChar char="\" context="Regex Escape" attribute="Regex Op"/>
	<Detect2Chars char="-" char1="]" context="Regex Escape" lookAhead="true"/>
	<DetectChar char="]" context="#pop#pop" attribute="Regex Op"/>
	<DetectChar char="-" context="#stay" attribute="Regex Op"/>
	<RegExpr String="\[:(?=[_\w][_\d\w]*:\])" context="CharClass" attribute="Regex Op"/>
</context>
<context name="CharClass" attribute="Custom" lineEndContext="#pop">
	<RegExpr String="(alpha|alnum|blank|cntrl|digit|graph|lower|punct|space|upper|xdigit)(?=:\])"
		attribute="CharClass" context="#stay"/>
	<Detect2Chars char=":" char1="]" attribute="Regex Op" context="#pop"/>
</context>

<context name="MatchPattern" attribute="Normal" lineEndContext="#pop"
   fallthrough="true" fallthroughContext="#pop">
	<Detect2Chars char="/" char1="^" attribute="Regex Op" context="RegexPattern"/>
	<DetectChar char="/" attribute="Regex Op" context="RegexPattern"/>
</context>
<context name="RegexPattern" attribute="Regex" lineEndContext="#stay">
	<IncludeRules context="regex"/>
	<DetectChar char="/" context="CheckRange" attribute="Regex Op"/>
</context>
<context name="CheckRange" attribute="Normal" lineEndContext="#pop#pop#pop"
   fallthrough="true" fallthroughContext="#pop#pop#pop">
	<RegExpr String="\s*,\s*(?=/)" context="RangePattern" attribute="Operator"/>
</context>
<context name="RangePattern" attribute="Normal" lineEndContext="#pop#pop#pop#pop"
   fallthrough="true" fallthroughContext="#pop#pop#pop#pop">
	<Detect2Chars char="/" char1="^" attribute="Regex Op" context="Pattern2"/>
	<DetectChar char="/" attribute="Regex Op" context="Pattern2"/>
</context>
<context name="Pattern2" attribute="Regex" lineEndContext="#stay">
	<IncludeRules context="regex"/>
	<DetectChar char="/" context="#pop#pop#pop#pop#pop" attribute="Regex Op"/>
</context>

<!-- END OF CONTEXTS -->
</contexts>
    <itemDatas>
      <itemData name="Normal"   defStyleNum="dsNormal"/>
      <itemData name="Keyword"  defStyleNum="dsKeyword"/>
      <itemData name="Builtin"  defStyleNum="dsNormal" color="#CC8822"/>
      <itemData name="Function" defStyleNum="dsFunction"/>
      <itemData name="Decimal"  defStyleNum="dsDecVal"/>
      <itemData name="Float"    defStyleNum="dsFloat"/>
      <itemData name="String"   defStyleNum="dsString"/>
      <itemData name="Comment"  defStyleNum="dsComment"/>
	<itemData name="Escape"   defStyleNum="dsString" color="#4A5704"/>
   <itemData name="Field"    defStyleNum="dsDataType"/>
	<itemData name="Error"    defStyleNum="dsError"/>
	<itemData name="Special"  defStyleNum="dsKeyword" color="#FF9225" bold="0"/>
	<itemData name="Operator"    defStyleNum="dsNormal" color="#FF80E0"/>
	<itemData name="Regex"       defStyleNum="dsString" color="#4A5704"/>
	<itemData name="Regex Op"    defStyleNum="dsOthers" color="#FF80E0"/>
	<itemData name="CharClass"   defStyleNum="dsString" color="#008080"/>
	<itemData name="Custom"      defStyleNum="dsString" color="#449944"/>
    </itemDatas>
  </highlighting>
  <general>
    <comments>
      <comment name="singleLine" start="#"/>
    </comments>
    <keywords casesensitive="1" />
  </general>
</language>
