php.xml 6.19 KB
Newer Older
JULIO JARAMILLO's avatar
JULIO JARAMILLO committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
<?xml version="1.0"?>
<!-- $Id: php.xml,v 1.1 2007-06-03 02:35:28 ssttoo Exp $ -->

<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>