1 | 1 | simandl | <?php |
2 | | | /************************************************************************************* |
3 | | | * d.php |
4 | | | * ----- |
5 | | | * Author: Thomas Kuehne (thomas@kuehne.cn) |
6 | | | * Copyright: (c) 2005 Thomas Kuehne (http://thomas.kuehne.cn/) |
7 | 3 | simandl | * Release Version: 1.0.8.3 |
8 | 1 | simandl | * Date Started: 2005/04/22 |
9 | | | * |
10 | | | * D language file for GeSHi. |
11 | | | * |
12 | | | * CHANGES |
13 | | | * ------- |
14 | | | * 2005/04/22 (0.0.2) |
15 | | | * - added _d_* and sizeof/ptrdiff_t |
16 | | | * 2005/04/20 (0.0.1) |
17 | | | * - First release |
18 | | | * |
19 | | | * TODO (updated 2005/04/22) |
20 | | | * ------------------------- |
21 | | | * * nested comments |
22 | | | * * correct handling of r"" and `` |
23 | | | * * correct handling of ... and .. |
24 | | | * |
25 | | | ************************************************************************************* |
26 | | | * |
27 | | | * This file is part of GeSHi. |
28 | | | * |
29 | | | * GeSHi is free software; you can redistribute it and/or modify |
30 | | | * it under the terms of the GNU General Public License as published by |
31 | | | * the Free Software Foundation; either version 2 of the License, or |
32 | | | * (at your option) any later version. |
33 | | | * |
34 | | | * GeSHi is distributed in the hope that it will be useful, |
35 | | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
36 | | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
37 | | | * GNU General Public License for more details. |
38 | | | * |
39 | | | * You should have received a copy of the GNU General Public License |
40 | | | * along with GeSHi; if not, write to the Free Software |
41 | | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
42 | | | * |
43 | | | ************************************************************************************/ |
44 | | | |
45 | | | $language_data = array ( |
46 | | | 'LANG_NAME' => 'D', |
47 | | | 'COMMENT_SINGLE' => array(2 => '///', 1 => '//'), |
48 | | | 'COMMENT_MULTI' => array('/*' => '*/'), |
49 | | | 'COMMENT_REGEXP' => array( |
50 | | | // doxygen comments |
51 | 3 | simandl | 3 => '#/\*\*(?![\*\/]).*\*/#sU', |
52 | 1 | simandl | // raw strings |
53 | | | 4 => '#r"[^"]*"#s', |
54 | | | // Script Style interpreter comment |
55 | | | 5 => "/\A#!(?=\\/).*?$/m" |
56 | | | ), |
57 | | | 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, |
58 | | | 'QUOTEMARKS' => array('"', "'"), |
59 | | | 'ESCAPE_CHAR' => '', |
60 | | | 'ESCAPE_REGEXP' => array( |
61 | | | //Simple Single Char Escapes |
62 | 3 | simandl | 1 => "#\\\\[abfnrtv\\'\"?\n\\\\]#i", |
63 | 1 | simandl | //Hexadecimal Char Specs |
64 | | | 2 => "#\\\\x[\da-fA-F]{2}#", |
65 | | | //Hexadecimal Char Specs |
66 | | | 3 => "#\\\\u[\da-fA-F]{4}#", |
67 | | | //Hexadecimal Char Specs |
68 | | | 4 => "#\\\\U[\da-fA-F]{8}#", |
69 | | | //Octal Char Specs |
70 | | | 5 => "#\\\\[0-7]{1,3}#", |
71 | | | //Named entity escapes |
72 | | | /*6 => "#\\\\&(?:quot|amp|lt|gt|OElig|oelig|Scaron|scaron|Yuml|circ|tilde|". |
73 | | | "ensp|emsp|thinsp|zwnj|zwj|lrm|rlm|ndash|mdash|lsquo|rsquo|sbquo|". |
74 | | | "ldquo|rdquo|bdquo|dagger|Dagger|permil|lsaquo|rsaquo|euro|nbsp|". |
75 | | | "iexcl|cent|pound|curren|yen|brvbar|sect|uml|copy|ordf|laquo|not|". |
76 | | | "shy|reg|macr|deg|plusmn|sup2|sup3|acute|micro|para|middot|cedil|". |
77 | | | "sup1|ordm|raquo|frac14|frac12|frac34|iquest|Agrave|Aacute|Acirc|". |
78 | | | "Atilde|Auml|Aring|AElig|Ccedil|Egrave|Eacute|Ecirc|Euml|Igrave|". |
79 | | | "Iacute|Icirc|Iuml|ETH|Ntilde|Ograve|Oacute|Ocirc|Otilde|Ouml|". |
80 | | | "times|Oslash|Ugrave|Uacute|Ucirc|Uuml|Yacute|THORN|szlig|agrave|". |
81 | | | "aacute|acirc|atilde|auml|aring|aelig|ccedil|egrave|eacute|ecirc|". |
82 | | | "euml|igrave|iacute|icirc|iuml|eth|ntilde|ograve|oacute|ocirc|". |
83 | | | "otilde|ouml|divide|oslash|ugrave|uacute|ucirc|uuml|yacute|thorn|". |
84 | | | "yuml|fnof|Alpha|Beta|Gamma|Delta|Epsilon|Zeta|Eta|Theta|Iota|". |
85 | | | "Kappa|Lambda|Mu|Nu|Xi|Omicron|Pi|Rho|Sigma|Tau|Upsilon|Phi|Chi|". |
86 | | | "Psi|Omega|alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|". |
87 | | | "kappa|lambda|mu|nu|xi|omicron|pi|rho|sigmaf|sigma|tau|upsilon|". |
88 | | | "phi|chi|psi|omega|thetasym|upsih|piv|bull|hellip|prime|Prime|". |
89 | | | "oline|frasl|weierp|image|real|trade|alefsym|larr|uarr|rarr|darr|". |
90 | | | "harr|crarr|lArr|uArr|rArr|dArr|hArr|forall|part|exist|empty|". |
91 | | | "nabla|isin|notin|ni|prod|sum|minus|lowast|radic|prop|infin|ang|". |
92 | | | "and|or|cap|cup|int|there4|sim|cong|asymp|ne|equiv|le|ge|sub|sup|". |
93 | | | "nsub|sube|supe|oplus|otimes|perp|sdot|lceil|rceil|lfloor|rfloor|". |
94 | | | "lang|rang|loz|spades|clubs|hearts|diams);#",*/ |
95 | | | // optimized: |
96 | | | 6 => "#\\\\&(?:A(?:Elig|acute|circ|grave|lpha|ring|tilde|uml)|Beta|". |
97 | | | "C(?:cedil|hi)|D(?:agger|elta)|E(?:TH|acute|circ|grave|psilon|ta|uml)|". |
98 | | | "Gamma|I(?:acute|circ|grave|ota|uml)|Kappa|Lambda|Mu|N(?:tilde|u)|". |
99 | | | "O(?:Elig|acute|circ|grave|m(?:ega|icron)|slash|tilde|uml)|". |
100 | | | "P(?:hi|i|rime|si)|Rho|S(?:caron|igma)|T(?:HORN|au|heta)|". |
101 | | | "U(?:acute|circ|grave|psilon|uml)|Xi|Y(?:acute|uml)|Zeta|". |
102 | | | "a(?:acute|c(?:irc|ute)|elig|grave|l(?:efsym|pha)|mp|n[dg]|ring|". |
103 | | | "symp|tilde|uml)|b(?:dquo|eta|rvbar|ull)|c(?:ap|cedil|e(?:dil|nt)|". |
104 | | | "hi|irc|lubs|o(?:ng|py)|rarr|u(?:p|rren))|d(?:Arr|a(?:gger|rr)|". |
105 | | | "e(?:g|lta)|i(?:ams|vide))|e(?:acute|circ|grave|m(?:pty|sp)|nsp|". |
106 | | | "psilon|quiv|t[ah]|u(?:ml|ro)|xist)|f(?:nof|orall|ra(?:c(?:1[24]|34)|sl))|". |
107 | | | "g(?:amma|e|t)|h(?:Arr|arr|e(?:arts|llip))|i(?:acute|circ|excl|grave|mage|". |
108 | | | "n(?:fin|t)|ota|quest|sin|uml)|kappa|l(?:Arr|a(?:mbda|ng|quo|rr)|ceil|". |
109 | | | "dquo|e|floor|o(?:wast|z)|rm|s(?:aquo|quo)|t)|m(?:acr|dash|". |
110 | | | "i(?:cro|ddot|nus)|u)|n(?:abla|bsp|dash|e|i|ot(?:in)?|sub|tilde|u)|". |
111 | | | "o(?:acute|circ|elig|grave|line|m(?:ega|icron)|plus|r(?:d[fm])?|". |
112 | | | "slash|ti(?:lde|mes)|uml)|p(?:ar[at]|er(?:mil|p)|hi|iv?|lusmn|ound|". |
113 | | | "r(?:ime|o[dp])|si)|quot|r(?:Arr|a(?:dic|ng|quo|rr)|ceil|dquo|e(?:al|g)|". |
114 | | | "floor|ho|lm|s(?:aquo|quo))|s(?:bquo|caron|dot|ect|hy|i(?:gmaf?|m)|". |
115 | | | "pades|u(?:be?|m|p[123e]?)|zlig)|t(?:au|h(?:e(?:re4|ta(?:sym)?)|insp|". |
116 | | | "orn)|i(?:lde|mes)|rade)|u(?:Arr|a(?:cute|rr)|circ|grave|ml|". |
117 | | | "psi(?:h|lon)|uml)|weierp|xi|y(?:acute|en|uml)|z(?:eta|w(?:j|nj)));#", |
118 | | | ), |
119 | | | 'HARDQUOTE' => array('`', '`'), |
120 | | | 'HARDESCAPE' => array(), |
121 | | | 'NUMBERS' => |
122 | | | GESHI_NUMBER_INT_BASIC | GESHI_NUMBER_INT_CSTYLE | GESHI_NUMBER_BIN_PREFIX_0B | |
123 | | | GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX | GESHI_NUMBER_FLT_NONSCI | |
124 | | | GESHI_NUMBER_FLT_NONSCI_F | GESHI_NUMBER_FLT_SCI_SHORT | GESHI_NUMBER_FLT_SCI_ZERO, |
125 | | | 'KEYWORDS' => array( |
126 | | | 1 => array( |
127 | | | 'break', 'case', 'continue', 'do', 'else', |
128 | | | 'for', 'foreach', 'goto', 'if', 'return', |
129 | | | 'switch', 'while' |
130 | | | ), |
131 | | | 2 => array( |
132 | | | 'alias', 'asm', 'assert', 'body', 'cast', |
133 | | | 'catch', 'default', 'delegate', 'delete', |
134 | | | 'extern', 'false', 'finally', 'function', |
135 | | | 'import', 'in', 'inout', 'interface', |
136 | | | 'invariant', 'is', 'mixin', 'module', 'new', |
137 | 3 | simandl | 'null', 'out', 'pragma', 'ref', 'super', 'this', |
138 | 1 | simandl | 'throw', 'true', 'try', 'typedef', 'typeid', |
139 | | | 'typeof', 'union', 'with' |
140 | | | ), |
141 | | | 3 => array( |
142 | | | 'ArrayBoundsError', 'AssertError', |
143 | | | 'ClassInfo', 'Error', 'Exception', |
144 | | | 'Interface', 'ModuleInfo', 'Object', |
145 | | | 'OutOfMemoryException', 'SwitchError', |
146 | | | 'TypeInfo', '_d_arrayappend', |
147 | | | '_d_arrayappendb', '_d_arrayappendc', |
148 | | | '_d_arrayappendcb', '_d_arraycast', |
149 | | | '_d_arraycast_frombit', '_d_arraycat', |
150 | | | '_d_arraycatb', '_d_arraycatn', |
151 | | | '_d_arraycopy', '_d_arraycopybit', |
152 | | | '_d_arraysetbit', '_d_arraysetbit2', |
153 | | | '_d_arraysetlength', '_d_arraysetlengthb', |
154 | | | '_d_callfinalizer', |
155 | | | '_d_create_exception_object', |
156 | | | '_d_criticalenter', '_d_criticalexit', |
157 | | | '_d_delarray', '_d_delclass', |
158 | | | '_d_delinterface', '_d_delmemory', |
159 | | | '_d_dynamic_cast', '_d_exception', |
160 | | | '_d_exception_filter', '_d_framehandler', |
161 | | | '_d_interface_cast', '_d_interface_vtbl', |
162 | | | '_d_invariant', '_d_isbaseof', |
163 | | | '_d_isbaseof2', '_d_local_unwind', |
164 | | | '_d_monitorenter', '_d_monitorexit', |
165 | | | '_d_monitorrelease', '_d_monitor_epilog', |
166 | | | '_d_monitor_handler', '_d_monitor_prolog', |
167 | | | '_d_new', '_d_newarrayi', '_d_newbitarray', |
168 | | | '_d_newclass', '_d_obj_cmp', '_d_obj_eq', |
169 | | | '_d_OutOfMemory', '_d_switch_dstring', |
170 | | | '_d_switch_string', '_d_switch_ustring', |
171 | | | '_d_throw', |
172 | | | ), |
173 | | | 4 => array( |
174 | | | 'abstract', 'align', 'auto', 'bit', 'bool', |
175 | | | 'byte', 'cdouble', 'cent', 'cfloat', 'char', |
176 | | | 'class', 'const', 'creal', 'dchar', 'debug', |
177 | | | 'deprecated', 'double', 'enum', 'export', |
178 | | | 'final', 'float', 'idouble', 'ifloat', 'int', |
179 | | | 'ireal', 'long', 'override', 'package', |
180 | | | 'private', 'protected', 'ptrdiff_t', |
181 | | | 'public', 'real', 'short', 'size_t', |
182 | | | 'static', 'struct', 'synchronized', |
183 | | | 'template', 'ubyte', 'ucent', 'uint', |
184 | | | 'ulong', 'unittest', 'ushort', 'version', |
185 | | | 'void', 'volatile', 'wchar' |
186 | | | ) |
187 | | | ), |
188 | | | 'SYMBOLS' => array( |
189 | | | '(', ')', '[', ']', '{', '}', '?', '!', ';', ':', ',', '...', '..', |
190 | | | '+', '-', '*', '/', '%', '&', '|', '^', '<', '>', '=', '~', |
191 | | | ), |
192 | | | 'CASE_SENSITIVE' => array( |
193 | | | GESHI_COMMENTS => false, |
194 | | | 1 => true, |
195 | | | 2 => true, |
196 | | | 3 => true, |
197 | | | 4 => true |
198 | | | ), |
199 | | | 'STYLES' => array( |
200 | | | 'KEYWORDS' => array( |
201 | | | 1 => 'color: #b1b100;', |
202 | | | 2 => 'color: #000000; font-weight: bold;', |
203 | | | 3 => 'color: #aaaadd; font-weight: bold;', |
204 | | | 4 => 'color: #993333;' |
205 | | | ), |
206 | | | 'COMMENTS' => array( |
207 | | | 1 => 'color: #808080; font-style: italic;', |
208 | | | 2 => 'color: #009933; font-style: italic;', |
209 | | | 3 => 'color: #009933; font-style: italic;', |
210 | | | 4 => 'color: #ff0000;', |
211 | | | 5 => 'color: #0040ff;', |
212 | | | 'MULTI' => 'color: #808080; font-style: italic;' |
213 | | | ), |
214 | | | 'ESCAPE_CHAR' => array( |
215 | | | |
216 | | | 1 => 'color: #000099; font-weight: bold;', |
217 | | | 2 => 'color: #660099; font-weight: bold;', |
218 | | | 3 => 'color: #660099; font-weight: bold;', |
219 | | | 4 => 'color: #660099; font-weight: bold;', |
220 | | | 5 => 'color: #006699; font-weight: bold;', |
221 | | | 6 => 'color: #666699; font-weight: bold; font-style: italic;', |
222 | | | 'HARD' => '', |
223 | | | ), |
224 | | | 'BRACKETS' => array( |
225 | | | |
226 | | | ), |
227 | | | 'STRINGS' => array( |
228 | | | |
229 | | | 'HARD' => 'color: #ff0000;' |
230 | | | ), |
231 | | | 'NUMBERS' => array( |
232 | | | |
233 | | | GESHI_NUMBER_BIN_PREFIX_0B => 'color: #208080;', |
234 | | | GESHI_NUMBER_OCT_PREFIX => 'color: #208080;', |
235 | | | GESHI_NUMBER_HEX_PREFIX => 'color: #208080;', |
236 | | | GESHI_NUMBER_FLT_SCI_SHORT => 'color:#800080;', |
237 | | | GESHI_NUMBER_FLT_SCI_ZERO => 'color:#800080;', |
238 | | | GESHI_NUMBER_FLT_NONSCI_F => 'color:#800080;', |
239 | | | GESHI_NUMBER_FLT_NONSCI => 'color:#800080;' |
240 | | | ), |
241 | | | 'METHODS' => array( |
242 | | | 1 => 'color: #006600;', |
243 | | | 2 => 'color: #006600;' |
244 | | | ), |
245 | | | 'SYMBOLS' => array( |
246 | | | |
247 | | | ), |
248 | | | 'SCRIPT' => array( |
249 | | | ), |
250 | | | 'REGEXPS' => array( |
251 | | | ) |
252 | | | ), |
253 | | | 'URLS' => array( |
254 | | | 1 => '', |
255 | | | 2 => '', |
256 | | | 3 => '', |
257 | | | 4 => '' |
258 | | | ), |
259 | | | 'OOLANG' => true, |
260 | | | 'OBJECT_SPLITTERS' => array( |
261 | | | 1 => '.', |
262 | | | ), |
263 | | | 'REGEXPS' => array( |
264 | | | ), |
265 | | | 'STRICT_MODE_APPLIES' => GESHI_NEVER, |
266 | | | 'SCRIPT_DELIMITERS' => array( |
267 | | | ), |
268 | | | 'HIGHLIGHT_STRICT_BLOCK' => array( |
269 | | | ) |
270 | | | ); |
271 | | | |
272 | 3 | simandl | ?> |