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