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 ([email protected]), Ben Keen ([email protected])
|
---|
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.8
|
---|
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 |
|
---|
48 | $language_data = array (
|
---|
49 | 'LANG_NAME' => 'Perl 6',
|
---|
50 | 'COMMENT_SINGLE' => array(1 => '#'),
|
---|
51 | 'COMMENT_MULTI' => array('=begin' => '=end'),
|
---|
52 | 'COMMENT_REGEXP' => array(
|
---|
53 | //Regular expressions
|
---|
54 | 2 => "/(?<=[\\s^])(s|tr|y)\\/(?:\\\\.|(?!\n)[^\\/\\\\])+\\/(?:\\\\.|(?!\n)[^\\/\\\\])*\\/[msixpogcde]*(?=[\\s$\\.\\;])|(?<=[\\s^(=])(m|q[qrwx]?)?\\/(?:\\\\.|(?!\n)[^\\/\\\\])+\\/[msixpogc]*(?=[\\s$\\.\\,\\;\\)])/iU",
|
---|
55 | //Regular expression match variables
|
---|
56 | 3 => '/\$\d+/',
|
---|
57 | //Heredoc
|
---|
58 | 4 => '/<<\s*?([\'"]?)([a-zA-Z0-9]+)\1;[^\n]*?\\n.*\\n\\2(?![a-zA-Z0-9])/siU',
|
---|
59 | //Beastly hack to finish highlighting each POD block
|
---|
60 | 5 => '((?<==end) .+)'
|
---|
61 | ),
|
---|
62 | 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
|
---|
63 | 'QUOTEMARKS' => array('"'),
|
---|
64 | 'HARDQUOTE' => array("'", "'"), // An optional 2-element array defining the beginning and end of a hard-quoted string
|
---|
65 | 'HARDESCAPE' => array('\\\''),
|
---|
66 | // Things that must still be escaped inside a hard-quoted string
|
---|
67 | // If HARDQUOTE is defined, HARDESCAPE must be defined
|
---|
68 | // This will not work unless the first character of each element is either in the
|
---|
69 | // QUOTEMARKS array or is the ESCAPE_CHAR
|
---|
70 | 'ESCAPE_CHAR' => '\\',
|
---|
71 | 'KEYWORDS' => array(
|
---|
72 | 1 => array(
|
---|
73 | 'do', 'else', 'elsif', 'for', 'if', 'then', 'until',
|
---|
74 | 'while', 'loop', 'repeat', 'my', 'xor', 'or', 'and',
|
---|
75 | 'unless', 'next', 'last', 'redo', 'not', 'our', 'let',
|
---|
76 | 'temp', 'state', 'enum', 'constant', 'continue', 'cmp',
|
---|
77 | 'ne', 'eq', 'lt', 'gt', 'le', 'ge', 'leg', 'div', 'X',
|
---|
78 | 'Z', 'x', 'xx', 'given', 'when', 'default', 'has',
|
---|
79 | 'returns', 'of', 'is', 'does', 'where', 'subset', 'but',
|
---|
80 | 'True', 'False', 'return', 'die', 'fail'
|
---|
81 | ),
|
---|
82 | 2 => array(
|
---|
83 | 'use', 'sub', 'multi', 'method', 'submethod', 'proto',
|
---|
84 | 'class', 'role', 'grammar', 'regex', 'token', 'rule',
|
---|
85 | 'new', 'BEGIN', 'END', 'CHECK', 'INIT', 'START', 'FIRST',
|
---|
86 | 'ENTER', 'LEAVE', 'KEEP', 'UNDO', 'NEXT', 'LAST', 'PRE',
|
---|
87 | 'POST', 'CATCH', 'CONTROL', 'BUILD'
|
---|
88 | ),
|
---|
89 | 3 => array(
|
---|
90 | 'all', 'any', 'cat', 'classify', 'defined', 'grep', 'first',
|
---|
91 | 'keys', 'kv', 'join', 'map', 'max', 'min', 'none', 'one', 'pairs',
|
---|
92 | 'print', 'printf', 'roundrobin', 'pick', 'reduce', 'reverse', 'say',
|
---|
93 | 'shape', 'sort', 'srand', 'undefine', 'uri', 'values', 'warn', 'zip',
|
---|
94 |
|
---|
95 | # Container
|
---|
96 | 'rotate', 'comb', 'end', 'elems', 'delete',
|
---|
97 | 'exists', 'pop', 'push', 'shift', 'splice',
|
---|
98 | 'unshift', 'invert', 'decode',
|
---|
99 |
|
---|
100 | # Numeric
|
---|
101 | 'succ', 'pred', 'abs', 'exp', 'log',
|
---|
102 | 'log10', 'rand', 'roots', 'cis', 'unpolar', 'i', 'floor',
|
---|
103 | 'ceiling', 'round', 'truncate', 'sign', 'sqrt',
|
---|
104 | 'polar', 're', 'im', 'I', 'atan2', 'nude',
|
---|
105 | 'denominator', 'numerator',
|
---|
106 |
|
---|
107 | # Str
|
---|
108 | 'p5chop', 'chop', 'p5chomp', 'chomp', 'lc', 'lcfirst',
|
---|
109 | 'uc', 'ucfirst', 'normalize', 'samecase', 'sameaccent',
|
---|
110 | 'capitalize', 'length', 'chars', 'graphs', 'codes',
|
---|
111 | 'bytes', 'encode', 'index', 'pack', 'quotemeta', 'rindex',
|
---|
112 | 'split', 'words', 'flip', 'sprintf', 'fmt',
|
---|
113 | 'substr', 'trim', 'unpack', 'match', 'subst', 'trans'
|
---|
114 | )
|
---|
115 | ),
|
---|
116 | 'SYMBOLS' => array(
|
---|
117 | '<', '>', '=',
|
---|
118 | '!', '@', '~', '&', '|', '^',
|
---|
119 | '+','-', '*', '/', '%',
|
---|
120 | ',', ';', '?', '.', ':',
|
---|
121 | ),
|
---|
122 | 'CASE_SENSITIVE' => array(
|
---|
123 | GESHI_COMMENTS => false,
|
---|
124 | 1 => true,
|
---|
125 | 2 => true,
|
---|
126 | 3 => true,
|
---|
127 | ),
|
---|
128 | 'STYLES' => array(
|
---|
129 | 'KEYWORDS' => array(
|
---|
130 | 1 => 'color: #b1b100;',
|
---|
131 | 2 => 'color: #000000; font-weight: bold;',
|
---|
132 | 3 => 'color: #000066;'
|
---|
133 | ),
|
---|
134 | 'COMMENTS' => array(
|
---|
135 | 1 => 'color: #666666; font-style: italic;',
|
---|
136 | 2 => 'color: #009966; font-style: italic;',
|
---|
137 | 3 => 'color: #0000ff;',
|
---|
138 | 4 => 'color: #cc0000; font-style: italic;',
|
---|
139 | 5 => 'color: #666666; font-style: italic;',
|
---|
140 | 'MULTI' => 'color: #666666; font-style: italic;'
|
---|
141 | ),
|
---|
142 | 'ESCAPE_CHAR' => array(
|
---|
143 | 0 => 'color: #000099; font-weight: bold;',
|
---|
144 | 'HARD' => 'color: #000099; font-weight: bold;'
|
---|
145 | ),
|
---|
146 | 'BRACKETS' => array(
|
---|
147 | 0 => 'color: #009900;'
|
---|
148 | ),
|
---|
149 | 'STRINGS' => array(
|
---|
150 | 0 => 'color: #ff0000;',
|
---|
151 | 'HARD' => 'color: #ff0000;'
|
---|
152 | ),
|
---|
153 | 'NUMBERS' => array(
|
---|
154 | 0 => 'color: #cc66cc;'
|
---|
155 | ),
|
---|
156 | 'METHODS' => array(
|
---|
157 | 1 => 'color: #006600;',
|
---|
158 | 2 => 'color: #006600;'
|
---|
159 | ),
|
---|
160 | 'SYMBOLS' => array(
|
---|
161 | 0 => 'color: #339933;'
|
---|
162 | ),
|
---|
163 | 'REGEXPS' => array(
|
---|
164 | 0 => 'color: #0000ff;',
|
---|
165 | ),
|
---|
166 | 'SCRIPT' => array(
|
---|
167 | )
|
---|
168 | ),
|
---|
169 | 'URLS' => array(
|
---|
170 | 1 => '',
|
---|
171 | 2 => '',
|
---|
172 | 3 => '',
|
---|
173 | ),
|
---|
174 | 'OOLANG' => true,
|
---|
175 | 'OBJECT_SPLITTERS' => array(
|
---|
176 | 1 => '.',
|
---|
177 | 2 => '::'
|
---|
178 | ),
|
---|
179 | 'REGEXPS' => array(
|
---|
180 | //Variable
|
---|
181 | 0 => '(?:[$@%]|&)(?:(?:[\^:*?!~]|<)?[a-zA-Z_][a-zA-Z0-9_]*|(?=\.))'
|
---|
182 | # We treat the . twigil specially so the name can be highlighted as an
|
---|
183 | # object field (via OBJECT_SPLITTERS).
|
---|
184 | ),
|
---|
185 | 'STRICT_MODE_APPLIES' => GESHI_NEVER,
|
---|
186 | 'SCRIPT_DELIMITERS' => array(
|
---|
187 | ),
|
---|
188 | 'HIGHLIGHT_STRICT_BLOCK' => array(
|
---|
189 | ),
|
---|
190 | 'PARSER_CONTROL' => array(
|
---|
191 | 'COMMENTS' => array(
|
---|
192 | 'DISALLOWED_BEFORE' => '$'
|
---|
193 | )
|
---|
194 | )
|
---|
195 | );
|
---|
196 |
|
---|
197 | ?> |
---|