<?xml version="1.0"?>
<!-- $Id: python.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp $ -->

<highlight lang="python" case="no">

  <authors>
    <author name="Andrey Demenev" email="demenev@gmail.com"/>
  </authors>

  <default innerClass="code" />

  <region name="strsingle3" delimClass="quotes" innerClass="string" 
          start="'''" end="'''" />

  <region name="strdouble3" delimClass="quotes" innerClass="string" 
          start="&quot;&quot;&quot;" end="&quot;&quot;&quot;">
  </region>

  <region name="strdouble" delimClass="quotes" innerClass="string" 
          start="&quot;" end="&quot;" >
  </region>
  
  <region name="strsingle" delimClass="quotes" innerClass="string" 
          start="'" end="'" />
  
  <region name="brackets" delimClass="brackets" innerClass="code" start="\(" end="\)" >
    <contains all="yes"/>
  </region>

  <region name="sqbrackets" delimClass="brackets" innerClass="code" start="\[" end="\]" >
    <contains all="yes"/>
  </region>

  <block name="escaped" match="\\." innerClass="special" contained="yes">
    <onlyin region="strsingle"/>
    <onlyin region="strsingle3"/>
    <onlyin region="strdouble"/>
    <onlyin region="strdouble3"/>
  </block>

  <block name="possiblefunction" match="[a-z_]\w*(?=\s*\()" innerClass="identifier" />

  <block name="identifier" match="[a-z_]\w*" innerClass="identifier" />

  <block name="exponent" 
         match="((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+)" 
         innerClass="number" />

  <block name="imaginary" match="((\d*\.\d+)|(\d+\.\d*)|(\d+))j" innerClass="number"/>

  <block name="float" match="(\d*\.\d+)|(\d+\.\d*)" innerClass="number"/>

  <block name="integer" match="\d+l?|\b0l?\b" innerClass="number" />

  <block name="hexinteger" match="0[xX][\da-f]+l?" innerClass="number" />

  <block name="octinteger" match="0[0-7]+l?" innerClass="number" />

  <block name="comment" innerClass="comment" 
          match="#.+" />

  <keywords name="reserved" inherits="identifier" innerClass="reserved" case = "yes">
    <keyword match="and"/>
    <keyword match="del"/>
    <keyword match="for"/>
    <keyword match="is"/>
    <keyword match="raise"/>
    <keyword match="assert"/>
    <keyword match="elif"/>
    <keyword match="from"/>
    <keyword match="lambda"/>
    <keyword match="return"/>
    <keyword match="break"/>
    <keyword match="else"/>
    <keyword match="global"/>
    <keyword match="not"/>
    <keyword match="try"/>
    <keyword match="class"/>
    <keyword match="except"/>
    <keyword match="if"/>
    <keyword match="or"/>
    <keyword match="while"/>
    <keyword match="continue"/>
    <keyword match="exec"/>
    <keyword match="import"/>
    <keyword match="pass"/>
    <keyword match="yield"/>
    <keyword match="def"/>
    <keyword match="finally"/>
    <keyword match="in"/>
    <keyword match="print"/>
    <keyword match="False"/>
    <keyword match="True"/>
    <keyword match="None"/>
    <keyword match="NotImplemented"/>
    <keyword match="Ellipsis"/>

    <keyword match="Exception" />
    <keyword match="SystemExit" />
    <keyword match="StopIteration" />
    <keyword match="StandardError" />
    <keyword match="KeyboardInterrupt" />
    <keyword match="ImportError" />
    <keyword match="EnvironmentError" />
    <keyword match="IOError" />
    <keyword match="OSError" />
    <keyword match="WindowsError" />
    <keyword match="EOFError" />
    <keyword match="RuntimeError" />
    <keyword match="NotImplementedError" />
    <keyword match="NameError" />
    <keyword match="UnboundLocalError" />

    <keyword match="AttributeError" />
    <keyword match="SyntaxError" />
    <keyword match="IndentationError" />
    <keyword match="TabError" />
    <keyword match="TypeError" />
    <keyword match="AssertionError" />
    <keyword match="LookupError" />
    <keyword match="IndexError" />
    <keyword match="KeyError" />
    <keyword match="ArithmeticError" />
    <keyword match="OverflowError" />
    <keyword match="ZeroDivisionError" />
    <keyword match="FloatingPointError" />
    <keyword match="ValueError" />
    <keyword match="UnicodeError" />
    <keyword match="UnicodeEncodeError" />
    <keyword match="UnicodeDecodeError" />

    <keyword match="UnicodeTranslateError" />
    <keyword match="ReferenceError" />
    <keyword match="SystemError" />
    <keyword match="MemoryError" />
    <keyword match="Warning" />
    <keyword match="UserWarning" />
    <keyword match="DeprecationWarning" />
    <keyword match="PendingDeprecationWarning" />
    <keyword match="SyntaxWarning" />
    <keyword match="OverflowWarning" />
    <keyword match="RuntimeWarning" />
    <keyword match="FutureWarning" />

  </keywords>

  <keywords name="builtin" inherits="possiblefunction" 
            innerClass="builtin" otherwise="identifier" case = "yes"> 
    <keyword match="__import__"/>

    <keyword match="abs"/>
    <keyword match="apply"/>
    <keyword match="basestring"/>
    <keyword match="bool"/>
    <keyword match="buffer"/>
    <keyword match="callable"/>
    <keyword match="chr"/>
    <keyword match="classmethod"/>
    <keyword match="cmp"/>

    <keyword match="coerce"/>
    <keyword match="compile"/>
    <keyword match="complex"/>
    <keyword match="delattr"/>
    <keyword match="dict"/>
    <keyword match="dir"/>
    <keyword match="divmod"/>
    <keyword match="enumerate"/>
    <keyword match="eval"/>

    <keyword match="execfile"/>
    <keyword match="file"/>
    <keyword match="filter"/>
    <keyword match="float"/>
    <keyword match="getattr"/>
    <keyword match="globals"/>
    <keyword match="hasattr"/>
    <keyword match="hash"/>
    <keyword match="help"/>

    <keyword match="hex"/>
    <keyword match="id"/>
    <keyword match="input"/>
    <keyword match="int"/>
    <keyword match="intern"/>
    <keyword match="isinstance"/>
    <keyword match="issubclass"/>
    <keyword match="iter"/>
    <keyword match="len"/>

    <keyword match="list"/>
    <keyword match="locals"/>
    <keyword match="long"/>
    <keyword match="map"/>
    <keyword match="max"/>
    <keyword match="min"/>
    <keyword match="object"/>
    <keyword match="oct"/>
    <keyword match="open"/>

    <keyword match="ord"/>
    <keyword match="pow"/>
    <keyword match="property"/>
    <keyword match="range"/>
    <keyword match="raw_input"/>
    <keyword match="reduce"/>
    <keyword match="reload"/>
    <keyword match="repr"/>
    <keyword match="round"/>

    <keyword match="setattr"/>
    <keyword match="slice"/>
    <keyword match="staticmethod"/>
    <keyword match="sum"/>
    <keyword match="super"/>
    <keyword match="str"/>
    <keyword match="tuple"/>
    <keyword match="type"/>
    <keyword match="unichr"/>

    <keyword match="unicode"/>
    <keyword match="vars"/>
    <keyword match="xrange"/>
    <keyword match="zip"/>
    
  </keywords>

</highlight>