KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

213 lines
8.6KB

  1. <?php
  2. /*************************************************************************************
  3. * perl.php
  4. * --------
  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
  9. *
  10. * Perl language file for GeSHi.
  11. *
  12. * CHANGES
  13. * -------
  14. * 2008/06/22 (1.0.8)
  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
  19. * 2008/02/15 (1.003)
  20. * - Fixed SF#1891630 with placebo patch
  21. * 2006/01/05 (1.0.2)
  22. * - Used hardescape feature for ' strings (Cliff Stanford)
  23. * 2004/11/27 (1.0.1)
  24. * - Added support for multiple object splitters
  25. * 2004/08/20 (1.0.0)
  26. * - First Release
  27. *
  28. * TODO (updated 2004/11/27)
  29. * -------------------------
  30. * * LABEL:
  31. * * string comparison operators
  32. *
  33. *************************************************************************************
  34. *
  35. * This file is part of GeSHi.
  36. *
  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.
  41. *
  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.
  46. *
  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
  50. *
  51. ************************************************************************************/
  52. $language_data = array (
  53. 'LANG_NAME' => 'Perl',
  54. 'COMMENT_SINGLE' => array(1 => '#'),
  55. 'COMMENT_MULTI' => array(
  56. '=back' => '=cut',
  57. '=head' => '=cut',
  58. '=item' => '=cut',
  59. '=over' => '=cut',
  60. '=begin' => '=cut',
  61. '=end' => '=cut',
  62. '=for' => '=cut',
  63. '=encoding' => '=cut',
  64. '=pod' => '=cut'
  65. ),
  66. 'COMMENT_REGEXP' => array(
  67. //Regular expressions
  68. 2 => "/(?<=[\\s^])(s|tr|y)\\/(?:\\\\.|(?!\n)[^\\/\\\\])+\\/(?:\\\\.|(?!\n)[^\\/\\\\])*\\/[msixpogcde]*(?=[\\s$\\.\\;])|(?<=[\\s^(=])(m|q[qrwx]?)?\\/(?:\\\\.|(?!\n)[^\\/\\\\])+\\/[msixpogc]*(?=[\\s$\\.\\,\\;\\)])/iU",
  69. //Regular expression match variables
  70. 3 => '/\$\d+/',
  71. //Heredoc
  72. 4 => '/<<\s*?([\'"]?)([a-zA-Z0-9]+)\1;[^\n]*?\\n.*\\n\\2(?![a-zA-Z0-9])/siU',
  73. //Predefined variables
  74. 5 => '/\$(\^[a-zA-Z]?|[\*\$`\'&_\.,+\-~:;\\\\\/"\|%=\?!@#<>\(\)\[\]])(?!\w)|@[_+\-]|%[!]|\$(?=\{)/',
  75. ),
  76. 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
  77. 'QUOTEMARKS' => array('"','`'),
  78. 'HARDQUOTE' => array("'", "'"), // An optional 2-element array defining the beginning and end of a hard-quoted string
  79. 'HARDESCAPE' => array('\\\'',),
  80. // Things that must still be escaped inside a hard-quoted string
  81. // If HARDQUOTE is defined, HARDESCAPE must be defined
  82. // This will not work unless the first character of each element is either in the
  83. // QUOTEMARKS array or is the ESCAPE_CHAR
  84. 'ESCAPE_CHAR' => '\\',
  85. 'KEYWORDS' => array(
  86. 1 => array(
  87. 'case', 'do', 'else', 'elsif', 'for', 'if', 'then', 'until', 'while', 'foreach', 'my',
  88. 'xor', 'or', 'and', 'unless', 'next', 'last', 'redo', 'not', 'our',
  89. 'reset', 'continue', 'cmp', 'ne', 'eq', 'lt', 'gt', 'le', 'ge',
  90. ),
  91. 2 => array(
  92. 'use', 'sub', 'new', '__END__', '__DATA__', '__DIE__', '__WARN__', 'BEGIN',
  93. 'STDIN', 'STDOUT', 'STDERR', 'ARGV', 'ARGVOUT'
  94. ),
  95. 3 => array(
  96. 'abs', 'accept', 'alarm', 'atan2', 'bind', 'binmode', 'bless',
  97. 'caller', 'chdir', 'chmod', 'chomp', 'chop', 'chown', 'chr',
  98. 'chroot', 'close', 'closedir', 'connect', 'cos',
  99. 'crypt', 'dbmclose', 'dbmopen', 'defined', 'delete', 'die',
  100. 'dump', 'each', 'endgrent', 'endhostent', 'endnetent', 'endprotoent',
  101. 'endpwent', 'endservent', 'eof', 'eval', 'exec', 'exists', 'exit',
  102. 'exp', 'fcntl', 'fileno', 'flock', 'fork', 'format', 'formline',
  103. 'getc', 'getgrent', 'getgrgid', 'getgrnam', 'gethostbyaddr',
  104. 'gethostbyname', 'gethostent', 'getlogin', 'getnetbyaddr', 'getnetbyname',
  105. 'getnetent', 'getpeername', 'getpgrp', 'getppid', 'getpriority',
  106. 'getprotobyname', 'getprotobynumber', 'getprotoent', 'getpwent',
  107. 'getpwnam', 'getpwuid', 'getservbyname', 'getservbyport', 'getservent',
  108. 'getsockname', 'getsockopt', 'glob', 'gmtime', 'goto', 'grep',
  109. 'hex', 'import', 'index', 'int', 'ioctl', 'join', 'keys', 'kill',
  110. 'lc', 'lcfirst', 'length', 'link', 'listen', 'local',
  111. 'localtime', 'log', 'lstat', 'm', 'map', 'mkdir', 'msgctl', 'msgget',
  112. 'msgrcv', 'msgsnd', 'no', 'oct', 'open', 'opendir',
  113. 'ord', 'pack', 'package', 'pipe', 'pop', 'pos', 'print',
  114. 'printf', 'prototype', 'push', 'qq', 'qr', 'quotemeta', 'qw',
  115. 'qx', 'q', 'rand', 'read', 'readdir', 'readline', 'readlink', 'readpipe',
  116. 'recv', 'ref', 'rename', 'require', 'return',
  117. 'reverse', 'rewinddir', 'rindex', 'rmdir', 's', 'scalar', 'seek',
  118. 'seekdir', 'select', 'semctl', 'semget', 'semop', 'send', 'setgrent',
  119. 'sethostent', 'setnetent', 'setpgrp', 'setpriority', 'setprotoent',
  120. 'setpwent', 'setservent', 'setsockopt', 'shift', 'shmctl', 'shmget',
  121. 'shmread', 'shmwrite', 'shutdown', 'sin', 'sleep', 'socket', 'socketpair',
  122. 'sort', 'splice', 'split', 'sprintf', 'sqrt', 'srand', 'stat',
  123. 'study', 'substr', 'symlink', 'syscall', 'sysopen', 'sysread',
  124. 'sysseek', 'system', 'syswrite', 'tell', 'telldir', 'tie', 'tied',
  125. 'time', 'times', 'tr', 'truncate', 'uc', 'ucfirst', 'umask', 'undef',
  126. 'unlink', 'unpack', 'unshift', 'untie', 'utime', 'values',
  127. 'vec', 'wait', 'waitpid', 'wantarray', 'warn', 'write', 'y'
  128. )
  129. ),
  130. 'SYMBOLS' => array(
  131. '<', '>', '=',
  132. '!', '@', '~', '&', '|', '^',
  133. '+','-', '*', '/', '%',
  134. ',', ';', '?', '.', ':'
  135. ),
  136. 'CASE_SENSITIVE' => array(
  137. GESHI_COMMENTS => false,
  138. 1 => true,
  139. 2 => true,
  140. 3 => true,
  141. ),
  142. 'STYLES' => array(
  143. 'KEYWORDS' => array(
  144. 1 => 'color: #b1b100;',
  145. 2 => 'color: #000000; font-weight: bold;',
  146. 3 => 'color: #000066;'
  147. ),
  148. 'COMMENTS' => array(
  149. 1 => 'color: #666666; font-style: italic;',
  150. 2 => 'color: #009966; font-style: italic;',
  151. 3 => 'color: #0000ff;',
  152. 4 => 'color: #cc0000; font-style: italic;',
  153. 5 => 'color: #0000ff;',
  154. 'MULTI' => 'color: #666666; font-style: italic;'
  155. ),
  156. 'ESCAPE_CHAR' => array(
  157. 0 => 'color: #000099; font-weight: bold;',
  158. 'HARD' => 'color: #000099; font-weight: bold;'
  159. ),
  160. 'BRACKETS' => array(
  161. 0 => 'color: #009900;'
  162. ),
  163. 'STRINGS' => array(
  164. 0 => 'color: #ff0000;',
  165. 'HARD' => 'color: #ff0000;'
  166. ),
  167. 'NUMBERS' => array(
  168. 0 => 'color: #cc66cc;'
  169. ),
  170. 'METHODS' => array(
  171. 1 => 'color: #006600;',
  172. 2 => 'color: #006600;'
  173. ),
  174. 'SYMBOLS' => array(
  175. 0 => 'color: #339933;'
  176. ),
  177. 'REGEXPS' => array(
  178. 0 => 'color: #0000ff;',
  179. 4 => 'color: #009999;',
  180. ),
  181. 'SCRIPT' => array(
  182. )
  183. ),
  184. 'URLS' => array(
  185. 1 => '',
  186. 2 => '',
  187. 3 => 'http://perldoc.perl.org/functions/{FNAMEL}.html'
  188. ),
  189. 'OOLANG' => true,
  190. 'OBJECT_SPLITTERS' => array(
  191. 1 => '-&gt;',
  192. 2 => '::'
  193. ),
  194. 'REGEXPS' => array(
  195. //Variable
  196. 0 => '(?:\$[\$#]?|\\\\(?:[@%*]?|\\\\*\$|&amp;)|%[$]?|@[$]?|\*[$]?|&amp;[$]?)[a-zA-Z_][a-zA-Z0-9_]*',
  197. //File Descriptor
  198. 4 => '&lt;[a-zA-Z_][a-zA-Z0-9_]*&gt;',
  199. ),
  200. 'STRICT_MODE_APPLIES' => GESHI_NEVER,
  201. 'SCRIPT_DELIMITERS' => array(
  202. ),
  203. 'HIGHLIGHT_STRICT_BLOCK' => array(
  204. ),
  205. 'PARSER_CONTROL' => array(
  206. 'COMMENTS' => array(
  207. 'DISALLOWED_BEFORE' => '$'
  208. )
  209. )
  210. );
  211. ?>