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.

perl6.php 7.6KB

11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?php
  2. /*************************************************************************************
  3. * perl6.php
  4. * ---------
  5. * Author: Kodi Arfer (kodiarfer {at} warpmail {period} net); forked from perl.php 1.0.8 by Andreas Gohr (andi@splitbrain.org), Ben Keen (ben.keen@gmail.com)
  6. * Copyright: (c) 2009 Kodi Arfer, (c) 2004 Andreas Gohr, Ben Keen (http://www.benjaminkeen.org/), Nigel McNie (http://qbnz.com/highlighter/)
  7. * Release Version: 1.0.8.10
  8. * Date Started: 2009/11/07
  9. *
  10. * Perl 6 language file for GeSHi.
  11. *
  12. * CHANGES
  13. * -------
  14. * 2009/12/25 (1.0.8.6)
  15. * - First Release
  16. *
  17. * TODO (updated 2009/11/07)
  18. * -------------------------
  19. * * It's all pretty rough. Perl 6 is complicated; this'll never be more
  20. * than reasonably accurate unless it's carefully written to match
  21. * STD.pm.
  22. * * It's largely incomplete. Lots of keywords are no doubt missing.
  23. * * Recognize comments like #`( Hello! ).
  24. * * Recognize qw-ing angle brackets.
  25. * * ! should probably be in OBJECT_SPLITTERS too, but putting it there
  26. * gives bizarre results. What to do?.
  27. *
  28. *************************************************************************************
  29. *
  30. * This file is part of GeSHi.
  31. *
  32. * GeSHi is free software; you can redistribute it and/or modify
  33. * it under the terms of the GNU General Public License as published by
  34. * the Free Software Foundation; either version 2 of the License, or
  35. * (at your option) any later version.
  36. *
  37. * GeSHi is distributed in the hope that it will be useful,
  38. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  39. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  40. * GNU General Public License for more details.
  41. *
  42. * You should have received a copy of the GNU General Public License
  43. * along with GeSHi; if not, write to the Free Software
  44. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  45. *
  46. ************************************************************************************/
  47. $language_data = array (
  48. 'LANG_NAME' => 'Perl 6',
  49. 'COMMENT_SINGLE' => array(1 => '#'),
  50. 'COMMENT_MULTI' => array('=begin' => '=end'),
  51. 'COMMENT_REGEXP' => array(
  52. //Regular expressions
  53. 2 => "/(?<=[\\s^])(s|tr|y)\\/(?:\\\\.|(?!\n)[^\\/\\\\])+\\/(?:\\\\.|(?!\n)[^\\/\\\\])*\\/[msixpogcde]*(?=[\\s$\\.\\;])|(?<=[\\s^(=])(m|q[qrwx]?)?\\/(?:\\\\.|(?!\n)[^\\/\\\\])+\\/[msixpogc]*(?=[\\s$\\.\\,\\;\\)])/iU",
  54. //Regular expression match variables
  55. 3 => '/\$\d+/',
  56. //Heredoc
  57. 4 => '/<<\s*?([\'"]?)([a-zA-Z0-9]+)\1;[^\n]*?\\n.*\\n\\2(?![a-zA-Z0-9])/siU',
  58. //Beastly hack to finish highlighting each POD block
  59. 5 => '((?<==end) .+)'
  60. ),
  61. 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
  62. 'QUOTEMARKS' => array('"'),
  63. 'HARDQUOTE' => array("'", "'"), // An optional 2-element array defining the beginning and end of a hard-quoted string
  64. 'HARDESCAPE' => array('\\\''),
  65. // Things that must still be escaped inside a hard-quoted string
  66. // If HARDQUOTE is defined, HARDESCAPE must be defined
  67. // This will not work unless the first character of each element is either in the
  68. // QUOTEMARKS array or is the ESCAPE_CHAR
  69. 'ESCAPE_CHAR' => '\\',
  70. 'KEYWORDS' => array(
  71. 1 => array(
  72. 'do', 'else', 'elsif', 'for', 'if', 'then', 'until',
  73. 'while', 'loop', 'repeat', 'my', 'xor', 'or', 'and',
  74. 'unless', 'next', 'last', 'redo', 'not', 'our', 'let',
  75. 'temp', 'state', 'enum', 'constant', 'continue', 'cmp',
  76. 'ne', 'eq', 'lt', 'gt', 'le', 'ge', 'leg', 'div', 'X',
  77. 'Z', 'x', 'xx', 'given', 'when', 'default', 'has',
  78. 'returns', 'of', 'is', 'does', 'where', 'subset', 'but',
  79. 'True', 'False', 'return', 'die', 'fail'
  80. ),
  81. 2 => array(
  82. 'use', 'sub', 'multi', 'method', 'submethod', 'proto',
  83. 'class', 'role', 'grammar', 'regex', 'token', 'rule',
  84. 'new', 'BEGIN', 'END', 'CHECK', 'INIT', 'START', 'FIRST',
  85. 'ENTER', 'LEAVE', 'KEEP', 'UNDO', 'NEXT', 'LAST', 'PRE',
  86. 'POST', 'CATCH', 'CONTROL', 'BUILD'
  87. ),
  88. 3 => array(
  89. 'all', 'any', 'cat', 'classify', 'defined', 'grep', 'first',
  90. 'keys', 'kv', 'join', 'map', 'max', 'min', 'none', 'one', 'pairs',
  91. 'print', 'printf', 'roundrobin', 'pick', 'reduce', 'reverse', 'say',
  92. 'shape', 'sort', 'srand', 'undefine', 'uri', 'values', 'warn', 'zip',
  93. # Container
  94. 'rotate', 'comb', 'end', 'elems', 'delete',
  95. 'exists', 'pop', 'push', 'shift', 'splice',
  96. 'unshift', 'invert', 'decode',
  97. # Numeric
  98. 'succ', 'pred', 'abs', 'exp', 'log',
  99. 'log10', 'rand', 'roots', 'cis', 'unpolar', 'i', 'floor',
  100. 'ceiling', 'round', 'truncate', 'sign', 'sqrt',
  101. 'polar', 're', 'im', 'I', 'atan2', 'nude',
  102. 'denominator', 'numerator',
  103. # Str
  104. 'p5chop', 'chop', 'p5chomp', 'chomp', 'lc', 'lcfirst',
  105. 'uc', 'ucfirst', 'normalize', 'samecase', 'sameaccent',
  106. 'capitalize', 'length', 'chars', 'graphs', 'codes',
  107. 'bytes', 'encode', 'index', 'pack', 'quotemeta', 'rindex',
  108. 'split', 'words', 'flip', 'sprintf', 'fmt',
  109. 'substr', 'trim', 'unpack', 'match', 'subst', 'trans'
  110. )
  111. ),
  112. 'SYMBOLS' => array(
  113. '<', '>', '=',
  114. '!', '@', '~', '&', '|', '^',
  115. '+','-', '*', '/', '%',
  116. ',', ';', '?', '.', ':',
  117. ),
  118. 'CASE_SENSITIVE' => array(
  119. GESHI_COMMENTS => false,
  120. 1 => true,
  121. 2 => true,
  122. 3 => true,
  123. ),
  124. 'STYLES' => array(
  125. 'KEYWORDS' => array(
  126. 1 => 'color: #b1b100;',
  127. 2 => 'color: #000000; font-weight: bold;',
  128. 3 => 'color: #000066;'
  129. ),
  130. 'COMMENTS' => array(
  131. 1 => 'color: #666666; font-style: italic;',
  132. 2 => 'color: #009966; font-style: italic;',
  133. 3 => 'color: #0000ff;',
  134. 4 => 'color: #cc0000; font-style: italic;',
  135. 5 => 'color: #666666; font-style: italic;',
  136. 'MULTI' => 'color: #666666; font-style: italic;'
  137. ),
  138. 'ESCAPE_CHAR' => array(
  139. 0 => 'color: #000099; font-weight: bold;',
  140. 'HARD' => 'color: #000099; font-weight: bold;'
  141. ),
  142. 'BRACKETS' => array(
  143. 0 => 'color: #009900;'
  144. ),
  145. 'STRINGS' => array(
  146. 0 => 'color: #ff0000;',
  147. 'HARD' => 'color: #ff0000;'
  148. ),
  149. 'NUMBERS' => array(
  150. 0 => 'color: #cc66cc;'
  151. ),
  152. 'METHODS' => array(
  153. 1 => 'color: #006600;',
  154. 2 => 'color: #006600;'
  155. ),
  156. 'SYMBOLS' => array(
  157. 0 => 'color: #339933;'
  158. ),
  159. 'REGEXPS' => array(
  160. 0 => 'color: #0000ff;',
  161. ),
  162. 'SCRIPT' => array(
  163. )
  164. ),
  165. 'URLS' => array(
  166. 1 => '',
  167. 2 => '',
  168. 3 => '',
  169. ),
  170. 'OOLANG' => true,
  171. 'OBJECT_SPLITTERS' => array(
  172. 1 => '.',
  173. 2 => '::'
  174. ),
  175. 'REGEXPS' => array(
  176. //Variable
  177. 0 => '(?:[$@%]|&amp;)(?:(?:[\^:*?!~]|&lt;)?[a-zA-Z_][a-zA-Z0-9_]*|(?=\.))'
  178. # We treat the . twigil specially so the name can be highlighted as an
  179. # object field (via OBJECT_SPLITTERS).
  180. ),
  181. 'STRICT_MODE_APPLIES' => GESHI_NEVER,
  182. 'SCRIPT_DELIMITERS' => array(
  183. ),
  184. 'HIGHLIGHT_STRICT_BLOCK' => array(
  185. ),
  186. 'PARSER_CONTROL' => array(
  187. 'COMMENTS' => array(
  188. 'DISALLOWED_BEFORE' => '$'
  189. )
  190. )
  191. );
  192. ?>