2 /*************************************************************************************
5 * Author: Andreas Gohr (andi@splitbrain.org), Ben Keen (ben.keen@gmail.com)
6 * Copyright: (c) 2004 Andreas Gohr, Ben Keen (http://www.benjaminkeen.org/), Nigel McNie (http://qbnz.com/highlighter/)
7 * Release Version: 1.0.8.11
8 * Date Started: 2004/08/20
10 * Perl language file for GeSHi.
15 * - Added support for system calls in backticks (Corley Kinnane)
16 * 2008/05/23 (1.0.7.22)
17 * - Added description of extra language features (SF#1970248)
18 * - Added comment_regexp for predefined variables
20 * - Fixed SF#1891630 with placebo patch
22 * - Used hardescape feature for ' strings (Cliff Stanford)
24 * - Added support for multiple object splitters
28 * TODO (updated 2004/11/27)
29 * -------------------------
31 * * string comparison operators
33 *************************************************************************************
35 * This file is part of GeSHi.
37 * GeSHi is free software; you can redistribute it and/or modify
38 * it under the terms of the GNU General Public License as published by
39 * the Free Software Foundation; either version 2 of the License, or
40 * (at your option) any later version.
42 * GeSHi is distributed in the hope that it will be useful,
43 * but WITHOUT ANY WARRANTY; without even the implied warranty of
44 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 * GNU General Public License for more details.
47 * You should have received a copy of the GNU General Public License
48 * along with GeSHi; if not, write to the Free Software
49 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
51 ************************************************************************************/
53 $language_data = array (
54 'LANG_NAME' => 'Perl',
55 'COMMENT_SINGLE' => array(1 => '#'),
56 'COMMENT_MULTI' => array(
64 '=encoding' => '=cut',
67 'COMMENT_REGEXP' => array(
69 2 => "/(?<=[\\s^])(s|tr|y)\\/(?:\\\\.|(?!\n)[^\\/\\\\])+\\/(?:\\\\.|(?!\n)[^\\/\\\\])*\\/[msixpogcde]*(?=[\\s$\\.\\;])|(?<=[\\s^(=])(m|q[qrwx]?)?\\/(?:\\\\.|(?!\n)[^\\/\\\\])+\\/[msixpogc]*(?=[\\s$\\.\\,\\;\\)])/iU",
70 //Regular expression match variables
73 4 => '/<<\s*?([\'"]?)([a-zA-Z0-9]+)\1;[^\n]*?\\n.*\\n\\2(?![a-zA-Z0-9])/siU',
74 //Predefined variables
75 5 => '/\$(\^[a-zA-Z]?|[\*\$`\'&_\.,+\-~:;\\\\\/"\|%=\?!@#<>\(\)\[\]])(?!\w)|@[_+\-]|%[!]|\$(?=\{)/',
77 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE
,
78 'QUOTEMARKS' => array('"','`'),
79 'HARDQUOTE' => array("'", "'"), // An optional 2-element array defining the beginning and end of a hard-quoted string
80 'HARDESCAPE' => array('\\\'',),
81 // Things that must still be escaped inside a hard-quoted string
82 // If HARDQUOTE is defined, HARDESCAPE must be defined
83 // This will not work unless the first character of each element is either in the
84 // QUOTEMARKS array or is the ESCAPE_CHAR
85 'ESCAPE_CHAR' => '\\',
88 'case', 'do', 'else', 'elsif', 'for', 'if', 'then', 'until', 'while', 'foreach', 'my',
89 'xor', 'or', 'and', 'unless', 'next', 'last', 'redo', 'not', 'our',
90 'reset', 'continue', 'cmp', 'ne', 'eq', 'lt', 'gt', 'le', 'ge',
93 'use', 'sub', 'new', '__END__', '__DATA__', '__DIE__', '__WARN__', 'BEGIN',
94 'STDIN', 'STDOUT', 'STDERR', 'ARGV', 'ARGVOUT'
97 'abs', 'accept', 'alarm', 'atan2', 'bind', 'binmode', 'bless',
98 'caller', 'chdir', 'chmod', 'chomp', 'chop', 'chown', 'chr',
99 'chroot', 'close', 'closedir', 'connect', 'cos',
100 'crypt', 'dbmclose', 'dbmopen', 'defined', 'delete', 'die',
101 'dump', 'each', 'endgrent', 'endhostent', 'endnetent', 'endprotoent',
102 'endpwent', 'endservent', 'eof', 'eval', 'exec', 'exists', 'exit',
103 'exp', 'fcntl', 'fileno', 'flock', 'fork', 'format', 'formline',
104 'getc', 'getgrent', 'getgrgid', 'getgrnam', 'gethostbyaddr',
105 'gethostbyname', 'gethostent', 'getlogin', 'getnetbyaddr', 'getnetbyname',
106 'getnetent', 'getpeername', 'getpgrp', 'getppid', 'getpriority',
107 'getprotobyname', 'getprotobynumber', 'getprotoent', 'getpwent',
108 'getpwnam', 'getpwuid', 'getservbyname', 'getservbyport', 'getservent',
109 'getsockname', 'getsockopt', 'glob', 'gmtime', 'goto', 'grep',
110 'hex', 'import', 'index', 'int', 'ioctl', 'join', 'keys', 'kill',
111 'lc', 'lcfirst', 'length', 'link', 'listen', 'local',
112 'localtime', 'log', 'lstat', 'm', 'map', 'mkdir', 'msgctl', 'msgget',
113 'msgrcv', 'msgsnd', 'no', 'oct', 'open', 'opendir',
114 'ord', 'pack', 'package', 'pipe', 'pop', 'pos', 'print',
115 'printf', 'prototype', 'push', 'qq', 'qr', 'quotemeta', 'qw',
116 'qx', 'q', 'rand', 'read', 'readdir', 'readline', 'readlink', 'readpipe',
117 'recv', 'ref', 'rename', 'require', 'return',
118 'reverse', 'rewinddir', 'rindex', 'rmdir', 's', 'scalar', 'seek',
119 'seekdir', 'select', 'semctl', 'semget', 'semop', 'send', 'setgrent',
120 'sethostent', 'setnetent', 'setpgrp', 'setpriority', 'setprotoent',
121 'setpwent', 'setservent', 'setsockopt', 'shift', 'shmctl', 'shmget',
122 'shmread', 'shmwrite', 'shutdown', 'sin', 'sleep', 'socket', 'socketpair',
123 'sort', 'splice', 'split', 'sprintf', 'sqrt', 'srand', 'stat',
124 'study', 'substr', 'symlink', 'syscall', 'sysopen', 'sysread',
125 'sysseek', 'system', 'syswrite', 'tell', 'telldir', 'tie', 'tied',
126 'time', 'times', 'tr', 'truncate', 'uc', 'ucfirst', 'umask', 'undef',
127 'unlink', 'unpack', 'unshift', 'untie', 'utime', 'values',
128 'vec', 'wait', 'waitpid', 'wantarray', 'warn', 'write', 'y'
133 '!', '@', '~', '&', '|', '^',
134 '+','-', '*', '/', '%',
135 ',', ';', '?', '.', ':'
137 'CASE_SENSITIVE' => array(
138 GESHI_COMMENTS
=> false,
145 1 => 'color: #b1b100;',
146 2 => 'color: #000000; font-weight: bold;',
147 3 => 'color: #000066;'
150 1 => 'color: #666666; font-style: italic;',
151 2 => 'color: #009966; font-style: italic;',
152 3 => 'color: #0000ff;',
153 4 => 'color: #cc0000; font-style: italic;',
154 5 => 'color: #0000ff;',
155 'MULTI' => 'color: #666666; font-style: italic;'
157 'ESCAPE_CHAR' => array(
158 0 => 'color: #000099; font-weight: bold;',
159 'HARD' => 'color: #000099; font-weight: bold;'
162 0 => 'color: #009900;'
165 0 => 'color: #ff0000;',
166 'HARD' => 'color: #ff0000;'
169 0 => 'color: #cc66cc;'
172 1 => 'color: #006600;',
173 2 => 'color: #006600;'
176 0 => 'color: #339933;'
179 0 => 'color: #0000ff;',
180 4 => 'color: #009999;',
188 3 => 'http://perldoc.perl.org/functions/{FNAMEL}.html'
191 'OBJECT_SPLITTERS' => array(
197 0 => '(?:\$[\$#]?|\\\\(?:[@%*]?|\\\\*\$|&)|%[$]?|@[$]?|\*[$]?|&[$]?)[a-zA-Z_][a-zA-Z0-9_]*',
199 4 => '<[a-zA-Z_][a-zA-Z0-9_]*>',
201 'STRICT_MODE_APPLIES' => GESHI_NEVER
,
202 'SCRIPT_DELIMITERS' => array(
204 'HIGHLIGHT_STRICT_BLOCK' => array(
206 'PARSER_CONTROL' => array(
208 'DISALLOWED_BEFORE' => '$'