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