2 <!-- $Id: perl.xml,v 1.1 2007-06-03 02:35:28 ssttoo Exp $ -->
4 <highlight lang="perl" case = "yes">
7 <author name="Mariusz 'kg' Jakubowski" email="kg@alternatywa.info" jid="kg@chrome.pl"/>
8 <author name="Andrey Demenev" email="demenev@gmail.com"/>
11 <comment>This highlighter is EXPERIMENTAL, so that it may work incorrectly.
12 Most rules were created by Mariusz Jakubowski, and extended by me.
13 My knowledge of Perl is poor, and Perl syntax seems too
14 complicated to me.</comment>
16 <default innerClass="code"/>
18 <block name="interpreter" match="/^(#!)(.*)/m" innerClass="special">
19 <partClass index="1" innerClass="special" />
20 <partClass index="2" innerClass="string" />
23 <region name="pod" innerClass="comment" start="/^=\w+/m" end="/^=cut[^\n]*/m" startBOL="yes" endBOL="yes"/>
28 <region name="block" delimClass="brackets" innerClass="code" start="\{" end="\}">
32 <region name="brackets" delimClass="brackets" innerClass="code" start="\(" end="\)">
36 <region name="sqbrackets" delimClass="brackets" innerClass="code" start="\[" end="\]">
43 <block name="usestatement" match="(use)\s+([\w:]*)" innerClass="special">
44 <partClass index="1" innerClass="reserved" />
45 <partClass index="2" innerClass="special" />
48 <block name="packagereference" match="[& ](\w{2,}::)+\w{2,}" innerClass="special"/>
50 <region name="q-w-q-statement"
51 start="/\b(q[wq]\s*((\{)|(\()|(\[)|(\<)|([\W\S])))(?=(.*)((?(3)\})(?(4)\))(?(5)\])(?(6)\>)(?(7)\7)))/Us"
53 innerClass="string" delimClass="quotes" remember="yes">
55 <contains block="containedvar"/>
56 <contains block="specialvar"/>
57 <contains block="curlyvar"/>
61 <region name="qstatement"
62 start="/\b(q\s*((\{)|(\()|(\[)|(\<)|([\W\S])))(?=(.*)((?(3)\})(?(4)\))(?(5)\])(?(6)\>)(?(7)\7)))/Us"
64 innerClass="string" delimClass="quotes" remember="yes">
71 <block name="comment" match="#.*" innerClass="comment" />
76 FIXME: this should be rewrited
78 <block name="dblregexprver1" match="/(s|tr) ([|#~`!@$%^&*-+=\\;:'",.\/?]) ((\\.|[^\\])*?) (\2)((\\.|[^\\])*?)(\2[ecgimosx]*)/x" innerClass="string">
79 <partClass index="1" innerClass="quotes" />
80 <partClass index="2" innerClass="quotes" />
81 <partClass index="3" innerClass="string" />
82 <partClass index="5" innerClass="quotes" />
83 <partClass index="6" innerClass="string" />
84 <partClass index="8" innerClass="quotes" />
87 <block name="dblregexprver2" match="/(m) ([|#~`!@$%^&*-+=\\;:'",.\/?]) ((\\.|[^\\])*?) (\2[ecgimosx]*)/x" innerClass="string">
88 <partClass index="1" innerClass="quotes" />
89 <partClass index="2" innerClass="quotes" />
90 <partClass index="3" innerClass="string" />
91 <partClass index="5" innerClass="quotes" />
95 <region name="regexp" start=" \/" end="\/[cgimosx]*" innerClass="string" delimClass="quotes" case="yes">
96 <contains block="reescaped"/>
99 <block name="reescaped" match="\\\/" innerClass="string" contained="yes">
100 <onlyin region="regexp"/>
107 <block name="bracketsvars" match="([a-z1-9_]+)(\s*=>)" innerClass="string" contained="yes" case="no">
108 <partClass index="1" innerClass="string" />
109 <partClass index="2" innerClass="code" />
110 <onlyin region="brackets"/>
113 <block name="specialvar" match="\$#?[1-9'`@!]" innerClass="var"/>
115 <block name="var" match="(\$#?|[@%*])([a-z1-9_]+::)*([a-z1-9_]+|\^(?-i)[A-Z]?(?i))" innerClass="var" case="no"/>
116 <block name="containedvar" match="\$([a-z1-9_]+|\^(?-i)[A-Z]?(?i))" innerClass="var" case="no"/>
118 <!-- not shure what is this, but the Perlers do it :) -->
119 <block name="var2" match="(&|\w+)'[\w_']+\b" innerClass="var" case="no"/>
121 <block name="classvar" match="(\{)([a-z1-9]+)(\})" innerClass="var" case="no">
122 <partClass index="1" innerClass="brackets" />
123 <partClass index="2" innerClass="var" />
124 <partClass index="3" innerClass="brackets" />
127 <block name="curlyvar" match="[\$@%]#?\{[a-z1-9]+\}" innerClass="var" case="no"/>
132 <region name="exec" delimClass="quotes" innerClass="string" start="`" end="`">
133 <contains block="containedvar"/>
134 <contains block="specialvar"/>
135 <contains block="curlyvar"/>
138 <region name="strsingle" delimClass="quotes" innerClass="string" start="'" end="'"/>
140 <block name="escaped" match="\\\\|\\"|\\'|\\`" innerClass="special" contained="yes">
141 <onlyin region="qstatement"/>
142 <onlyin region="strsingle"/>
143 <onlyin region="exec"/>
146 <region name="strdouble" delimClass="quotes" innerClass="string" start=""" end=""">
147 <contains block="containedvar"/>
148 <contains block="specialvar"/>
149 <contains block="curlyvar"/>
152 <block name="descaped" match="\\[\\"'`tnr\$\{@]" innerClass="special" contained="yes">
153 <onlyin region="strdouble"/>
154 <onlyin region="q-w-q-statement"/>
158 <block name="logic" match="\|\||&&" innerClass="reserved" contained="yes"/>-->
163 <block name="identifier" match="[a-z_]\w*" innerClass="identifier" case="no"/>
168 <block name="number" match="\d*\.?\d+" innerClass="number"/>
171 http://www.perldoc.com/perl5.6/pod/perlfunc.html
172 Alphabetical Listing of Perl Functions
174 <keywords name="reserved" inherits="identifier" innerClass="reserved" case = "yes">
175 <keyword match="abs"/>
176 <keyword match="accept"/>
177 <keyword match="alarm"/>
178 <keyword match="atan2"/>
180 <keyword match="bind"/>
181 <keyword match="binmode"/>
182 <keyword match="bless"/>
184 <keyword match="caller"/>
185 <keyword match="chdir"/>
186 <keyword match="chmod"/>
187 <keyword match="chomp"/>
188 <keyword match="chop"/>
189 <keyword match="chown"/>
190 <keyword match="chr"/>
191 <keyword match="chroot"/>
192 <keyword match="close"/>
193 <keyword match="closedir"/>
194 <keyword match="connect"/>
195 <keyword match="continue"/>
196 <keyword match="cos"/>
197 <keyword match="crypt"/>
199 <keyword match="dbmclose"/>
200 <keyword match="dbmopen"/>
201 <keyword match="defined"/>
202 <keyword match="delete"/>
203 <keyword match="die"/>
204 <keyword match="do"/>
205 <keyword match="dump"/>
207 <keyword match="each"/>
208 <keyword match="endgrent"/>
209 <keyword match="endhostent"/>
210 <keyword match="endnetent"/>
211 <keyword match="endprotoent"/>
212 <keyword match="endpwent"/>
213 <keyword match="endservent"/>
214 <keyword match="eof"/>
215 <keyword match="eval"/>
216 <keyword match="exec"/>
217 <keyword match="exists"/>
218 <keyword match="exit"/>
219 <keyword match="exp"/>
221 <keyword match="fcntl"/>
222 <keyword match="fileno"/>
223 <keyword match="flock"/>
224 <keyword match="fork"/>
225 <keyword match="format"/>
226 <keyword match="formline"/>
228 <keyword match="getc"/>
229 <keyword match="getgrent"/>
230 <keyword match="getgrgid"/>
231 <keyword match="getgrnam"/>
232 <keyword match="gethostbyaddr"/>
233 <keyword match="gethostbyname"/>
234 <keyword match="gethostent"/>
235 <keyword match="getlogin"/>
236 <keyword match="getnetbyaddr"/>
237 <keyword match="getnetbyname"/>
238 <keyword match="getnetent"/>
239 <keyword match="getpeername"/>
240 <keyword match="getpgrp"/>
241 <keyword match="getppid"/>
242 <keyword match="getpriority"/>
243 <keyword match="getprotobyname"/>
244 <keyword match="getprotobynumber"/>
245 <keyword match="getprotoent"/>
246 <keyword match="getpwent"/>
247 <keyword match="getpwnam"/>
248 <keyword match="getpwuid"/>
249 <keyword match="getservbyname"/>
250 <keyword match="getservbyport"/>
251 <keyword match="getservent"/>
252 <keyword match="getsockname"/>
253 <keyword match="getsockopt"/>
254 <keyword match="glob"/>
255 <keyword match="gmtime"/>
256 <keyword match="goto"/>
257 <keyword match="grep"/>
259 <keyword match="hex"/>
261 <keyword match="import"/>
262 <keyword match="index"/>
263 <keyword match="int"/>
264 <keyword match="ioctl"/>
266 <keyword match="join"/>
268 <keyword match="keys"/>
269 <keyword match="kill"/>
271 <keyword match="last"/>
272 <keyword match="lc"/>
273 <keyword match="lcfirst"/>
274 <keyword match="length"/>
275 <keyword match="link"/>
276 <keyword match="listen"/>
277 <keyword match="local"/>
278 <keyword match="localtime"/>
279 <keyword match="lock"/>
280 <keyword match="log"/>
281 <keyword match="lstat"/>
283 <!--<keyword match="m"/>-->
284 <keyword match="map"/>
285 <keyword match="mkdir"/>
286 <keyword match="msgctl"/>
287 <keyword match="msgget"/>
288 <keyword match="msgrcv"/>
289 <keyword match="msgsnd"/>
290 <keyword match="my"/>
292 <keyword match="next"/>
293 <keyword match="no"/>
295 <keyword match="oct"/>
296 <keyword match="open"/>
297 <keyword match="opendir"/>
298 <keyword match="ord"/>
299 <keyword match="our"/>
301 <keyword match="pack"/>
302 <keyword match="package"/>
303 <keyword match="pipe"/>
304 <keyword match="pop"/>
305 <keyword match="pos"/>
306 <keyword match="print"/>
307 <keyword match="printf"/>
308 <keyword match="prototype"/>
309 <keyword match="push"/>
311 <!--<keyword match="q"/>
312 <keyword match="qq"/>
313 <keyword match="qr"/>-->
314 <keyword match="quotemeta"/>
315 <!--<keyword match="qw"/>
316 <keyword match="qx"/>-->
318 <keyword match="rand"/>
319 <keyword match="read"/>
320 <keyword match="readdir"/>
321 <keyword match="readline"/>
322 <keyword match="readlink"/>
323 <keyword match="readpipe"/>
324 <keyword match="recv"/>
325 <keyword match="redo"/>
326 <keyword match="ref"/>
327 <keyword match="rename"/>
328 <keyword match="require"/>
329 <keyword match="reset"/>
330 <keyword match="return"/>
331 <keyword match="reverse"/>
332 <keyword match="rewinddir"/>
333 <keyword match="rindex"/>
334 <keyword match="rmdir"/>
336 <!--<keyword match="s"/>-->
337 <keyword match="scalar"/>
338 <keyword match="seek"/>
339 <keyword match="seekdir"/>
340 <keyword match="select"/>
341 <keyword match="semctl"/>
342 <keyword match="semget"/>
343 <keyword match="semop"/>
344 <keyword match="send"/>
345 <keyword match="setgrent"/>
346 <keyword match="sethostent"/>
347 <keyword match="setnetent"/>
348 <keyword match="setpgrp"/>
349 <keyword match="setpriority"/>
350 <keyword match="setprotoent"/>
351 <keyword match="setpwent"/>
352 <keyword match="setservent"/>
353 <keyword match="setsockopt"/>
354 <keyword match="shift"/>
355 <keyword match="shmctl"/>
356 <keyword match="shmget"/>
357 <keyword match="shmread"/>
358 <keyword match="shmwrite"/>
359 <keyword match="shutdown"/>
360 <keyword match="sin"/>
361 <keyword match="sleep"/>
362 <keyword match="socket"/>
363 <keyword match="socketpair"/>
364 <keyword match="sort"/>
365 <keyword match="splice"/>
366 <keyword match="split"/>
367 <keyword match="sprintf"/>
368 <keyword match="sqrt"/>
369 <keyword match="srand"/>
370 <keyword match="stat"/>
371 <keyword match="study"/>
372 <keyword match="sub"/>
373 <keyword match="substr"/>
374 <keyword match="symlink"/>
375 <keyword match="syscall"/>
376 <keyword match="sysopen"/>
377 <keyword match="sysread"/>
378 <keyword match="sysseek"/>
379 <keyword match="system"/>
380 <keyword match="syswrite"/>
382 <keyword match="tell"/>
383 <keyword match="telldir"/>
384 <keyword match="tie"/>
385 <keyword match="tied"/>
386 <keyword match="time"/>
387 <keyword match="times"/>
388 <!--<keyword match="tr"/>-->
389 <keyword match="truncate"/>
391 <keyword match="uc"/>
392 <keyword match="ucfirst"/>
393 <keyword match="umask"/>
394 <keyword match="undef"/>
395 <keyword match="unlink"/>
396 <keyword match="unpack"/>
397 <keyword match="unshift"/>
398 <keyword match="untie"/>
399 <keyword match="use"/>
400 <keyword match="utime"/>
402 <keyword match="values"/>
403 <keyword match="vec"/>
405 <keyword match="wait"/>
406 <keyword match="waitpid"/>
407 <keyword match="wantarray"/>
408 <keyword match="warn"/>
409 <keyword match="write"/>
414 <keywords name="missingreserved" inherits="identifier" innerClass="reserved" case = "yes">
415 <keyword match="new"/>
419 <keywords name="flowcontrol" inherits="identifier" innerClass="reserved" case = "yes">
420 <keyword match="if"/>
421 <keyword match="else"/>
422 <keyword match="elsif"/>
423 <keyword match="while"/>
424 <keyword match="unless"/>
425 <keyword match="for"/>
426 <keyword match="foreach"/>
427 <keyword match="until"/>
428 <keyword match="do"/>
429 <keyword match="continue"/>
430 <keyword match="not"/>
431 <keyword match="or"/>
432 <keyword match="and"/>
433 <keyword match="eq"/>
434 <keyword match="ne"/>
435 <keyword match="gt"/>
436 <keyword match="lt"/>