plugins/geshi/geshi/d.php
changeset 2 9e3258dfae15
parent 0 441963e5b07a
child 3 f3e2bbbd2155
equal deleted inserted replaced
1:c715631f809a 2:9e3258dfae15
     2 /*************************************************************************************
     2 /*************************************************************************************
     3  * d.php
     3  * d.php
     4  * -----
     4  * -----
     5  * Author: Thomas Kuehne (thomas@kuehne.cn)
     5  * Author: Thomas Kuehne (thomas@kuehne.cn)
     6  * Copyright: (c) 2005 Thomas Kuehne (http://thomas.kuehne.cn/)
     6  * Copyright: (c) 2005 Thomas Kuehne (http://thomas.kuehne.cn/)
     7  * Release Version: 1.0.7.20
     7  * Release Version: 1.0.8.2
     8  * Date Started: 2005/04/22
     8  * Date Started: 2005/04/22
     9  *
     9  *
    10  * D language file for GeSHi.
    10  * D language file for GeSHi.
    11  *
    11  *
    12  * CHANGES
    12  * CHANGES
    42  *
    42  *
    43  ************************************************************************************/
    43  ************************************************************************************/
    44 
    44 
    45 $language_data = array (
    45 $language_data = array (
    46     'LANG_NAME' => 'D',
    46     'LANG_NAME' => 'D',
    47     'COMMENT_SINGLE' => array(1 => '//'),
    47     'COMMENT_SINGLE' => array(2 => '///', 1 => '//'),
    48     'COMMENT_MULTI' => array('/*' => '*/'),
    48     'COMMENT_MULTI' => array('/*' => '*/'),
       
    49     'COMMENT_REGEXP' => array(
       
    50         // doxygen comments
       
    51         3 => '#/\*\*(?![\*\/]).*\*/#sU',
       
    52         // raw strings
       
    53         4 => '#r"[^"]*"#s',
       
    54         // Script Style interpreter comment
       
    55         5 => "/\A#!(?=\\/).*?$/m"
       
    56         ),
    49     'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
    57     'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
    50     'QUOTEMARKS' => array('"', "'", '`'),
    58     'QUOTEMARKS' => array('"', "'"),
    51     'ESCAPE_CHAR' => '\\',
    59     'ESCAPE_CHAR' => '',
       
    60     'ESCAPE_REGEXP' => array(
       
    61         //Simple Single Char Escapes
       
    62         1 => "#\\\\[abfnrtv\\'\"?\n]#i",
       
    63         //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,
    52     'KEYWORDS' => array(
   125     'KEYWORDS' => array(
    53         1 => array(
   126         1 => array(
    54                 'while',
   127                 'break', 'case', 'continue', 'do', 'else',
    55                 'switch',
   128                 'for', 'foreach', 'goto', 'if', 'return',
    56                 'if',
   129                 'switch', 'while'
    57                 'foreach',
       
    58                 'for',
       
    59                 'goto',
       
    60                 'return',
       
    61                 'else',
       
    62                 'do',
       
    63                 'case',
       
    64                 'continue',
       
    65                 'break'
       
    66             ),
   130             ),
    67         2 => array(
   131         2 => array(
    68                 'with',
   132                 'alias', 'asm', 'assert', 'body', 'cast',
    69                 'union',
   133                 'catch', 'default', 'delegate', 'delete',
    70                 'typeof',
   134                 'extern', 'false', 'finally', 'function',
    71                 'typeid',
   135                 'import', 'in', 'inout', 'interface',
    72                 'typedef',
   136                 'invariant', 'is', 'mixin', 'module', 'new',
    73                 'try',
   137                 'null', 'out', 'pragma', 'ref', 'super', 'this',
    74                 'true',
   138                 'throw', 'true', 'try', 'typedef', 'typeid',
    75                 'throw',
   139                 'typeof', 'union', 'with'
    76                 'this',
       
    77                 'super',
       
    78                 'pragma',
       
    79                 'out',
       
    80                 'null',
       
    81                 'new',
       
    82                 'module',
       
    83                 'mixin',
       
    84                 'is',
       
    85                 'invariant',
       
    86                 'interface',
       
    87                 'inout',
       
    88                 'in',
       
    89                 'import',
       
    90                 'function',
       
    91                 'finally',
       
    92                 'false',
       
    93                 'extern',
       
    94                 'delete',
       
    95                 'delegate',
       
    96                 'default',
       
    97                 'catch',
       
    98                 'cast',
       
    99                 'body',
       
   100                 'assert',
       
   101                 'asm',
       
   102                 'alias'
       
   103             ),
   140             ),
   104         3 => array(
   141         3 => array(
   105                 'TypeInfo',
   142                 'ArrayBoundsError', 'AssertError',
   106                 'SwitchError',
   143                 'ClassInfo', 'Error', 'Exception',
   107                 'OutOfMemoryException',
   144                 'Interface', 'ModuleInfo', 'Object',
   108                 'Object',
   145                 'OutOfMemoryException', 'SwitchError',
   109                 'ModuleInfo',
   146                 'TypeInfo', '_d_arrayappend',
   110                 'Interface',
   147                 '_d_arrayappendb', '_d_arrayappendc',
   111                 'Exception',
   148                 '_d_arrayappendcb', '_d_arraycast',
   112                 'Error',
   149                 '_d_arraycast_frombit', '_d_arraycat',
   113                 'ClassInfo',
   150                 '_d_arraycatb', '_d_arraycatn',
   114                 'ArrayBoundsError',
   151                 '_d_arraycopy', '_d_arraycopybit',
   115                 'AssertError',
   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',
   116                 '_d_throw',
   171                 '_d_throw',
   117                 '_d_switch_ustring',
       
   118                 '_d_switch_string',
       
   119                 '_d_switch_dstring',
       
   120                 '_d_OutOfMemory',
       
   121                 '_d_obj_eq',
       
   122                 '_d_obj_cmp',
       
   123                 '_d_newclass',
       
   124                 '_d_newbitarray',
       
   125                 '_d_newarrayi',
       
   126                 '_d_new',
       
   127                 '_d_monitorrelease',
       
   128                 '_d_monitor_prolog',
       
   129                 '_d_monitor_handler',
       
   130                 '_d_monitorexit',
       
   131                 '_d_monitor_epilog',
       
   132                 '_d_monitorenter',
       
   133                 '_d_local_unwind',
       
   134                 '_d_isbaseof2',
       
   135                 '_d_isbaseof',
       
   136                 '_d_invariant',
       
   137                 '_d_interface_vtbl',
       
   138                 '_d_interface_cast',
       
   139                 '_d_framehandler',
       
   140                 '_d_exception_filter',
       
   141                 '_d_exception',
       
   142                 '_d_dynamic_cast',
       
   143                 '_d_delmemory',
       
   144                 '_d_delinterface',
       
   145                 '_d_delclass',
       
   146                 '_d_delarray',
       
   147                 '_d_criticalexit',
       
   148                 '_d_criticalenter',
       
   149                 '_d_create_exception_object',
       
   150                 '_d_callfinalizer',
       
   151                 '_d_arraysetlengthb',
       
   152                 '_d_arraysetlength',
       
   153                 '_d_arraysetbit2',
       
   154                 '_d_arraysetbit',
       
   155                 '_d_arraycopybit',
       
   156                 '_d_arraycopy',
       
   157                 '_d_arraycatn',
       
   158                 '_d_arraycatb',
       
   159                 '_d_arraycat',
       
   160                 '_d_arraycast_frombit',
       
   161                 '_d_arraycast',
       
   162                 '_d_arrayappendcb',
       
   163                 '_d_arrayappendc',
       
   164                 '_d_arrayappendb',
       
   165                 '_d_arrayappend',
       
   166             ),
   172             ),
   167         4 => array(
   173         4 => array(
   168                 'wchar',
   174                 'abstract', 'align', 'auto', 'bit', 'bool',
   169                 'volatile',
   175                 'byte', 'cdouble', 'cent', 'cfloat', 'char',
   170                 'void',
   176                 'class', 'const', 'creal', 'dchar', 'debug',
   171                 'version',
   177                 'deprecated', 'double', 'enum', 'export',
   172                 'ushort',
   178                 'final', 'float', 'idouble', 'ifloat', 'int',
   173                 'unittest',
   179                 'ireal', 'long', 'override', 'package',
   174                 'ulong',
   180                 'private', 'protected', 'ptrdiff_t',
   175                 'uint',
   181                 'public', 'real', 'short', 'size_t',
   176                 'ucent',
   182                 'static', 'struct', 'synchronized',
   177                 'ubyte',
   183                 'template', 'ubyte', 'ucent', 'uint',
   178                 'template',
   184                 'ulong', 'unittest', 'ushort', 'version',
   179                 'struct',
   185                 'void', 'volatile', 'wchar'
   180                 'static',
       
   181                 'synchronized',
       
   182                 'size_t',
       
   183                 'short',
       
   184                 'real',
       
   185                 'public',
       
   186                 'protected',
       
   187                 'private',
       
   188                 'ptrdiff_t',
       
   189                 'package',
       
   190                 'override',
       
   191                 'long',
       
   192                 'int',
       
   193                 'ireal',
       
   194                 'ifloat',
       
   195                 'idouble',
       
   196                 'float',
       
   197                 'final',
       
   198                 'export',
       
   199                 'enum',
       
   200                 'double',
       
   201                 'deprecated',
       
   202                 'debug',
       
   203                 'dchar',
       
   204                 'creal',
       
   205                 'const',
       
   206                 'class',
       
   207                 'char',
       
   208                 'cfloat',
       
   209                 'cent',
       
   210                 'cdouble',
       
   211                 'byte',
       
   212                 'bool',
       
   213                 'bit',
       
   214                 'auto',
       
   215                 'align',
       
   216                 'abstract'
       
   217             )
   186             )
   218         ),
   187         ),
   219     'SYMBOLS' => array(
   188     'SYMBOLS' => array(
   220         '(', ')', '[', ']', '{', '}', '?', '!', ';', ':', ',', '...', '..',
   189         '(', ')', '[', ']', '{', '}', '?', '!', ';', ':', ',', '...', '..',
   221         '+', '-', '*', '/', '%', '&', '|', '^', '<', '>', '=', '~',
   190         '+', '-', '*', '/', '%', '&', '|', '^', '<', '>', '=', '~',
   222         ),
   191         ),
   223     'CASE_SENSITIVE' => array(
   192     'CASE_SENSITIVE' => array(
   224         GESHI_COMMENTS => true,
   193         GESHI_COMMENTS => false,
   225         1 => true,
   194         1 => true,
   226         2 => true,
   195         2 => true,
   227         3 => true,
   196         3 => true,
   228         4 => true
   197         4 => true
   229         ),
   198         ),
   233             2 => 'color: #000000; font-weight: bold;',
   202             2 => 'color: #000000; font-weight: bold;',
   234             3 => 'color: #aaaadd; font-weight: bold;',
   203             3 => 'color: #aaaadd; font-weight: bold;',
   235             4 => 'color: #993333;'
   204             4 => 'color: #993333;'
   236             ),
   205             ),
   237         'COMMENTS' => array(
   206         'COMMENTS' => array(
   238             1=> 'color: #808080; font-style: italic;',
   207             1 => 'color: #808080; font-style: italic;',
   239             2=> 'color: #a1a100;',
   208             2 => 'color: #009933; font-style: italic;',
       
   209             3 => 'color: #009933; font-style: italic;',
       
   210             4 => 'color: #ff0000;',
       
   211             5 => 'color: #0040ff;',
   240             'MULTI' => 'color: #808080; font-style: italic;'
   212             'MULTI' => 'color: #808080; font-style: italic;'
   241             ),
   213             ),
   242         'ESCAPE_CHAR' => array(
   214         'ESCAPE_CHAR' => array(
   243             0 => 'color: #000099; font-weight: bold;'
   215             0 => 'color: #000099; font-weight: bold;',
       
   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' => '',
   244             ),
   223             ),
   245         'BRACKETS' => array(
   224         'BRACKETS' => array(
   246             0 => 'color: #66cc66;'
   225             0 => 'color: #66cc66;'
   247             ),
   226             ),
   248         'STRINGS' => array(
   227         'STRINGS' => array(
   249             0 => 'color: #ff0000;'
   228             0 => 'color: #ff0000;',
       
   229             'HARD' => 'color: #ff0000;'
   250             ),
   230             ),
   251         'NUMBERS' => array(
   231         'NUMBERS' => array(
   252             0 => 'color: #cc66cc;'
   232             0 => 'color: #0000dd;',
       
   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;'
   253             ),
   240             ),
   254         'METHODS' => array(
   241         'METHODS' => array(
   255             1 => 'color: #006600;',
   242             1 => 'color: #006600;',
   256             2 => 'color: #006600;'
   243             2 => 'color: #006600;'
   257             ),
   244             ),