perl.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <?xml version="1.0"?>
  2. <!-- $Id: perl.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp $ -->
  3. <highlight lang="perl" case = "yes">
  4. <authors>
  5. <author name="Mariusz 'kg' Jakubowski" email="kg@alternatywa.info" jid="kg@chrome.pl"/>
  6. <author name="Andrey Demenev" email="demenev@gmail.com"/>
  7. </authors>
  8. <comment>This highlighter is EXPERIMENTAL, so that it may work incorrectly.
  9. Most rules were created by Mariusz Jakubowski, and extended by me.
  10. My knowledge of Perl is poor, and Perl syntax seems too
  11. complicated to me.</comment>
  12. <default innerClass="code"/>
  13. <block name="interpreter" match="/^(#!)(.*)/m" innerClass="special">
  14. <partClass index="1" innerClass="special" />
  15. <partClass index="2" innerClass="string" />
  16. </block>
  17. <region name="pod" innerClass="comment" start="/^=\w+/m" end="/^=cut[^\n]*/m" startBOL="yes" endBOL="yes"/>
  18. <!--
  19. brackets
  20. -->
  21. <region name="block" delimClass="brackets" innerClass="code" start="\{" end="\}">
  22. <contains all="yes"/>
  23. </region>
  24. <region name="brackets" delimClass="brackets" innerClass="code" start="\(" end="\)">
  25. <contains all="yes"/>
  26. </region>
  27. <region name="sqbrackets" delimClass="brackets" innerClass="code" start="\[" end="\]">
  28. <contains all="yes"/>
  29. </region>
  30. <!--
  31. use smth
  32. -->
  33. <block name="usestatement" match="(use)\s+([\w:]*)" innerClass="special">
  34. <partClass index="1" innerClass="reserved" />
  35. <partClass index="2" innerClass="special" />
  36. </block>
  37. <block name="packagereference" match="[&amp; ](\w{2,}::)+\w{2,}" innerClass="special"/>
  38. <region name="q-w-q-statement"
  39. start="/\b(q[wq]\s*((\{)|(\()|(\[)|(\&lt;)|([\W\S])))(?=(.*)((?(3)\})(?(4)\))(?(5)\])(?(6)\&gt;)(?(7)\7)))/Us"
  40. end="%b2%"
  41. innerClass="string" delimClass="quotes" remember="yes">
  42. <contains block="containedvar"/>
  43. <contains block="specialvar"/>
  44. <contains block="curlyvar"/>
  45. </region>
  46. <region name="qstatement"
  47. start="/\b(q\s*((\{)|(\()|(\[)|(\&lt;)|([\W\S])))(?=(.*)((?(3)\})(?(4)\))(?(5)\])(?(6)\&gt;)(?(7)\7)))/Us"
  48. end="%b2%"
  49. innerClass="string" delimClass="quotes" remember="yes">
  50. </region>
  51. <!--
  52. comments
  53. -->
  54. <block name="comment" match="#.*" innerClass="comment" />
  55. <!--
  56. regexpr
  57. FIXME: this should be rewrited
  58. -->
  59. <block name="dblregexprver1" match="/(s|tr) ([|#~`!@$%^&amp;*-+=\\;:'&quot;,.\/?]) ((\\.|[^\\])*?) (\2)((\\.|[^\\])*?)(\2[ecgimosx]*)/x" innerClass="string">
  60. <partClass index="1" innerClass="quotes" />
  61. <partClass index="2" innerClass="quotes" />
  62. <partClass index="3" innerClass="string" />
  63. <partClass index="5" innerClass="quotes" />
  64. <partClass index="6" innerClass="string" />
  65. <partClass index="8" innerClass="quotes" />
  66. </block>
  67. <block name="dblregexprver2" match="/(m) ([|#~`!@$%^&amp;*-+=\\;:'&quot;,.\/?]) ((\\.|[^\\])*?) (\2[ecgimosx]*)/x" innerClass="string">
  68. <partClass index="1" innerClass="quotes" />
  69. <partClass index="2" innerClass="quotes" />
  70. <partClass index="3" innerClass="string" />
  71. <partClass index="5" innerClass="quotes" />
  72. </block>
  73. <region name="regexp" start=" \/" end="\/[cgimosx]*" innerClass="string" delimClass="quotes" case="yes">
  74. <contains block="reescaped"/>
  75. </region>
  76. <block name="reescaped" match="\\\/" innerClass="string" contained="yes">
  77. <onlyin region="regexp"/>
  78. </block>
  79. <!--
  80. variables
  81. FIXME: @{...}
  82. -->
  83. <block name="bracketsvars" match="([a-z1-9_]+)(\s*=>)" innerClass="string" contained="yes" case="no">
  84. <partClass index="1" innerClass="string" />
  85. <partClass index="2" innerClass="code" />
  86. <onlyin region="brackets"/>
  87. </block>
  88. <block name="specialvar" match="\$#?[1-9'`@!]" innerClass="var"/>
  89. <block name="var" match="(\$#?|[@%*])([a-z1-9_]+::)*([a-z1-9_]+|\^(?-i)[A-Z]?(?i))" innerClass="var" case="no"/>
  90. <block name="containedvar" match="\$([a-z1-9_]+|\^(?-i)[A-Z]?(?i))" innerClass="var" case="no"/>
  91. <!-- not shure what is this, but the Perlers do it :) -->
  92. <block name="var2" match="(&amp;|\w+)'[\w_']+\b" innerClass="var" case="no"/>
  93. <block name="classvar" match="(\{)([a-z1-9]+)(\})" innerClass="var" case="no">
  94. <partClass index="1" innerClass="brackets" />
  95. <partClass index="2" innerClass="var" />
  96. <partClass index="3" innerClass="brackets" />
  97. </block>
  98. <block name="curlyvar" match="[\$@%]#?\{[a-z1-9]+\}" innerClass="var" case="no"/>
  99. <!--
  100. quotes
  101. -->
  102. <region name="exec" delimClass="quotes" innerClass="string" start="`" end="`">
  103. <contains block="containedvar"/>
  104. <contains block="specialvar"/>
  105. <contains block="curlyvar"/>
  106. </region>
  107. <region name="strsingle" delimClass="quotes" innerClass="string" start="'" end="'"/>
  108. <block name="escaped" match="\\\\|\\&quot;|\\'|\\`" innerClass="special" contained="yes">
  109. <onlyin region="qstatement"/>
  110. <onlyin region="strsingle"/>
  111. <onlyin region="exec"/>
  112. </block>
  113. <region name="strdouble" delimClass="quotes" innerClass="string" start="&quot;" end="&quot;">
  114. <contains block="containedvar"/>
  115. <contains block="specialvar"/>
  116. <contains block="curlyvar"/>
  117. </region>
  118. <block name="descaped" match="\\[\\&quot;'`tnr\$\{@]" innerClass="special" contained="yes">
  119. <onlyin region="strdouble"/>
  120. <onlyin region="q-w-q-statement"/>
  121. </block>
  122. <!-- logical op.
  123. <block name="logic" match="\|\||&amp;&amp;" innerClass="reserved" contained="yes"/>-->
  124. <!--
  125. identifiers
  126. -->
  127. <block name="identifier" match="[a-z_]\w*" innerClass="identifier" case="no"/>
  128. <!--
  129. numbers
  130. -->
  131. <block name="number" match="\d*\.?\d+" innerClass="number"/>
  132. <!--
  133. http://www.perldoc.com/perl5.6/pod/perlfunc.html
  134. Alphabetical Listing of Perl Functions
  135. -->
  136. <keywords name="reserved" inherits="identifier" innerClass="reserved" case = "yes">
  137. <keyword match="abs"/>
  138. <keyword match="accept"/>
  139. <keyword match="alarm"/>
  140. <keyword match="atan2"/>
  141. <keyword match="bind"/>
  142. <keyword match="binmode"/>
  143. <keyword match="bless"/>
  144. <keyword match="caller"/>
  145. <keyword match="chdir"/>
  146. <keyword match="chmod"/>
  147. <keyword match="chomp"/>
  148. <keyword match="chop"/>
  149. <keyword match="chown"/>
  150. <keyword match="chr"/>
  151. <keyword match="chroot"/>
  152. <keyword match="close"/>
  153. <keyword match="closedir"/>
  154. <keyword match="connect"/>
  155. <keyword match="continue"/>
  156. <keyword match="cos"/>
  157. <keyword match="crypt"/>
  158. <keyword match="dbmclose"/>
  159. <keyword match="dbmopen"/>
  160. <keyword match="defined"/>
  161. <keyword match="delete"/>
  162. <keyword match="die"/>
  163. <keyword match="do"/>
  164. <keyword match="dump"/>
  165. <keyword match="each"/>
  166. <keyword match="endgrent"/>
  167. <keyword match="endhostent"/>
  168. <keyword match="endnetent"/>
  169. <keyword match="endprotoent"/>
  170. <keyword match="endpwent"/>
  171. <keyword match="endservent"/>
  172. <keyword match="eof"/>
  173. <keyword match="eval"/>
  174. <keyword match="exec"/>
  175. <keyword match="exists"/>
  176. <keyword match="exit"/>
  177. <keyword match="exp"/>
  178. <keyword match="fcntl"/>
  179. <keyword match="fileno"/>
  180. <keyword match="flock"/>
  181. <keyword match="fork"/>
  182. <keyword match="format"/>
  183. <keyword match="formline"/>
  184. <keyword match="getc"/>
  185. <keyword match="getgrent"/>
  186. <keyword match="getgrgid"/>
  187. <keyword match="getgrnam"/>
  188. <keyword match="gethostbyaddr"/>
  189. <keyword match="gethostbyname"/>
  190. <keyword match="gethostent"/>
  191. <keyword match="getlogin"/>
  192. <keyword match="getnetbyaddr"/>
  193. <keyword match="getnetbyname"/>
  194. <keyword match="getnetent"/>
  195. <keyword match="getpeername"/>
  196. <keyword match="getpgrp"/>
  197. <keyword match="getppid"/>
  198. <keyword match="getpriority"/>
  199. <keyword match="getprotobyname"/>
  200. <keyword match="getprotobynumber"/>
  201. <keyword match="getprotoent"/>
  202. <keyword match="getpwent"/>
  203. <keyword match="getpwnam"/>
  204. <keyword match="getpwuid"/>
  205. <keyword match="getservbyname"/>
  206. <keyword match="getservbyport"/>
  207. <keyword match="getservent"/>
  208. <keyword match="getsockname"/>
  209. <keyword match="getsockopt"/>
  210. <keyword match="glob"/>
  211. <keyword match="gmtime"/>
  212. <keyword match="goto"/>
  213. <keyword match="grep"/>
  214. <keyword match="hex"/>
  215. <keyword match="import"/>
  216. <keyword match="index"/>
  217. <keyword match="int"/>
  218. <keyword match="ioctl"/>
  219. <keyword match="join"/>
  220. <keyword match="keys"/>
  221. <keyword match="kill"/>
  222. <keyword match="last"/>
  223. <keyword match="lc"/>
  224. <keyword match="lcfirst"/>
  225. <keyword match="length"/>
  226. <keyword match="link"/>
  227. <keyword match="listen"/>
  228. <keyword match="local"/>
  229. <keyword match="localtime"/>
  230. <keyword match="lock"/>
  231. <keyword match="log"/>
  232. <keyword match="lstat"/>
  233. <!--<keyword match="m"/>-->
  234. <keyword match="map"/>
  235. <keyword match="mkdir"/>
  236. <keyword match="msgctl"/>
  237. <keyword match="msgget"/>
  238. <keyword match="msgrcv"/>
  239. <keyword match="msgsnd"/>
  240. <keyword match="my"/>
  241. <keyword match="next"/>
  242. <keyword match="no"/>
  243. <keyword match="oct"/>
  244. <keyword match="open"/>
  245. <keyword match="opendir"/>
  246. <keyword match="ord"/>
  247. <keyword match="our"/>
  248. <keyword match="pack"/>
  249. <keyword match="package"/>
  250. <keyword match="pipe"/>
  251. <keyword match="pop"/>
  252. <keyword match="pos"/>
  253. <keyword match="print"/>
  254. <keyword match="printf"/>
  255. <keyword match="prototype"/>
  256. <keyword match="push"/>
  257. <!--<keyword match="q"/>
  258. <keyword match="qq"/>
  259. <keyword match="qr"/>-->
  260. <keyword match="quotemeta"/>
  261. <!--<keyword match="qw"/>
  262. <keyword match="qx"/>-->
  263. <keyword match="rand"/>
  264. <keyword match="read"/>
  265. <keyword match="readdir"/>
  266. <keyword match="readline"/>
  267. <keyword match="readlink"/>
  268. <keyword match="readpipe"/>
  269. <keyword match="recv"/>
  270. <keyword match="redo"/>
  271. <keyword match="ref"/>
  272. <keyword match="rename"/>
  273. <keyword match="require"/>
  274. <keyword match="reset"/>
  275. <keyword match="return"/>
  276. <keyword match="reverse"/>
  277. <keyword match="rewinddir"/>
  278. <keyword match="rindex"/>
  279. <keyword match="rmdir"/>
  280. <!--<keyword match="s"/>-->
  281. <keyword match="scalar"/>
  282. <keyword match="seek"/>
  283. <keyword match="seekdir"/>
  284. <keyword match="select"/>
  285. <keyword match="semctl"/>
  286. <keyword match="semget"/>
  287. <keyword match="semop"/>
  288. <keyword match="send"/>
  289. <keyword match="setgrent"/>
  290. <keyword match="sethostent"/>
  291. <keyword match="setnetent"/>
  292. <keyword match="setpgrp"/>
  293. <keyword match="setpriority"/>
  294. <keyword match="setprotoent"/>
  295. <keyword match="setpwent"/>
  296. <keyword match="setservent"/>
  297. <keyword match="setsockopt"/>
  298. <keyword match="shift"/>
  299. <keyword match="shmctl"/>
  300. <keyword match="shmget"/>
  301. <keyword match="shmread"/>
  302. <keyword match="shmwrite"/>
  303. <keyword match="shutdown"/>
  304. <keyword match="sin"/>
  305. <keyword match="sleep"/>
  306. <keyword match="socket"/>
  307. <keyword match="socketpair"/>
  308. <keyword match="sort"/>
  309. <keyword match="splice"/>
  310. <keyword match="split"/>
  311. <keyword match="sprintf"/>
  312. <keyword match="sqrt"/>
  313. <keyword match="srand"/>
  314. <keyword match="stat"/>
  315. <keyword match="study"/>
  316. <keyword match="sub"/>
  317. <keyword match="substr"/>
  318. <keyword match="symlink"/>
  319. <keyword match="syscall"/>
  320. <keyword match="sysopen"/>
  321. <keyword match="sysread"/>
  322. <keyword match="sysseek"/>
  323. <keyword match="system"/>
  324. <keyword match="syswrite"/>
  325. <keyword match="tell"/>
  326. <keyword match="telldir"/>
  327. <keyword match="tie"/>
  328. <keyword match="tied"/>
  329. <keyword match="time"/>
  330. <keyword match="times"/>
  331. <!--<keyword match="tr"/>-->
  332. <keyword match="truncate"/>
  333. <keyword match="uc"/>
  334. <keyword match="ucfirst"/>
  335. <keyword match="umask"/>
  336. <keyword match="undef"/>
  337. <keyword match="unlink"/>
  338. <keyword match="unpack"/>
  339. <keyword match="unshift"/>
  340. <keyword match="untie"/>
  341. <keyword match="use"/>
  342. <keyword match="utime"/>
  343. <keyword match="values"/>
  344. <keyword match="vec"/>
  345. <keyword match="wait"/>
  346. <keyword match="waitpid"/>
  347. <keyword match="wantarray"/>
  348. <keyword match="warn"/>
  349. <keyword match="write"/>
  350. <keyword match="y"/>
  351. </keywords>
  352. <keywords name="missingreserved" inherits="identifier" innerClass="reserved" case = "yes">
  353. <keyword match="new"/>
  354. </keywords>
  355. <keywords name="flowcontrol" inherits="identifier" innerClass="reserved" case = "yes">
  356. <keyword match="if"/>
  357. <keyword match="else"/>
  358. <keyword match="elsif"/>
  359. <keyword match="while"/>
  360. <keyword match="unless"/>
  361. <keyword match="for"/>
  362. <keyword match="foreach"/>
  363. <keyword match="until"/>
  364. <keyword match="do"/>
  365. <keyword match="continue"/>
  366. <keyword match="not"/>
  367. <keyword match="or"/>
  368. <keyword match="and"/>
  369. <keyword match="eq"/>
  370. <keyword match="ne"/>
  371. <keyword match="gt"/>
  372. <keyword match="lt"/>
  373. </keywords>
  374. </highlight>