plugins/geshi/geshi/csharp.php
changeset 2 9e3258dfae15
parent 0 441963e5b07a
child 3 f3e2bbbd2155
equal deleted inserted replaced
1:c715631f809a 2:9e3258dfae15
     2 /*************************************************************************************
     2 /*************************************************************************************
     3  * csharp.php
     3  * csharp.php
     4  * ----------
     4  * ----------
     5  * Author: Alan Juden (alan@judenware.org)
     5  * Author: Alan Juden (alan@judenware.org)
     6  * Copyright: (c) 2004 Alan Juden, Nigel McNie (http://qbnz.com/highlighter/)
     6  * Copyright: (c) 2004 Alan Juden, Nigel McNie (http://qbnz.com/highlighter/)
     7  * Release Version: 1.0.7.20
     7  * Release Version: 1.0.8.2
     8  * Date Started: 2004/06/04
     8  * Date Started: 2004/06/04
     9  *
     9  *
    10  * C# language file for GeSHi.
    10  * C# language file for GeSHi.
    11  *
    11  *
    12  * CHANGES
    12  * CHANGES
    13  * -------
    13  * -------
       
    14  * 2008/05/25 (1.0.7.22)
       
    15  *   -  Added highlighting of using and namespace directives as non-OOP
    14  * 2005/01/05 (1.0.1)
    16  * 2005/01/05 (1.0.1)
    15  *  -  Used hardquote support for @"..." strings (Cliff Stanford)
    17  *  -  Used hardquote support for @"..." strings (Cliff Stanford)
    16  * 2004/11/27 (1.0.0)
    18  * 2004/11/27 (1.0.0)
    17  *  -  Initial release
    19  *  -  Initial release
    18  *
    20  *
    37  *   along with GeSHi; if not, write to the Free Software
    39  *   along with GeSHi; if not, write to the Free Software
    38  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    40  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    39  *
    41  *
    40  ************************************************************************************/
    42  ************************************************************************************/
    41 
    43 
    42  $language_data = array (
    44 $language_data = array (
    43 	'LANG_NAME' => 'C#',
    45     'LANG_NAME' => 'C#',
    44 	'COMMENT_SINGLE' => array(1 => '//', 2 => '#'),
    46     'COMMENT_SINGLE' => array(1 => '//', 2 => '#'),
    45 	'COMMENT_MULTI' => array('/*' => '*/'),
    47     'COMMENT_MULTI' => array('/*' => '*/'),
    46 	'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
    48     'COMMENT_REGEXP' => array(
    47 	'QUOTEMARKS' => array("'", '"'),
    49         //Using and Namespace directives (basic support)
       
    50         //Please note that the alias syntax for using is not supported
       
    51         3 => '/(?:(?<=using[\\n\\s])|(?<=namespace[\\n\\s]))[\\n\\s]*([a-zA-Z0-9_]+\\.)*[a-zA-Z0-9_]+[\n\s]*(?=[;=])/i'),
       
    52     'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
       
    53     'QUOTEMARKS' => array("'", '"'),
    48     'HARDQUOTE' => array('@"', '"'),
    54     'HARDQUOTE' => array('@"', '"'),
    49     'HARDESCAPE' => array('""'),
    55     'HARDESCAPE' => array('""'),
    50 	'ESCAPE_CHAR' => '\\',
    56     'ESCAPE_CHAR' => '\\',
    51 	'KEYWORDS' => array(
    57     'KEYWORDS' => array(
    52 		1 => array(
    58         1 => array(
    53 			'as', 'auto', 'base', 'break', 'case', 'catch', 'const', 'continue',
    59             'as', 'auto', 'base', 'break', 'case', 'catch', 'const', 'continue',
    54 			'default', 'do', 'else', 'event', 'explicit', 'extern', 'false',
    60             'default', 'do', 'else', 'event', 'explicit', 'extern', 'false',
    55 			'finally', 'fixed', 'for', 'foreach', 'goto', 'if', 'implicit',
    61             'finally', 'fixed', 'for', 'foreach', 'goto', 'if', 'implicit',
    56 			'in', 'internal', 'lock', 'namespace', 'null', 'operator', 'out',
    62             'in', 'internal', 'lock', 'namespace', 'null', 'operator', 'out',
    57 			'override', 'params', 'private', 'protected', 'public', 'readonly',
    63             'override', 'params', 'partial', 'private', 'protected', 'public',
    58 			'ref', 'return', 'sealed', 'stackalloc', 'static', 'switch', 'this',
    64             'readonly', 'ref', 'return', 'sealed', 'stackalloc', 'static',
    59 			'throw', 'true', 'try', 'unsafe', 'using', 'virtual', 'void', 'while'
    65             'switch', 'this', 'throw', 'true', 'try', 'unsafe', 'using',
    60 			),
    66             'virtual', 'void', 'while'
    61 		2 => array(
    67             ),
    62 			'#elif', '#endif', '#endregion', '#else', '#error', '#define', '#if',
    68         2 => array(
    63 			'#line', '#region', '#undef', '#warning'
    69             '#elif', '#endif', '#endregion', '#else', '#error', '#define', '#if',
    64 			),
    70             '#line', '#region', '#undef', '#warning'
    65 		3 => array(
    71             ),
    66 			'checked', 'is', 'new', 'sizeof', 'typeof', 'unchecked'
    72         3 => array(
    67 			),
    73             'checked', 'is', 'new', 'sizeof', 'typeof', 'unchecked'
    68 		4 => array(
    74             ),
    69 			'bool', 'byte', 'char', 'class', 'decimal', 'delegate', 'double',
    75         4 => array(
    70 			'enum', 'float', 'int', 'interface', 'long', 'object', 'sbyte',
    76             'bool', 'byte', 'char', 'class', 'decimal', 'delegate', 'double',
    71 			'short', 'string', 'struct', 'uint', 'ulong', 'ushort'
    77             'enum', 'float', 'int', 'interface', 'long', 'object', 'sbyte',
    72 			),
    78             'short', 'string', 'struct', 'uint', 'ulong', 'ushort'
    73 		5 => array(
    79             ),
    74 			'Microsoft.Win32',
    80         5 => array(
    75 			'System',
    81             'Microsoft.Win32',
    76 			'System.CodeDOM',
    82             'System',
    77 			'System.CodeDOM.Compiler',
    83             'System.CodeDOM',
    78 			'System.Collections',
    84             'System.CodeDOM.Compiler',
    79 			'System.Collections.Bases',
    85             'System.Collections',
    80 			'System.ComponentModel',
    86             'System.Collections.Bases',
    81 			'System.ComponentModel.Design',
    87             'System.ComponentModel',
    82 			'System.ComponentModel.Design.CodeModel',
    88             'System.ComponentModel.Design',
    83 			'System.Configuration',
    89             'System.ComponentModel.Design.CodeModel',
    84 			'System.Configuration.Assemblies',
    90             'System.Configuration',
    85 			'System.Configuration.Core',
    91             'System.Configuration.Assemblies',
    86 			'System.Configuration.Install',
    92             'System.Configuration.Core',
    87 			'System.Configuration.Interceptors',
    93             'System.Configuration.Install',
    88 			'System.Configuration.Schema',
    94             'System.Configuration.Interceptors',
    89 			'System.Configuration.Web',
    95             'System.Configuration.Schema',
    90 			'System.Core',
    96             'System.Configuration.Web',
    91 			'System.Data',
    97             'System.Core',
    92 			'System.Data.ADO',
    98             'System.Data',
    93 			'System.Data.Design',
    99             'System.Data.ADO',
    94 			'System.Data.Internal',
   100             'System.Data.Design',
    95 			'System.Data.SQL',
   101             'System.Data.Internal',
    96 			'System.Data.SQLTypes',
   102             'System.Data.SQL',
    97 			'System.Data.XML',
   103             'System.Data.SQLTypes',
    98 			'System.Data.XML.DOM',
   104             'System.Data.XML',
    99 			'System.Data.XML.XPath',
   105             'System.Data.XML.DOM',
   100 			'System.Data.XML.XSLT',
   106             'System.Data.XML.XPath',
   101 			'System.Diagnostics',
   107             'System.Data.XML.XSLT',
   102 			'System.Diagnostics.SymbolStore',
   108             'System.Diagnostics',
   103 			'System.DirectoryServices',
   109             'System.Diagnostics.SymbolStore',
   104 			'System.Drawing',
   110             'System.DirectoryServices',
   105 			'System.Drawing.Design',
   111             'System.Drawing',
   106 			'System.Drawing.Drawing2D',
   112             'System.Drawing.Design',
   107 			'System.Drawing.Imaging',
   113             'System.Drawing.Drawing2D',
   108 			'System.Drawing.Printing',
   114             'System.Drawing.Imaging',
   109 			'System.Drawing.Text',
   115             'System.Drawing.Printing',
   110 			'System.Globalization',
   116             'System.Drawing.Text',
   111 			'System.IO',
   117             'System.Globalization',
   112 			'System.IO.IsolatedStorage',
   118             'System.IO',
   113 			'System.Messaging',
   119             'System.IO.IsolatedStorage',
   114 			'System.Net',
   120             'System.Messaging',
   115 			'System.Net.Sockets',
   121             'System.Net',
   116 			'System.NewXml',
   122             'System.Net.Sockets',
   117 			'System.NewXml.XPath',
   123             'System.NewXml',
   118 			'System.NewXml.Xsl',
   124             'System.NewXml.XPath',
   119 			'System.Reflection',
   125             'System.NewXml.Xsl',
   120 			'System.Reflection.Emit',
   126             'System.Reflection',
   121 			'System.Resources',
   127             'System.Reflection.Emit',
   122 			'System.Runtime.InteropServices',
   128             'System.Resources',
   123 			'System.Runtime.InteropServices.Expando',
   129             'System.Runtime.InteropServices',
   124 			'System.Runtime.Remoting',
   130             'System.Runtime.InteropServices.Expando',
   125 			'System.Runtime.Serialization',
   131             'System.Runtime.Remoting',
   126 			'System.Runtime.Serialization.Formatters',
   132             'System.Runtime.Serialization',
   127 			'System.Runtime.Serialization.Formatters.Binary',
   133             'System.Runtime.Serialization.Formatters',
   128 			'System.Security',
   134             'System.Runtime.Serialization.Formatters.Binary',
   129 			'System.Security.Cryptography',
   135             'System.Security',
   130 			'System.Security.Cryptography.X509Certificates',
   136             'System.Security.Cryptography',
   131 			'System.Security.Permissions',
   137             'System.Security.Cryptography.X509Certificates',
   132 			'System.Security.Policy',
   138             'System.Security.Permissions',
   133 			'System.Security.Principal',
   139             'System.Security.Policy',
   134 			'System.ServiceProcess',
   140             'System.Security.Principal',
   135 			'System.Text',
   141             'System.ServiceProcess',
   136 			'System.Text.RegularExpressions',
   142             'System.Text',
   137 			'System.Threading',
   143             'System.Text.RegularExpressions',
   138 			'System.Timers',
   144             'System.Threading',
   139 			'System.Web',
   145             'System.Timers',
   140 			'System.Web.Caching',
   146             'System.Web',
   141 			'System.Web.Configuration',
   147             'System.Web.Caching',
   142 			'System.Web.Security',
   148             'System.Web.Configuration',
   143 			'System.Web.Services',
   149             'System.Web.Security',
   144 			'System.Web.Services.Description',
   150             'System.Web.Services',
   145 			'System.Web.Services.Discovery',
   151             'System.Web.Services.Description',
   146 			'System.Web.Services.Protocols',
   152             'System.Web.Services.Discovery',
   147 			'System.Web.UI',
   153             'System.Web.Services.Protocols',
   148 			'System.Web.UI.Design',
   154             'System.Web.UI',
   149 			'System.Web.UI.Design.WebControls',
   155             'System.Web.UI.Design',
   150 			'System.Web.UI.Design.WebControls.ListControls',
   156             'System.Web.UI.Design.WebControls',
   151 			'System.Web.UI.HtmlControls',
   157             'System.Web.UI.Design.WebControls.ListControls',
   152 			'System.Web.UI.WebControls',
   158             'System.Web.UI.HtmlControls',
   153 			'System.WinForms',
   159             'System.Web.UI.WebControls',
   154 			'System.WinForms.ComponentModel',
   160             'System.WinForms',
   155 			'System.WinForms.Design',
   161             'System.WinForms.ComponentModel',
   156 			'System.Xml',
   162             'System.WinForms.Design',
   157 			'System.Xml.Serialization',
   163             'System.Xml',
   158 			'System.Xml.Serialization.Code',
   164             'System.Xml.Serialization',
   159 			'System.Xml.Serialization.Schema'
   165             'System.Xml.Serialization.Code',
   160 			),
   166             'System.Xml.Serialization.Schema'
   161 		),
   167             ),
   162 	'SYMBOLS' => array(
   168         ),
   163 		'+', '-', '*', '?', '=', '/', '%', '&', '>', '<', '^', '!', '|', ':',
   169     'SYMBOLS' => array(
   164 		'(', ')', '{', '}', '[', ']'
   170         '+', '-', '*', '?', '=', '/', '%', '&', '>', '<', '^', '!', ':', ';',
   165 		),
   171         '(', ')', '{', '}', '[', ']', '|'
   166 	'CASE_SENSITIVE' => array(
   172         ),
   167 		GESHI_COMMENTS => true,
   173     'CASE_SENSITIVE' => array(
   168 		1 => false,
   174         GESHI_COMMENTS => false,
   169 		2 => false,
   175         1 => false,
   170 		3 => false,
   176         2 => false,
   171 		4 => false,
   177         3 => false,
   172 		5 => false,
   178         4 => false,
   173 		),
   179         5 => false,
   174 	'STYLES' => array(
   180         ),
   175 		'KEYWORDS' => array(
   181     'STYLES' => array(
   176 			1 => 'color: #0600FF;',
   182         'KEYWORDS' => array(
   177 			2 => 'color: #FF8000; font-weight: bold;',
   183             1 => 'color: #0600FF;',
   178 			3 => 'color: #008000;',
   184             2 => 'color: #FF8000; font-weight: bold;',
   179 			4 => 'color: #FF0000;',
   185             3 => 'color: #008000;',
   180 			5 => 'color: #000000;'
   186             4 => 'color: #FF0000;',
   181 			),
   187             5 => 'color: #000000;'
   182 		'COMMENTS' => array(
   188             ),
   183 			1 => 'color: #008080; font-style: italic;',
   189         'COMMENTS' => array(
   184 			2 => 'color: #008080;',
   190             1 => 'color: #008080; font-style: italic;',
   185 			'MULTI' => 'color: #008080; font-style: italic;'
   191             2 => 'color: #008080;',
   186 			),
   192             3 => 'color: #008080;',
   187 		'ESCAPE_CHAR' => array(
   193             'MULTI' => 'color: #008080; font-style: italic;'
   188 			0 => 'color: #008080; font-weight: bold;'
   194             ),
   189 			),
   195         'ESCAPE_CHAR' => array(
   190 		'BRACKETS' => array(
   196             0 => 'color: #008080; font-weight: bold;',
   191 			0 => 'color: #000000;'
   197             'HARD' => 'color: #008080; font-weight: bold;'
   192 			),
   198             ),
   193 		'STRINGS' => array(
   199         'BRACKETS' => array(
   194 			0 => 'color: #808080;'
   200             0 => 'color: #000000;'
   195 			),
   201             ),
   196 		'NUMBERS' => array(
   202         'STRINGS' => array(
   197 			0 => 'color: #FF0000;'
   203             0 => 'color: #666666;',
   198 			),
   204             'HARD' => 'color: #666666;'
   199 		'METHODS' => array(
   205             ),
   200 			1 => 'color: #0000FF;',
   206         'NUMBERS' => array(
   201 			2 => 'color: #0000FF;'
   207             0 => 'color: #FF0000;'
   202 			),
   208             ),
   203 		'SYMBOLS' => array(
   209         'METHODS' => array(
   204 			0 => 'color: #008000;'
   210             1 => 'color: #0000FF;',
   205 			),
   211             2 => 'color: #0000FF;'
   206 		'REGEXPS' => array(
   212             ),
   207 			),
   213         'SYMBOLS' => array(
   208 		'SCRIPT' => array(
   214             0 => 'color: #008000;'
   209 			)
   215             ),
   210 		),
   216         'REGEXPS' => array(
   211 	'URLS' => array(
   217             ),
   212 		1 => '',
   218         'SCRIPT' => array(
   213 		2 => '',
   219             )
   214 		3 => 'http://www.google.com/search?q={FNAME}+msdn.microsoft.com',
   220         ),
   215 		4 => ''
   221     'URLS' => array(
   216 		),
   222         1 => '',
   217 	'OOLANG' => true,
   223         2 => '',
   218 	'OBJECT_SPLITTERS' => array(
   224         3 => 'http://www.google.com/search?q={FNAMEL}+msdn.microsoft.com',
   219 		1 => '.',
   225         4 => '',
   220 		2 => '::'
   226         5 => ''
   221 		),
   227         ),
   222 	'REGEXPS' => array(
   228     'OOLANG' => true,
   223 		),
   229     'OBJECT_SPLITTERS' => array(
   224 	'STRICT_MODE_APPLIES' => GESHI_NEVER,
   230         1 => '.',
   225 	'SCRIPT_DELIMITERS' => array(
   231         2 => '::'
   226 		),
   232         ),
   227 	'HIGHLIGHT_STRICT_BLOCK' => array(
   233     'REGEXPS' => array(
   228         ),
   234         ),
   229     'TAB_WIDTH' => 4
   235     'STRICT_MODE_APPLIES' => GESHI_NEVER,
       
   236     'SCRIPT_DELIMITERS' => array(
       
   237         ),
       
   238     'HIGHLIGHT_STRICT_BLOCK' => array(
       
   239         ),
       
   240     'TAB_WIDTH' => 4,
       
   241     'PARSER_CONTROL' => array(
       
   242         'KEYWORDS' => array(
       
   243             'DISALLOWED_BEFORE' => "(?<![a-zA-Z0-9\$_\|\#>|^])",
       
   244             'DISALLOWED_AFTER' => "(?![a-zA-Z0-9_<\|%\\-])"
       
   245         )
       
   246     )
   230 );
   247 );
   231 
   248 
   232 ?>
   249 ?>