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