<?xml version="1.0"?>
<!-- $Id: php.xml 21 2005-02-04 07:08:05Z andrey $ -->

<highlight lang="php">

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


  <default innerClass="code" />

  <region name="phpCode" delimClass="inlinetags" innerClass="code"
          start="\&lt;\?(php|=)?" end="\?\>" never-contained="yes">
    <contains all="yes"/>
  </region>

  <region name="block" delimClass="brackets" innerClass="code" start="\{" end="\}" contained="yes">
    <contains all="yes"/>
  </region>

  <region name="brackets" delimClass="brackets" innerClass="code" start="\(" end="\)" contained="yes" >
    <contains all="yes"/>
  </region>

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


  <region name="mlcomment" innerClass="comment" start="\/\*" end="\*\/" contained="yes">
    <contains block="phpdoc"/>
    <contains block="cvstag"/>
  </region>

  <region name="strdouble" delimClass="quotes" innerClass="string" start="&quot;" end="&quot;" contained="yes">
    <contains block="var"/>
  </region>

  <region name="exec" delimClass="quotes" innerClass="string" start="`" end="`" contained="yes">
    <contains block="var"/>
  </region>

  <region name="heredoc" delimClass="quotes" innerClass="string" start="/\&lt;\&lt;\&lt;[\x20\x09]*(\w+)$/m" end="/^%1%;?$/m" contained="yes" remember="yes">
    <contains block="var"/>
  </region>

  <region name="strsingle" delimClass="quotes" innerClass="string" start="'" end="'" contained="yes"/>

  <block name="escaped" match="\\\\|\\&quot;|\\'|\\`" innerClass="special" contained="yes">
    <onlyin region="strsingle"/>
    <onlyin region="exec"/>
  </block>

  <block name="descaped" match="\\[\\&quot;'`tnr\$\{]" innerClass="special" contained="yes">
    <onlyin region="strdouble"/>
    <onlyin region="heredoc"/>
  </block>


  <region name="comment" start="(#|\/\/)" end="/$|(?=\?\>)/m" innerClass="comment" contained="yes">
    <contains block="cvstag"/>
  </region>


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

  <block name="typecast" match="\((array|int|integer|string|bool|boolean|object|float|double)\)" innerClass="reserved" contained="yes"/>

  <block name="curlyvar" match="\{\$[a-z_].*\}" innerClass="var" contained="yes">
    <onlyin region="strdouble"/>
    <onlyin region="heredoc"/>
    <onlyin region="exec"/>
  </block>

  <region name="codeescape" delimClass="inlinetags" innerClass="default" end="\&lt;\?(php|=)?" start="\?\>" contained="yes">
    <onlyin region="block"/>
  </region>

  <block name="hexinteger" match="0[xX][\da-f]+" innerClass="number" contained="yes"/>
  <block name="var" match="\$[a-z_]\w*" innerClass="var" contained="yes"/>

  <block name="integer" match="\d\d*|\b0\b" innerClass="number" contained="yes"/>


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

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

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

  <block name="phpdoc" match="\s@\w+\s" innerClass="inlinedoc" contained="yes">
    <onlyin region="mlcomment"/>
    <onlyin region="comment"/>
  </block>

  <block name="url" match="((https?|ftp):\/\/[\w\?\.\-\&amp;=\/%+]+)|(^|[\s,!?])www\.\w+\.\w+[\w\?\.\&amp;=\/%+]*" innerClass="url" contained="yes">
    <onlyin region="mlcomment"/>
    <onlyin region="comment"/>
  </block>
  
  <block name="email" match="\w+[\.\w\-]+@(\w+[\.\w\-])+" innerClass="url" contained="yes">
    <onlyin region="mlcomment"/>
    <onlyin region="comment"/>
  </block>
  
  <block name="note" match="\bnote:" innerClass="inlinedoc" contained="yes">
    <onlyin region="mlcomment"/>
    <onlyin region="comment"/>
  </block>
  

  <block name="cvstag" match="\$\w+\s*:.*\$" innerClass="inlinedoc" contained="yes">
    <onlyin region="mlcomment"/>
    <onlyin region="comment"/>
  </block>

  <keywords name="constants" inherits="identifier" innerClass="reserved" case = "yes">
    <keyword match="DIRECTORY_SEPARATOR"/>
    <keyword match="PATH_SEPARATOR"/>
  </keywords> 

  <keywords name="reserved" inherits="identifier" innerClass="reserved">
    <keyword match="echo"/>
    <keyword match="foreach"/>
    <keyword match="else"/>
    <keyword match="if"/>
    <keyword match="elseif"/>
    <keyword match="for"/>
    <keyword match="as"/>
    <keyword match="while"/>
    <keyword match="foreach"/>
    <keyword match="break"/>
    <keyword match="continue"/>
    <keyword match="class"/>
    <keyword match="const"/>
    <keyword match="declare"/>
    <keyword match="switch"/>
    <keyword match="case"/>
    <keyword match="endfor"/>
    <keyword match="endswitch"/>
    <keyword match="endforeach"/>
    <keyword match="endswitch"/>
    <keyword match="endif"/>
    <keyword match="array"/>
    <keyword match="default"/>
    <keyword match="do"/>
    <keyword match="enddeclare"/>
    <keyword match="eval"/>
    <keyword match="exit"/>
    <keyword match="die"/>
    <keyword match="extends"/>
    <keyword match="function"/>
    <keyword match="global"/>
    <keyword match="include"/>
    <keyword match="include_once"/>
    <keyword match="require"/>
    <keyword match="require_once"/>
    <keyword match="isset"/>
    <keyword match="empty"/>
    <keyword match="list"/>
    <keyword match="new"/>
    <keyword match="static"/>
    <keyword match="unset"/>
    <keyword match="var"/>
    <keyword match="return"/>
    <keyword match="try"/>
    <keyword match="catch"/>
    <keyword match="final"/>
    <keyword match="throw"/>
    <keyword match="public"/>
    <keyword match="private"/>
    <keyword match="protected"/>
    <keyword match="abstract"/>
    <keyword match="interface"/>
    <keyword match="implements"/>
    <keyword match="const"/>
    <keyword match="define"/>
    <keyword match="__FILE__"/>
    <keyword match="__LINE__"/>
    <keyword match="__CLASS__"/>
    <keyword match="__METHOD__"/>
    <keyword match="__FUNCTION__"/>
    <keyword match="NULL"/>
    <keyword match="true"/>
    <keyword match="false"/>
    <keyword match="and"/>
    <keyword match="or"/>
    <keyword match="xor"/>
  </keywords> 

</highlight>