| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language> |
| 3 |
<!-- |
| 4 |
This file is part of the KDE project |
| 5 |
Copyright (C) 2001, 2002, 2003, 2004 Anders Lund <[email protected]> |
| 6 |
|
| 7 |
This library is free software; you can redistribute it and/or |
| 8 |
modify it under the terms of the GNU Library General Public |
| 9 |
License version 2 as published by the Free Software Foundation. |
| 10 |
|
| 11 |
This library is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
Library General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU Library General Public License |
| 17 |
along with this library; see the file COPYING.LIB. If not, write to |
| 18 |
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 |
Boston, MA 02110-1301, USA. |
| 20 |
|
| 21 |
*** NOTICE *** |
| 22 |
This file is maintained by Anders Lund <[email protected]> |
| 23 |
Please do not commit changes without checking with me. |
| 24 |
|
| 25 |
*** TODO *** |
| 26 |
|
| 27 |
Work on the comment support in the REPLACEMENT part of s/// - we may support |
| 28 |
the comment, if the line remainder does not contain the delimiter char. |
| 29 |
|
| 30 |
Try to support ?PATTERN? (at least in one line, like if "\?(?=.*\?)" matches). |
| 31 |
|
| 32 |
parse code behind '<<HEREDELIMITER' as code, or at least ignore it, to eol. |
| 33 |
Requires the ability to pass the delimiter through a context level. |
| 34 |
|
| 35 |
find a here delimiter like '*END*' (Shell.pm). Requires that when a regex is |
| 36 |
inserting a dynamic string, it escapes [*(){}$[] |
| 37 |
|
| 38 |
support for more regex extensions, such as (?>), (?{}), (?(cond)yes|no) |
| 39 |
|
| 40 |
Enhance tr/// and y/// support. |
| 41 |
--> |
| 42 |
<language name="Perl" version="19" kateversion="5.0" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund ([email protected])" license="LGPLv2"> |
| 43 |
<highlighting> |
| 44 |
<list name="keywords"> |
| 45 |
<item>if</item> |
| 46 |
<item>unless</item> |
| 47 |
<item>else</item> |
| 48 |
<item>elsif</item> |
| 49 |
<item>while</item> |
| 50 |
<item>until</item> |
| 51 |
<item>for</item> |
| 52 |
<item>each</item> |
| 53 |
<item>foreach</item> |
| 54 |
<item>next</item> |
| 55 |
<item>last</item> |
| 56 |
<item>break</item> |
| 57 |
<item>continue</item> |
| 58 |
<item>return</item> |
| 59 |
<item>my</item> |
| 60 |
<item>our</item> |
| 61 |
<item>local</item> |
| 62 |
<item>state</item> |
| 63 |
<item>BEGIN</item> |
| 64 |
<item>END</item> |
| 65 |
<item>package</item> |
| 66 |
<item>sub</item> |
| 67 |
<item>do</item> |
| 68 |
<item>given</item> |
| 69 |
<item>when</item> |
| 70 |
<item>default</item> |
| 71 |
<item>__END__</item> |
| 72 |
<item>__DATA__</item> |
| 73 |
<item>__FILE__</item> |
| 74 |
<item>__LINE__</item> |
| 75 |
<item>__PACKAGE__</item> |
| 76 |
</list> |
| 77 |
<list name="operators"> |
| 78 |
<item>=</item> |
| 79 |
<item>!=</item> |
| 80 |
<item>~=</item> |
| 81 |
<item>+=</item> |
| 82 |
<item>-=</item> |
| 83 |
<item>*=</item> |
| 84 |
<item>/=</item> |
| 85 |
<item>**=</item> |
| 86 |
<item>|=</item> |
| 87 |
<item>||=</item> |
| 88 |
<item>//=</item> |
| 89 |
<item>&=</item> |
| 90 |
<item>&&=</item> |
| 91 |
<item>?=</item> |
| 92 |
<item>+</item> |
| 93 |
<item>-</item> |
| 94 |
<item>*</item> |
| 95 |
<!-- <item>/</item>//--> |
| 96 |
<item>%</item> |
| 97 |
<item>||</item> |
| 98 |
<item>//</item> |
| 99 |
<item>&&</item> |
| 100 |
<item>|</item> |
| 101 |
<item>&</item> |
| 102 |
<item><</item> |
| 103 |
<item><<</item> |
| 104 |
<item>></item> |
| 105 |
<item>>></item> |
| 106 |
<item>^</item> |
| 107 |
<item>-></item> |
| 108 |
<item>=></item> |
| 109 |
<item>.</item> |
| 110 |
<item>,</item> |
| 111 |
<item>;</item> |
| 112 |
<item>::</item> |
| 113 |
<item>\</item> |
| 114 |
<item>and</item> |
| 115 |
<item>or</item> |
| 116 |
<item>not</item> |
| 117 |
<item>eq</item> |
| 118 |
<item>ne</item> |
| 119 |
<item>lt</item> |
| 120 |
<item>gt</item> |
| 121 |
<item>le</item> |
| 122 |
<item>ge</item> |
| 123 |
<item>cmp</item> |
| 124 |
</list> |
| 125 |
<list name="functions"> |
| 126 |
<item>abs</item> |
| 127 |
<item>accept</item> |
| 128 |
<item>alarm</item> |
| 129 |
<item>atan2</item> |
| 130 |
<item>bind</item> |
| 131 |
<item>binmode</item> |
| 132 |
<item>bless</item> |
| 133 |
<item>caller</item> |
| 134 |
<item>chdir</item> |
| 135 |
<item>chmod</item> |
| 136 |
<item>chomp</item> |
| 137 |
<item>chop</item> |
| 138 |
<item>chown</item> |
| 139 |
<item>chr</item> |
| 140 |
<item>chroot</item> |
| 141 |
<item>close</item> |
| 142 |
<item>closedir</item> |
| 143 |
<item>connect</item> |
| 144 |
<item>cos</item> |
| 145 |
<item>crypt</item> |
| 146 |
<item>dbmclose</item> |
| 147 |
<item>dbmopen</item> |
| 148 |
<item>defined</item> |
| 149 |
<item>delete</item> |
| 150 |
<item>die</item> |
| 151 |
<item>dump</item> |
| 152 |
<item>endgrent</item> |
| 153 |
<item>endhostent</item> |
| 154 |
<item>endnetent</item> |
| 155 |
<item>endprotoent</item> |
| 156 |
<item>endpwent</item> |
| 157 |
<item>endservent</item> |
| 158 |
<item>eof</item> |
| 159 |
<item>eval</item> |
| 160 |
<item>exec</item> |
| 161 |
<item>exists</item> |
| 162 |
<item>exit</item> |
| 163 |
<item>exp</item> |
| 164 |
<item>fcntl</item> |
| 165 |
<item>fileno</item> |
| 166 |
<item>flock</item> |
| 167 |
<item>fork</item> |
| 168 |
<item>format</item> |
| 169 |
<item>formline</item> |
| 170 |
<item>getc</item> |
| 171 |
<item>getgrent</item> |
| 172 |
<item>getgrgid</item> |
| 173 |
<item>getgrnam</item> |
| 174 |
<item>gethostbyaddr</item> |
| 175 |
<item>gethostbyname</item> |
| 176 |
<item>gethostent</item> |
| 177 |
<item>getlogin</item> |
| 178 |
<item>getnetbyaddr</item> |
| 179 |
<item>getnetbyname</item> |
| 180 |
<item>getnetent</item> |
| 181 |
<item>getpeername</item> |
| 182 |
<item>getpgrp</item> |
| 183 |
<item>getppid</item> |
| 184 |
<item>getpriority</item> |
| 185 |
<item>getprotobyname</item> |
| 186 |
<item>getprotobynumber</item> |
| 187 |
<item>getprotoent</item> |
| 188 |
<item>getpwent</item> |
| 189 |
<item>getpwnam</item> |
| 190 |
<item>getpwuid</item> |
| 191 |
<item>getservbyname</item> |
| 192 |
<item>getservbyport</item> |
| 193 |
<item>getservent</item> |
| 194 |
<item>getsockname</item> |
| 195 |
<item>getsockopt</item> |
| 196 |
<item>glob</item> |
| 197 |
<item>gmtime</item> |
| 198 |
<item>goto</item> |
| 199 |
<item>grep</item> |
| 200 |
<item>hex</item> |
| 201 |
<item>import</item> |
| 202 |
<item>index</item> |
| 203 |
<item>int</item> |
| 204 |
<item>ioctl</item> |
| 205 |
<item>join</item> |
| 206 |
<item>keys</item> |
| 207 |
<item>kill</item> |
| 208 |
<item>last</item> |
| 209 |
<item>lc</item> |
| 210 |
<item>lcfirst</item> |
| 211 |
<item>length</item> |
| 212 |
<item>link</item> |
| 213 |
<item>listen</item> |
| 214 |
<item>localtime</item> |
| 215 |
<item>lock</item> |
| 216 |
<item>log</item> |
| 217 |
<item>lstat</item> |
| 218 |
<item>map</item> |
| 219 |
<item>mkdir</item> |
| 220 |
<item>msgctl</item> |
| 221 |
<item>msgget</item> |
| 222 |
<item>msgrcv</item> |
| 223 |
<item>msgsnd</item> |
| 224 |
<item>no</item> |
| 225 |
<item>oct</item> |
| 226 |
<item>open</item> |
| 227 |
<item>opendir</item> |
| 228 |
<item>ord</item> |
| 229 |
<item>pack</item> |
| 230 |
<item>package</item> |
| 231 |
<item>pipe</item> |
| 232 |
<item>pop</item> |
| 233 |
<item>pos</item> |
| 234 |
<item>print</item> |
| 235 |
<item>printf</item> |
| 236 |
<item>prototype</item> |
| 237 |
<item>push</item> |
| 238 |
<item>quotemeta</item> |
| 239 |
<item>rand</item> |
| 240 |
<item>read</item> |
| 241 |
<item>readdir</item> |
| 242 |
<item>readline</item> |
| 243 |
<item>readlink</item> |
| 244 |
<item>recv</item> |
| 245 |
<item>redo</item> |
| 246 |
<item>ref</item> |
| 247 |
<item>rename</item> |
| 248 |
<item>require</item> |
| 249 |
<item>reset</item> |
| 250 |
<item>return</item> |
| 251 |
<item>reverse</item> |
| 252 |
<item>rewinddir</item> |
| 253 |
<item>rindex</item> |
| 254 |
<item>rmdir</item> |
| 255 |
<item>say</item> |
| 256 |
<item>scalar</item> |
| 257 |
<item>seek</item> |
| 258 |
<item>seekdir</item> |
| 259 |
<item>select</item> |
| 260 |
<item>semctl</item> |
| 261 |
<item>semget</item> |
| 262 |
<item>semop</item> |
| 263 |
<item>send</item> |
| 264 |
<item>setgrent</item> |
| 265 |
<item>sethostent</item> |
| 266 |
<item>setnetent</item> |
| 267 |
<item>setpgrp</item> |
| 268 |
<item>setpriority</item> |
| 269 |
<item>setprotoent</item> |
| 270 |
<item>setpwent</item> |
| 271 |
<item>setservent</item> |
| 272 |
<item>setsockopt</item> |
| 273 |
<item>shift</item> |
| 274 |
<item>shmctl</item> |
| 275 |
<item>shmget</item> |
| 276 |
<item>shmread</item> |
| 277 |
<item>shmwrite</item> |
| 278 |
<item>shutdown</item> |
| 279 |
<item>sin</item> |
| 280 |
<item>sleep</item> |
| 281 |
<item>socket</item> |
| 282 |
<item>socketpair</item> |
| 283 |
<item>sort</item> |
| 284 |
<item>splice</item> |
| 285 |
<item>split</item> |
| 286 |
<item>sprintf</item> |
| 287 |
<item>sqrt</item> |
| 288 |
<item>srand</item> |
| 289 |
<item>stat</item> |
| 290 |
<item>study</item> |
| 291 |
<item>sub</item> |
| 292 |
<item>substr</item> |
| 293 |
<item>symlink</item> |
| 294 |
<item>syscall</item> |
| 295 |
<item>sysread</item> |
| 296 |
<item>sysseek</item> |
| 297 |
<item>system</item> |
| 298 |
<item>syswrite</item> |
| 299 |
<item>tell</item> |
| 300 |
<item>telldir</item> |
| 301 |
<item>tie</item> |
| 302 |
<item>time</item> |
| 303 |
<item>times</item> |
| 304 |
<item>truncate</item> |
| 305 |
<item>uc</item> |
| 306 |
<item>ucfirst</item> |
| 307 |
<item>umask</item> |
| 308 |
<item>undef</item> |
| 309 |
<item>unlink</item> |
| 310 |
<item>unpack</item> |
| 311 |
<item>unshift</item> |
| 312 |
<item>untie</item> |
| 313 |
<item>use</item> |
| 314 |
<item>utime</item> |
| 315 |
<item>values</item> |
| 316 |
<item>vec</item> |
| 317 |
<item>wait</item> |
| 318 |
<item>waitpid</item> |
| 319 |
<item>wantarray</item> |
| 320 |
<item>warn</item> |
| 321 |
<item>write</item> |
| 322 |
</list> |
| 323 |
<list name="pragmas"> |
| 324 |
<item>strict</item> |
| 325 |
<item>english</item> |
| 326 |
<item>warnings</item> |
| 327 |
<item>vars</item> |
| 328 |
<item>subs</item> |
| 329 |
<item>utf8</item> |
| 330 |
<item>sigtrap</item> |
| 331 |
<item>locale</item> |
| 332 |
<item>open</item> |
| 333 |
<item>less</item> |
| 334 |
<item>integer</item> |
| 335 |
<item>filetest</item> |
| 336 |
<item>constant</item> |
| 337 |
<item>bytes</item> |
| 338 |
<item>diagnostics</item> |
| 339 |
</list> |
| 340 |
<contexts> |
| 341 |
<context name="normal" attribute="Normal Text" lineEndContext="#stay"> |
| 342 |
<RegExpr attribute="Keyword" context="#stay" String="^#!\/.*" column="0" /> |
| 343 |
<StringDetect attribute="Keyword" context="data_handle" String="__DATA__" firstNonSpace="true" /> |
| 344 |
<StringDetect attribute="Keyword" context="#stay" String="__END__" firstNonSpace="true"/> |
| 345 |
<RegExpr attribute="Keyword" context="sub_name_def" String="\bsub\s+" /> |
| 346 |
<keyword attribute="Keyword" context="#stay" String="keywords" /> |
| 347 |
<keyword attribute="Operator" context="#stay" String="operators" /> |
| 348 |
<keyword attribute="Function" context="#stay" String="functions" /> |
| 349 |
<keyword attribute="Pragma" context="#stay" String="pragmas" /> |
| 350 |
<RegExpr attribute="Pod" context="pod" String="^\=\w+(\s|$)" column="0" beginRegion="POD"/> |
| 351 |
<DetectSpaces /> |
| 352 |
<DetectChar attribute="Comment" context="comment" char="#" /> |
| 353 |
|
| 354 |
<!-- Numeric values. Note that we have to allow underscores between two digits (thus the creepy regular expressions). --> |
| 355 |
<RegExpr attribute="Hex" String="\b\-?0[xX]([0-9a-fA-F]|_[0-9a-fA-F])+" context="slash_safe_escape"/> |
| 356 |
<RegExpr attribute="Bin" String="\b\-?0[bB]([01]|_[01])+" context="slash_safe_escape"/> |
| 357 |
<RegExpr attribute="Octal" String="\b\-?0[1-7]([0-7]|_[0-7])*" context="slash_safe_escape"/> |
| 358 |
<RegExpr attribute="Float" String="\b\-?[0-9]([0-9]|_[0-9])*\.[0-9]([0-9]|_[0-9])*([eE]\-?[1-9]([0-9]|_[0-9])*(\.[0-9]*)?)?" context="slash_safe_escape"/> |
| 359 |
<RegExpr attribute="Decimal" String="\b\-?[1-9]([0-9]|_[0-9])*\b" context="slash_safe_escape"/> |
| 360 |
<Int attribute="Decimal" context="slash_safe_escape" /> |
| 361 |
|
| 362 |
<!-- Allow strings as scalar references (ex: \'string') (see bug #348765). --> |
| 363 |
<!-- <RegExpr attribute="Normal Text" context="#stay" String="\\(["'])[^\1]" /> --> |
| 364 |
<Detect2Chars attribute="Normal Text" context="#stay" char="&" char1="'" /><!-- ??? --> |
| 365 |
<DetectChar attribute="Operator" context="ip_string" char=""" beginRegion="String" /> |
| 366 |
<DetectChar attribute="Operator" context="string" char="'" beginRegion="String"/> |
| 367 |
<DetectChar attribute="Operator" context="Backticked" char="`" /> |
| 368 |
|
| 369 |
<RegExpr attribute="Normal Text" context="find_variable" String="(?:[$@]\S|%([\w\{\+\-!]|\^H)|\*[^\d\*{\$@%=(])" lookAhead="true" /> |
| 370 |
|
| 371 |
<RegExpr attribute="Keyword" context="#stay" String="<[A-Z0-9_]+>" /> |
| 372 |
|
| 373 |
<RegExpr attribute="Operator" context="find_here_document" String="\s*<<(?=\w+|\s*["'])" beginRegion="HereDocument" /> |
| 374 |
|
| 375 |
<RegExpr attribute="Normal Text" context="#stay" String="\s*\}\s*/{1,2}" endRegion="Block"/> |
| 376 |
<RegExpr attribute="Normal Text" context="#stay" String="\s*[)\]]\s*/{1,2}" /> |
| 377 |
|
| 378 |
<RegExpr attribute="Function" context="sub_name_def" String="\w+::" /> |
| 379 |
<RegExpr attribute="Normal Text" context="#stay" String="\w+[=]" /> |
| 380 |
|
| 381 |
<RegExpr attribute="Operator" context="find_quoted" String="\bq(?=[qwx]?\s*[^\w\s])" /> |
| 382 |
<RegExpr attribute="Operator" context="find_subst" String="\bs(?=\s*[^\w\s\]})])" /> |
| 383 |
<RegExpr attribute="Operator" context="tr" String="\b(?:tr|y)\s*(?=[^\w\s\]})])" /> |
| 384 |
|
| 385 |
<RegExpr attribute="Operator" context="find_pattern" String="\b(?:m|qr)(?=\s*[^\w\s\]})])" /> |
| 386 |
|
| 387 |
<RegExpr attribute="Normal Text" context="#stay" String="[\w_]+\s*//?\=?|[<>"':]//?\=?" /> |
| 388 |
<!-- Avoid conflicts between operators / and // --> |
| 389 |
<StringDetect attribute="Normal Text" context="#stay" String="//=" /> |
| 390 |
<Detect2Chars attribute="Normal Text" context="#stay" char="/" char1="/" /> |
| 391 |
<DetectChar attribute="Operator" context="pattern_slash" char="/" beginRegion="Pattern" /> |
| 392 |
<RegExpr attribute="Operator" context="#stay" String="-[rwxoRWXOeszfdlpSbctugkTBMAC]\b" /> |
| 393 |
|
| 394 |
<DetectChar attribute="Normal Text" context="#stay" char="{" beginRegion="Block" /> |
| 395 |
<DetectChar attribute="Normal Text" context="#stay" char="}" endRegion="Block" /> |
| 396 |
</context> |
| 397 |
|
| 398 |
<!-- ====== quoted construct central ===== --> |
| 399 |
<context name="find_quoted" attribute="Normal Text" lineEndContext="#stay" > |
| 400 |
<!-- NOTE - qx'not interpolated regex' does not cover newline between "qr" and "'" --> |
| 401 |
<RegExpr attribute="Operator" context="string_6" String="x\s*(')" beginRegion="String" /> |
| 402 |
<AnyChar attribute="Operator" context="find_qqx" String="qx" /> |
| 403 |
<DetectChar attribute="Operator" context="find_qw" char="w" /> |
| 404 |
<DetectChar attribute="Operator" context="string_2" char="(" beginRegion="String" /> |
| 405 |
<DetectChar attribute="Operator" context="string_3" char="{" beginRegion="String" /> |
| 406 |
<DetectChar attribute="Operator" context="string_4" char="[" beginRegion="String" /> |
| 407 |
<DetectChar attribute="Operator" context="string_5" char="<" beginRegion="String" /> |
| 408 |
<RegExpr attribute="Operator" context="string_6" String="([^a-zA-Z0-9_\s[\]{}()])" beginRegion="String" /> |
| 409 |
<RegExpr attribute="Comment" context="#stay" String="\s+#.*" /><!-- q[qwx] # == comment, look for the delim on the next line --> |
| 410 |
</context> |
| 411 |
<context name="find_qqx" attribute="Normal Text" lineEndContext="#stay" > |
| 412 |
<DetectChar attribute="Operator" context="ip_string_2" char="(" beginRegion="String" /> |
| 413 |
<DetectChar attribute="Operator" context="ip_string_3" char="{" beginRegion="String" /> |
| 414 |
<DetectChar attribute="Operator" context="ip_string_4" char="[" beginRegion="String" /> |
| 415 |
<DetectChar attribute="Operator" context="ip_string_5" char="<" beginRegion="String" /> |
| 416 |
<RegExpr attribute="Operator" context="ip_string_6" String="([^a-zA-Z0-9_\s[\]{}()])" beginRegion="String" /> |
| 417 |
<RegExpr attribute="Comment" context="#stay" String="\s+#.*" /><!-- q[qwx] # == comment, look for the delim on the next line --> |
| 418 |
</context> |
| 419 |
<context name="find_qw" attribute="Normal Text" lineEndContext="#stay" > |
| 420 |
<DetectChar attribute="Operator" context="quote_word_paren" char="(" beginRegion="Wordlist" /> |
| 421 |
<DetectChar attribute="Operator" context="quote_word_brace" char="{" beginRegion="Wordlist" /> |
| 422 |
<DetectChar attribute="Operator" context="quote_word_bracket" char="[" beginRegion="Wordlist" /> |
| 423 |
<DetectChar attribute="Operator" context="quote_word_angular" char="<" beginRegion="Wordlist" /> |
| 424 |
<RegExpr attribute="Operator" context="quote_word" String="([^a-zA-Z0-9_\s[\]{}()\<>])" beginRegion="Wordlist" /> |
| 425 |
<RegExpr attribute="Comment" context="#stay" String="\s+#.*" /><!-- q[qwx] # == comment, look for the delim on the next line --> |
| 426 |
</context> |
| 427 |
|
| 428 |
<!-- ====== Contexts for strings ===== --> |
| 429 |
<context name="ipstring_internal" attribute="String (interpolated)" lineEndContext="#stay"> |
| 430 |
<DetectIdentifier /> |
| 431 |
<RegExpr attribute="String Special Character" context="#stay" String="\\c[^\s\\]|\\g(\{(\w+|\-\d+)\}|\d+)|\\k(\{\w+\}|<\w+>|'\w+')|\\N\{[^\{\}]*\}|\\o\{[0-7]+\}|\\[pP](\{\w+\}|P)|\\x([0-9a-fA-F]{2}|\{[0-9a-fA-F]+\})|\\[0-7]{3}|\\[1aAbBdDeEfFGhHKlLnNQrRsStuUvVwWXzZ]" /> |
| 432 |
<RegExpr attribute="String (interpolated)" context="#stay" String="\\." /> |
| 433 |
<RegExpr attribute="Normal Text" context="find_variable_unsafe" String="(?:[\$@]\S|%([\w\{\-\+!]|\^H))" lookAhead="true" /> |
| 434 |
</context> |
| 435 |
<context name="ip_string" attribute="String (interpolated)" lineEndContext="#stay"> |
| 436 |
<DetectChar attribute="Operator" context="#pop" char=""" endRegion="String"/> |
| 437 |
<IncludeRules context="ipstring_internal" /> |
| 438 |
</context> |
| 439 |
<context name="ip_string_2" attribute="String (interpolated)" lineEndContext="#stay"> |
| 440 |
<RangeDetect attribute="String (interpolated)" context="#stay" char="(" char1=")" /> |
| 441 |
<DetectChar attribute="Operator" context="#pop#pop#pop" char=")" endRegion="String" /> |
| 442 |
<IncludeRules context="ipstring_internal" /> |
| 443 |
</context> |
| 444 |
<context name="ip_string_3" attribute="String (interpolated)" lineEndContext="#stay"> |
| 445 |
<RangeDetect attribute="String (interpolated)" context="#stay" char="{" char1="}" /> |
| 446 |
<DetectChar attribute="Operator" context="#pop#pop#pop" char="}" endRegion="String" /> |
| 447 |
<IncludeRules context="ipstring_internal" /> |
| 448 |
</context> |
| 449 |
<context name="ip_string_4" attribute="String (interpolated)" lineEndContext="#stay"> |
| 450 |
<RangeDetect attribute="String (interpolated)" context="#stay" char="[" char1="]" /> |
| 451 |
<DetectChar attribute="Operator" context="#pop#pop#pop" char="]" endRegion="String" /> |
| 452 |
<IncludeRules context="ipstring_internal" /> |
| 453 |
</context> |
| 454 |
<context name="ip_string_5" attribute="String (interpolated)" lineEndContext="#stay"> |
| 455 |
<RangeDetect attribute="String (interpolated)" context="#stay" char="<" char1=">" /> |
| 456 |
<DetectChar attribute="Operator" context="#pop#pop#pop" char=">" endRegion="String" /> |
| 457 |
<IncludeRules context="ipstring_internal" /> |
| 458 |
</context> |
| 459 |
<context name="ip_string_6" attribute="String (interpolated)" lineEndContext="#stay" dynamic="true"> |
| 460 |
<StringDetect attribute="String (interpolated)" context="#stay" String="\%1" dynamic="true" /> |
| 461 |
<DetectChar attribute="Operator" context="#pop#pop#pop" char="1" dynamic="true" endRegion="String"/> |
| 462 |
<IncludeRules context="ipstring_internal" /> |
| 463 |
</context> |
| 464 |
|
| 465 |
<context name="string" attribute="String" lineEndContext="#stay"> |
| 466 |
<DetectIdentifier /> |
| 467 |
<Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="'" /> |
| 468 |
<Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="\" /> |
| 469 |
<DetectChar attribute="Operator" context="#pop" char="'" endRegion="String" /> |
| 470 |
</context> |
| 471 |
<context name="string_2" attribute="String" lineEndContext="#stay"> |
| 472 |
<DetectIdentifier /> |
| 473 |
<Detect2Chars attribute="String Special Character" context="#stay" char="\" char1=")" /> |
| 474 |
<Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="\" /> |
| 475 |
<RangeDetect attribute="String" context="#stay" char="(" char1=")" /> |
| 476 |
<DetectChar attribute="Operator" context="#pop#pop" char=")" endRegion="String" /> |
| 477 |
</context> |
| 478 |
<context name="string_3" attribute="String" lineEndContext="#stay"> |
| 479 |
<DetectIdentifier /> |
| 480 |
<Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="}" /> |
| 481 |
<Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="\" /> |
| 482 |
<RangeDetect attribute="String" context="#stay" char="{" char1="}" /> |
| 483 |
<DetectChar attribute="Operator" context="#pop#pop" char="}" endRegion="String" /> |
| 484 |
</context> |
| 485 |
<context name="string_4" attribute="String" lineEndContext="#stay"> |
| 486 |
<DetectIdentifier /> |
| 487 |
<Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="]" /> |
| 488 |
<Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="\" /> |
| 489 |
<RangeDetect attribute="String" context="#stay" char="[" char1="]" /> |
| 490 |
<DetectChar attribute="Operator" context="#pop#pop" char="]" endRegion="String" /> |
| 491 |
</context> |
| 492 |
<context name="string_5" attribute="String" lineEndContext="#stay"> |
| 493 |
<DetectIdentifier /> |
| 494 |
<Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="<" /> |
| 495 |
<Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="\" /> |
| 496 |
<Detect2Chars attribute="String" context="#stay" char="\" char1=">" /> |
| 497 |
<RangeDetect attribute="String" context="#stay" char="<" char1=">" /> |
| 498 |
<DetectChar attribute="Operator" context="#pop#pop" char=">" endRegion="String" /> |
| 499 |
</context> |
| 500 |
<context name="string_6" attribute="String" lineEndContext="#stay" dynamic="true"> |
| 501 |
<DetectIdentifier /> |
| 502 |
<Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="\" /> |
| 503 |
<StringDetect attribute="String Special Character" context="#stay" String="\%1" dynamic="true"/> |
| 504 |
<DetectChar attribute="Operator" context="#pop#pop" char="1" dynamic="true" endRegion="String" /> |
| 505 |
</context> |
| 506 |
|
| 507 |
<!-- ====== contexts for s/// ====== --> |
| 508 |
<context name="find_subst" attribute="Normal Text" lineEndContext="#stay" > |
| 509 |
<RegExpr attribute="Comment" context="#stay" String="\s+#.*" /><!-- s # == comment, look for the delim on the next line --> |
| 510 |
<DetectChar attribute="Operator" context="subst_curlybrace_pattern" char="{" beginRegion="Pattern" /> |
| 511 |
<DetectChar attribute="Operator" context="subst_paren_pattern" char="(" beginRegion="Pattern" /> |
| 512 |
<DetectChar attribute="Operator" context="subst_bracket_pattern" char="[" beginRegion="Pattern" /> |
| 513 |
<DetectChar attribute="Operator" context="subst_sq_pattern" char="'" beginRegion="Pattern" /> |
| 514 |
<RegExpr attribute="Operator" context="subst_slash_pattern" String="([^\w\s[\]{}()])" beginRegion="Pattern" /> |
| 515 |
</context> |
| 516 |
|
| 517 |
<!-- Fully parse s {} {}. |
| 518 |
This means that |
| 519 |
- comments are legal between PATTERN and REPLACEMENT |
| 520 |
- REPLACEMENT can contain resursive {} blocks --> |
| 521 |
<context name="subst_curlybrace_pattern" attribute="Pattern" lineEndContext="#stay"> |
| 522 |
<RegExpr attribute="Comment" context="#stay" String="\s+#.*$" /> |
| 523 |
<IncludeRules context="regex_pattern_internal_ip" /> |
| 524 |
<DetectChar attribute="Operator" context="subst_curlybrace_middle" char="}" endRegion="Pattern" /> |
| 525 |
<!-- Recursive brackets. Avoid closing brackets incorrectly (bug #364866). --> |
| 526 |
<DetectChar attribute="Pattern" context="subst_curlybrace_pattern_recursive" char="{" /> |
| 527 |
</context> |
| 528 |
<context name="subst_curlybrace_middle" attribute="Normal Text" lineEndContext="#stay" > |
| 529 |
<DetectChar attribute="Comment" context="comment" char="#" /> |
| 530 |
<DetectChar attribute="Operator" context="subst_curlybrace_replace" char="{" beginRegion="Replacement" /> |
| 531 |
</context> |
| 532 |
<context name="subst_curlybrace_replace" attribute="String (interpolated)" lineEndContext="#stay"> |
| 533 |
<IncludeRules context="ipstring_internal" /> |
| 534 |
<DetectChar attribute="Normal Text" context="subst_curlybrace_replace_recursive" char="{" beginRegion="Block" /> |
| 535 |
<RegExpr attribute="Operator" context="#pop#pop#pop#pop" String="\}[cegimosx]*" endRegion="Replacement" /> |
| 536 |
</context> |
| 537 |
<context name="subst_curlybrace_replace_recursive" attribute="String (interpolated)" lineEndContext="#stay" > |
| 538 |
<DetectChar attribute="String (interpolated)" context="subst_curlybrace_replace_recursive" char="{" beginRegion="Block" /> |
| 539 |
<DetectChar attribute="Normal Text" context="#pop" char="}" endRegion="Block" /> |
| 540 |
<IncludeRules context="ipstring_internal" /> |
| 541 |
</context> |
| 542 |
<context name="subst_curlybrace_pattern_recursive" attribute="Pattern" lineEndContext="#stay"> |
| 543 |
<DetectChar attribute="Pattern" context="#pop" char="}" /> |
| 544 |
<IncludeRules context="subst_curlybrace_pattern" /> |
| 545 |
</context> |
| 546 |
|
| 547 |
<context name="subst_maybe_comment" attribute="Pattern" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> |
| 548 |
<DetectChar attribute="Comment" context="#pop!comment" char="#" /> |
| 549 |
</context> |
| 550 |
|
| 551 |
<context name="subst_paren_pattern" attribute="Pattern" lineEndContext="#stay"> |
| 552 |
<DetectSpaces attribute="Pattern" context="subst_maybe_comment" /> |
| 553 |
<DetectChar attribute="Operator" context="subst_paren_replace" char=")" endRegion="Pattern" /> |
| 554 |
<!-- Round brackets of RegExp pattern inside --> |
| 555 |
<DetectChar attribute="Pattern Internal Operator" context="subst_paren_pattern_internal_recursive" char="(" /> |
| 556 |
<IncludeRules context="regex_pattern_internal_ip" /> |
| 557 |
</context> |
| 558 |
<context name="subst_paren_replace" attribute="String (interpolated)" lineEndContext="#stay"> |
| 559 |
<IncludeRules context="ipstring_internal" /> |
| 560 |
<DetectChar attribute="Operator" context="#stay" char="(" beginRegion="Replacement" /> |
| 561 |
<RegExpr attribute="Operator" context="#pop#pop#pop" String="\)[cegimosx]*" endRegion="Replacement" /> |
| 562 |
</context> |
| 563 |
<context name="subst_paren_pattern_internal_recursive" attribute="Pattern" lineEndContext="#stay"> |
| 564 |
<DetectChar attribute="Pattern Internal Operator" context="#pop" char=")" /> |
| 565 |
<IncludeRules context="subst_paren_pattern" /> |
| 566 |
</context> |
| 567 |
|
| 568 |
<context name="subst_bracket_pattern" attribute="Pattern" lineEndContext="#stay"> |
| 569 |
<DetectSpaces attribute="Pattern" context="subst_maybe_comment" /> |
| 570 |
<IncludeRules context="regex_pattern_internal_ip" /> |
| 571 |
<DetectChar attribute="Operator" context="subst_bracket_replace" char="]" endRegion="Pattern" /> |
| 572 |
</context> |
| 573 |
<context name="subst_bracket_replace" attribute="String (interpolated)" lineEndContext="#stay"> |
| 574 |
<IncludeRules context="ipstring_internal" /> |
| 575 |
<DetectChar attribute="Operator" context="#stay" char="[" beginRegion="Replacement" /> |
| 576 |
<RegExpr attribute="Operator" context="#pop#pop#pop" String="\][cegimosx]*" endRegion="Replacement" /> |
| 577 |
</context> |
| 578 |
|
| 579 |
<context name="subst_slash_pattern" attribute="Pattern" lineEndContext="#stay" dynamic="true"> |
| 580 |
<RegExpr attribute="Pattern Internal Operator" context="#stay" String="\$(?=%1)" dynamic="true" /> |
| 581 |
<RegExpr attribute="Operator" context="subst_slash_replace" String="(%1)" dynamic="true" endRegion="Pattern" beginRegion="Replacement" /> |
| 582 |
<IncludeRules context="regex_pattern_internal_ip" /> |
| 583 |
</context> |
| 584 |
<context name="subst_slash_replace" attribute="String (interpolated)" lineEndContext="#stay" dynamic="true"> |
| 585 |
<RegExpr attribute="Operator" context="#pop#pop#pop" String="%1[cegimosx]*" dynamic="true" endRegion="Replacement" /> |
| 586 |
<IncludeRules context="ipstring_internal" /> |
| 587 |
|
| 588 |
</context> |
| 589 |
|
| 590 |
<context name="subst_sq_pattern" attribute="Pattern" lineEndContext="#stay"> |
| 591 |
<DetectSpaces attribute="Pattern" context="subst_maybe_comment" /> |
| 592 |
<IncludeRules context="regex_pattern_internal" /> |
| 593 |
<DetectChar attribute="Operator" context="subst_sq_replace" char="'" endRegion="Pattern" beginRegion="Pattern" /> |
| 594 |
</context> |
| 595 |
<context name="subst_sq_replace" attribute="String" lineEndContext="#stay"> |
| 596 |
<RegExpr attribute="Operator" context="#pop#pop#pop" String="'[cegimosx]*" endRegion="Replacement" /> |
| 597 |
</context> |
| 598 |
|
| 599 |
<context name="tr" attribute="Pattern" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop" > |
| 600 |
<RegExpr attribute="Pattern" context="#pop" String="\([^)]*\)\s*\(?:[^)]*\)|\{[^}]*\}\s*\{[^}]*\}|\[[^]]*\]\s*\[[^\]]*\]|([^a-zA-Z0-9_\s[\]{}()]).*?\1.*?\1"/> |
| 601 |
</context> |
| 602 |
|
| 603 |
<!-- ====== PATTERNs ====== --> |
| 604 |
<context name="find_pattern" attribute="Pattern" lineEndContext="#stay"> |
| 605 |
<RegExpr attribute="Comment" context="#stay" String="\s+#.*" /><!-- s # == comment, look for the delim on the next line --> |
| 606 |
<DetectChar attribute="Operator" context="pattern_brace" char="{" beginRegion="Pattern" /> |
| 607 |
<DetectChar attribute="Operator" context="pattern_paren" char="(" beginRegion="Pattern" /> |
| 608 |
<DetectChar attribute="Operator" context="pattern_bracket" char="[" beginRegion="Pattern" /> |
| 609 |
<DetectChar attribute="Operator" context="pattern_sq" char="'" beginRegion="Pattern" /> |
| 610 |
<RegExpr attribute="Operator" context="pattern" String="([^\w\s])" beginRegion="Pattern" /> |
| 611 |
</context> |
| 612 |
<context name="pattern_slash" attribute="Pattern" lineEndContext="#stay"> |
| 613 |
<RegExpr attribute="Pattern Internal Operator" context="#stay" String="\$(?=/)" /> |
| 614 |
<IncludeRules context="regex_pattern_internal_ip" /> |
| 615 |
<RegExpr attribute="Operator" context="#pop" String="/[cgimosx]*" endRegion="Pattern" /> |
| 616 |
</context> |
| 617 |
<context name="pattern" attribute="Pattern" lineEndContext="#stay" dynamic="true"> |
| 618 |
<RegExpr attribute="Pattern Internal Operator" context="#stay" String="\$(?=%1)" dynamic="true" /> |
| 619 |
<RegExpr attribute="Operator" context="#pop#pop" String="%1[cgimosx]*" dynamic="true" endRegion="Pattern" /> |
| 620 |
<IncludeRules context="regex_pattern_internal_ip" /> |
| 621 |
</context> |
| 622 |
<context name="pattern_brace" attribute="Pattern" lineEndContext="#stay"> |
| 623 |
<RegExpr attribute="Operator" context="#pop#pop" String="\}[cgimosx]*" endRegion="Pattern" /> |
| 624 |
<IncludeRules context="regex_pattern_internal_ip" /> |
| 625 |
<!-- Recursive brackets. Avoid closing brackets incorrectly. --> |
| 626 |
<DetectChar attribute="Pattern" context="pattern_brace_recursive" char="{" /> |
| 627 |
</context> |
| 628 |
<context name="pattern_brace_recursive" attribute="Pattern" lineEndContext="#stay"> |
| 629 |
<DetectChar attribute="Pattern" context="#pop" char="}" /> |
| 630 |
<IncludeRules context="pattern_brace" /> |
| 631 |
</context> |
| 632 |
<context name="pattern_bracket" attribute="Pattern" lineEndContext="#stay"> |
| 633 |
<RegExpr attribute="Operator" context="#pop#pop" String="\][cgimosx]*" endRegion="Pattern" /> |
| 634 |
<IncludeRules context="regex_pattern_internal_ip" /> |
| 635 |
</context> |
| 636 |
<context name="pattern_paren" attribute="Pattern" lineEndContext="#stay"> |
| 637 |
<RegExpr attribute="Operator" context="#pop#pop" String="\)[cgimosx]*" endRegion="Pattern" /> |
| 638 |
<!-- Round brackets of RegExp pattern inside --> |
| 639 |
<DetectChar attribute="Pattern Internal Operator" context="pattern_paren_internal_recursive" char="(" /> |
| 640 |
<IncludeRules context="regex_pattern_internal_ip" /> |
| 641 |
</context> |
| 642 |
<context name="pattern_paren_internal_recursive" attribute="Pattern" lineEndContext="#stay"> |
| 643 |
<DetectChar attribute="Pattern Internal Operator" context="#pop" char=")" /> |
| 644 |
<IncludeRules context="pattern_paren" /> |
| 645 |
</context> |
| 646 |
<context name="pattern_sq" attribute="Pattern" lineEndContext="#stay"> |
| 647 |
<RegExpr attribute="Operator" context="#pop#pop" String="'[cgimosx]*" endRegion="Pattern" /> |
| 648 |
<IncludeRules context="regex_pattern_internal" /> |
| 649 |
</context> |
| 650 |
|
| 651 |
<!-- rules internal stuff wrt regex patterns --> |
| 652 |
<context name="regex_pattern_internal_rules_1" attribute="Pattern" lineEndContext="#stay"> |
| 653 |
<DetectChar attribute="Comment" context="comment" char="#" firstNonSpace="true" /> |
| 654 |
<RegExpr attribute="Special Variable" context="#stay" String="\\c[^\s\\]|\\g(\{(\w+|\-\d+)\}|\d+)|\\k(\{\w+\}|<\w+>|'\w+')|\\N\{[^\{\}]*\}|\\o\{[0-7]+\}|\\[pP](\{\w+\}|P)|\\x([0-9a-fA-F]{2}|\{[0-9a-fA-F]+\})" /> |
| 655 |
<RegExpr attribute="Pattern Character Class" context="#stay" String="\\[anDdSsWw]" /> |
| 656 |
<RegExpr attribute="Pattern Internal Operator" context="#stay" String="\\[ABbEGLlNUuQdQZz]" /> <!-- Also?: efFhHKrRtvVX --> |
| 657 |
<RegExpr attribute="Special Variable" context="#stay" String="\\[\d]+" /> |
| 658 |
<RegExpr attribute="Pattern" context="#stay" String="\\." /> |
| 659 |
</context> |
| 660 |
<context name="regex_pattern_internal_rules_2" attribute="Pattern" lineEndContext="#stay"> |
| 661 |
<Detect2Chars attribute="Pattern Internal Operator" context="pat_ext" char="(" char1="?" /> |
| 662 |
<DetectChar attribute="Pattern Internal Operator" context="pat_char_class" char="[" /> |
| 663 |
<AnyChar attribute="Pattern Internal Operator" context="#stay" String="()?^*+|" /> |
| 664 |
<RegExpr attribute="Pattern Internal Operator" context="#stay" String="\{[\d, ]+\}" /> |
| 665 |
<DetectChar attribute="Pattern Internal Operator" context="#stay" char="$" /> |
| 666 |
<RegExpr attribute="Comment" context="#stay" String="\s{3,}#.*$" /> |
| 667 |
</context> |
| 668 |
<context name="regex_pattern_internal" attribute="Pattern" lineEndContext="#stay"> |
| 669 |
<IncludeRules context="regex_pattern_internal_rules_1" /> |
| 670 |
<IncludeRules context="regex_pattern_internal_rules_2" /> |
| 671 |
</context> |
| 672 |
<context name="regex_pattern_internal_ip" attribute="Pattern" lineEndContext="#stay" > |
| 673 |
<IncludeRules context="regex_pattern_internal_rules_1" /> |
| 674 |
<!-- NOTE the below means that the special variables $' $], $} and $> are not supported |
| 675 |
within interpolated PATTERNs (apart from $(, $) and ${ and $| not supported by perl). |
| 676 |
This is because perl considers |
| 677 |
s{foo$} {bar} OK as well as s{foo$}} {bar}, and detecting that is a huge work overload |
| 678 |
for something that is unlikely to happen. --> |
| 679 |
<RegExpr attribute="Data Type" context="find_variable_unsafe" String="[$@][^]\s{}()|>']" lookAhead="true" /> |
| 680 |
<IncludeRules context="regex_pattern_internal_rules_2" /> |
| 681 |
</context> |
| 682 |
<context name="pat_ext" attribute="Pattern Internal Operator" lineEndContext="#stay"> |
| 683 |
<AnyChar attribute="Pattern Internal Operator" context="#pop" String=":=!><" /> |
| 684 |
<RegExpr attribute="Comment" context="#pop" String="\#[^)]*" /> |
| 685 |
<DetectChar attribute="Pattern Internal Operator" context="#pop" char=")" /> |
| 686 |
</context> |
| 687 |
<context name="pat_char_class" attribute="Pattern Character Class" lineEndContext="#stay"> |
| 688 |
<DetectChar attribute="Pattern Internal Operator" context="#stay" char="^" /> |
| 689 |
<Detect2Chars attribute="Pattern Character Class" context="#stay" char="\" char1="\" /> |
| 690 |
<Detect2Chars attribute="Pattern Character Class" context="#stay" char="\" char1="]" /> |
| 691 |
<RegExpr attribute="Pattern Character Class" context="#stay" String="\[:\^?[a-z]+:\]" /> |
| 692 |
<DetectChar attribute="Pattern Internal Operator" context="#pop" char="]" /> |
| 693 |
</context> |
| 694 |
|
| 695 |
<!-- ====== Variables ====== --> |
| 696 |
<context name="find_variable" attribute="Data Type" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop" > |
| 697 |
<RegExpr attribute="Data Type" context="var_detect" String="\$[#_][\w_]" /> |
| 698 |
<RegExpr attribute="Special Variable" context="var_detect" String="\$[0-9]+|[@\$](?:[\+\-_]\B|ARGV\b|INC\b)|[%\$](?:INC\b|ENV\b|SIG\b)|\$\^[A-Z_\]\[\^\?\\]|%([\-\+!]|\^H)" /> |
| 699 |
<RegExpr attribute="Data Type" context="var_detect" String="\$\$[\$\w_]|\$+::" /> |
| 700 |
<RegExpr attribute="Special Variable" context="var_detect" String="\$[^a-zA-Z0-9\s{][A-Z]?" /> |
| 701 |
<RegExpr attribute="Data Type" context="var_detect" String="[\$@%]\{\^?[\w_]+\}|[$@%]|\*[a-zA-Z_]+" /> |
| 702 |
<!-- Do not highlight brackets after *, Ex: (... @*) (see bug #391577) --> |
| 703 |
<RegExpr attribute="Special Variable" context="#stay" String="\*[^a-zA-Z0-9\s\{\(\)\[\]\}][A-Z]?" /> |
| 704 |
<!-- this should be a rare case! --> |
| 705 |
<AnyChar attribute="Operator" context="#pop" String="$@%*" /> |
| 706 |
</context> |
| 707 |
<!-- This does not check fo a trailing slash, for usage in strings. --> |
| 708 |
<context name="find_variable_unsafe" attribute="Data Type" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop" > |
| 709 |
<RegExpr attribute="Data Type" context="var_detect_unsafe" String="\$[#_][\w_]" /> |
| 710 |
<RegExpr attribute="Special Variable" context="var_detect_unsafe" String="\$[0-9]+|[@\$](?:[\+\-_]\B|ARGV\b|INC\b)|[%\$](?:INC\b|ENV\b|SIG\b)" /> |
| 711 |
<RegExpr attribute="Special Variable" context="var_detect" String="\$\^[A-Z_\]\[\^\?\\]|%([\-\+!]|\^H)" /> |
| 712 |
<RegExpr attribute="Data Type" context="var_detect_unsafe" String="\$\$[\$\w_]|\$+::" /> |
| 713 |
<RegExpr attribute="Special Variable" context="#stay" String="\$[^a-zA-Z0-9\s{][A-Z]?" /> |
| 714 |
<RegExpr attribute="Data Type" context="var_detect_unsafe" String="[\$@%]\{\^?[\w_]+\}|[$@%]|\*\w+" /> |
| 715 |
<AnyChar attribute="Operator" context="#pop" String="$@%*" /> |
| 716 |
</context> |
| 717 |
<context name="var_detect" attribute="Data Type" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop"> |
| 718 |
<IncludeRules context="var_detect_rules" /> |
| 719 |
<IncludeRules context="slash_safe_escape" /> |
| 720 |
</context> |
| 721 |
<context name="var_detect_unsafe" attribute="Data Type" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop"> |
| 722 |
<IncludeRules context="var_detect_rules" /> |
| 723 |
</context> |
| 724 |
<context name="var_detect_rules" attribute="Data Type" lineEndContext="#pop#pop" > |
| 725 |
<RegExpr attribute="Data Type" context="#stay" String="[\w_]+" /> |
| 726 |
<Detect2Chars attribute="Normal Text" context="#stay" char=":" char1=":" /> |
| 727 |
<DetectChar attribute="Operator" context="#stay" char="'" /> |
| 728 |
<Detect2Chars attribute="Normal Text" context="#stay" char="-" char1=">" /> |
| 729 |
<!-- safe with operator / --> |
| 730 |
<Detect2Chars attribute="Normal Text" context="#stay" char="+" char1="+" /> |
| 731 |
<Detect2Chars attribute="Normal Text" context="#stay" char="-" char1="-" /> |
| 732 |
</context> |
| 733 |
|
| 734 |
|
| 735 |
<!-- ====== Word lists ====== --> |
| 736 |
<context name="quote_word" attribute="Normal Text" lineEndContext="#stay" dynamic="true"> |
| 737 |
<DetectSpaces /> |
| 738 |
<DetectIdentifier /> |
| 739 |
<StringDetect attribute="Normal Text" context="#stay" String="\%1" dynamic="true" /> |
| 740 |
<DetectChar attribute="Operator" context="#pop#pop#pop" char="1" dynamic="true" endRegion="Wordlist" /> |
| 741 |
</context> |
| 742 |
<context name="quote_word_paren" attribute="Normal Text" lineEndContext="#stay"> |
| 743 |
<DetectSpaces /> |
| 744 |
<DetectIdentifier /> |
| 745 |
<Detect2Chars attribute="Normal Text" context="#stay" char="\" char1=")" /> |
| 746 |
<DetectChar attribute="Operator" context="#pop#pop#pop" char=")" endRegion="Wordlist" /> |
| 747 |
</context> |
| 748 |
<context name="quote_word_brace" attribute="Normal Text" lineEndContext="#stay"> |
| 749 |
<DetectSpaces /> |
| 750 |
<DetectIdentifier /> |
| 751 |
<Detect2Chars attribute="Normal Text" context="#stay" char="\" char1="}" /> |
| 752 |
<DetectChar attribute="Operator" context="#pop#pop#pop" char="}" endRegion="Wordlist" /> |
| 753 |
</context> |
| 754 |
<context name="quote_word_bracket" attribute="Normal Text" lineEndContext="#stay"> |
| 755 |
<DetectSpaces /> |
| 756 |
<DetectIdentifier /> |
| 757 |
<Detect2Chars attribute="Normal Text" context="#stay" char="\" char1="]" /> |
| 758 |
<DetectChar attribute="Operator" context="#pop#pop#pop" char="]" endRegion="Wordlist" /> |
| 759 |
</context> |
| 760 |
<context name="quote_word_angular" attribute="Normal Text" lineEndContext="#stay"> |
| 761 |
<DetectSpaces /> |
| 762 |
<DetectIdentifier /> |
| 763 |
<Detect2Chars attribute="Normal Text" context="#stay" char="\" char1=">" /> |
| 764 |
<DetectChar attribute="Operator" context="#pop#pop#pop" char=">" endRegion="Wordlist" /> |
| 765 |
</context> |
| 766 |
|
| 767 |
<!-- ====== Here Documents ====== --> |
| 768 |
<context name="find_here_document" attribute="Normal Text" lineEndContext="#pop" > |
| 769 |
<RegExpr attribute="Keyword" context="here_document" String="(?|(\w+)\s*;?|\s*"([^"]+)"\s*;?|\s*`([^`]+)`\s*;?)" /> |
| 770 |
<RegExpr attribute="Keyword" context="here_document_dumb" String="\s*'([^']+)'\s*;?" /> |
| 771 |
</context> |
| 772 |
<context name="here_document" attribute="String (interpolated)" lineEndContext="#stay" dynamic="true"> |
| 773 |
<RegExpr attribute="Keyword" context="#pop#pop" String="^%1\b" column="0" dynamic="true" endRegion="HereDocument"/> |
| 774 |
<RegExpr attribute="Keyword" context="here_document" String="\=\s*<<\s*["']?([A-Z0-9_\-]+)["']?" beginRegion="HEREDoc" /> |
| 775 |
<IncludeRules context="ipstring_internal" /> |
| 776 |
<DetectSpaces /> |
| 777 |
</context> |
| 778 |
<context name="here_document_dumb" attribute="Normal Text" lineEndContext="#stay" dynamic="true"> |
| 779 |
<StringDetect attribute="Keyword" context="#pop#pop" String="%1" column="0" dynamic="true" endRegion="HereDocument"/> |
| 780 |
<DetectSpaces /> |
| 781 |
<DetectIdentifier /> |
| 782 |
</context> |
| 783 |
|
| 784 |
<!-- ====== Misc ====== --> |
| 785 |
<context name="data_handle" attribute="Data" lineEndContext="#stay"> |
| 786 |
<RegExpr attribute="Pod" context="pod" String="^\=(?:head[1-6]|over|back|item|for|begin|end|pod)\s+.*" column="0" beginRegion="POD"/> |
| 787 |
<StringDetect attribute="Keyword" context="normal" String="__END__" firstNonSpace="true" /> |
| 788 |
</context> |
| 789 |
|
| 790 |
<context name="Backticked" attribute="String (interpolated)" lineEndContext="#stay"> |
| 791 |
<IncludeRules context="ipstring_internal"/> |
| 792 |
<DetectChar attribute="Operator" context="#pop" char="`"/> |
| 793 |
</context> |
| 794 |
|
| 795 |
<context name="slash_safe_escape" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> |
| 796 |
<RegExpr attribute="Normal Text" context="#pop" String="\s*\}\s*/{1,2}" endRegion="Block"/> |
| 797 |
<RegExpr attribute="Normal Text" context="#pop" String="\s*[)\]]?\s*/{1,2}" /> |
| 798 |
<keyword attribute="Keyword" context="#pop" String="keywords" /><!-- wonder why??? --> |
| 799 |
</context> |
| 800 |
|
| 801 |
<context name="sub_name_def" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> |
| 802 |
<RegExpr attribute="Function" context="#stay" String="\w+" /> |
| 803 |
<RegExpr attribute="Normal Text" context="find_variable" String="\$\S" lookAhead="true" /> |
| 804 |
<RegExpr attribute="Normal Text" context="sub_arg_definition" String="\s*\(" /> |
| 805 |
<Detect2Chars attribute="Normal Text" context="#stay" char=":" char1=":" /> |
| 806 |
</context> |
| 807 |
|
| 808 |
<context name="sub_arg_definition" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop#pop"> |
| 809 |
<AnyChar attribute="Data Type" context="#stay" String="*$@%" /> |
| 810 |
<AnyChar attribute="Normal Text" context="#stay" String="&\[];" /> |
| 811 |
<DetectChar attribute="Normal Text" context="slash_safe_escape" char=")" /> |
| 812 |
</context> |
| 813 |
|
| 814 |
<context name="pod" attribute="Pod" lineEndContext="#stay"> |
| 815 |
<DetectSpaces /> |
| 816 |
<DetectIdentifier /> |
| 817 |
<RegExpr attribute="Pod" context="#stay" String="^\=(?:head[1-6]|over|back|item|for|begin|end|pod)\s*.*" column="0" beginRegion="POD" endRegion="POD"/> |
| 818 |
<StringDetect attribute="Pod" context="Pod" String="=cut" column="0" endRegion="POD"/> |
| 819 |
</context> |
| 820 |
|
| 821 |
<context name="comment" attribute="Comment" lineEndContext="#pop"> |
| 822 |
<DetectSpaces /> |
| 823 |
<IncludeRules context="##Comments" /> |
| 824 |
<DetectIdentifier /> |
| 825 |
</context> |
| 826 |
|
| 827 |
<context name="Pod" attribute="Pod" lineEndContext="#pop#pop"/> |
| 828 |
|
| 829 |
</contexts> |
| 830 |
<itemDatas> |
| 831 |
<itemData name="Normal Text" defStyleNum="dsNormal" /> |
| 832 |
<itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/> |
| 833 |
<itemData name="Pragma" defStyleNum="dsKeyword" spellChecking="false"/> |
| 834 |
<itemData name="Function" defStyleNum="dsFunction" spellChecking="false"/> |
| 835 |
<itemData name="Operator" defStyleNum="dsOthers" bold="1" spellChecking="false"/> <!-- #008000 --> |
| 836 |
<itemData name="Data Type" defStyleNum="dsDataType" spellChecking="false"/> |
| 837 |
<itemData name="Special Variable" defStyleNum="dsWarning" bold="0" italic="0" /> <!-- #C00000 --> |
| 838 |
<itemData name="Decimal" defStyleNum="dsDecVal" spellChecking="false"/> |
| 839 |
<itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/> |
| 840 |
<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/> |
| 841 |
<itemData name="Bin" defStyleNum="dsBaseN" spellChecking="false"/> |
| 842 |
<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/> |
| 843 |
<itemData name="String" defStyleNum="dsSpecialString" /> <!-- #FF6C6C --> |
| 844 |
<itemData name="String (interpolated)" defStyleNum="dsString" /> |
| 845 |
<itemData name="String Special Character" defStyleNum="dsChar" /> |
| 846 |
<itemData name="Pattern" defStyleNum="dsOthers" spellChecking="false"/> |
| 847 |
<itemData name="Pattern Internal Operator" defStyleNum="dsChar" spellChecking="false"/> |
| 848 |
<itemData name="Pattern Character Class" defStyleNum="dsBaseN" spellChecking="false"/> |
| 849 |
<itemData name="Data" defStyleNum="dsNormal" /> |
| 850 |
<itemData name="Comment" defStyleNum="dsComment" /> |
| 851 |
<itemData name="Pod" defStyleNum="dsComment" /> |
| 852 |
</itemDatas> |
| 853 |
</highlighting> |
| 854 |
<general> |
| 855 |
<comments> |
| 856 |
<comment name="singleLine" start="#" /> |
| 857 |
</comments> |
| 858 |
<keywords casesensitive="1" /> |
| 859 |
</general> |
| 860 |
</language> |
| 861 |
<!-- kate: space-indent on; indent-width 2; replace-tabs on; --> |