PageSourceSearch

https://wild-cards.net/wc/wp-content/plugins/syntaxhighlighter/syn…/scripts/shBrushCSharp.js?ver=2.1.364

js wild-cards.net collected 2026-10-03 22:10:14 UTC 3,057 bytes, 67 lines download raw bytes

1/**
2 * SyntaxHighlighter
3 * http://alexgorbatchev.com/
4 *
5 * SyntaxHighlighter is donationware. If you are using it, please donate.
6 * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
7 *
8 * @version
9 * 2.1.364 (October 15 2009)
10 * 
11 * @copyright
12 * Copyright (C) 2004-2009 Alex Gorbatchev.
13 *
14 * @license
15 * This file is part of SyntaxHighlighter.
16 * 
17 * SyntaxHighlighter is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU Lesser General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 * 
22 * SyntaxHighlighter is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 * GNU General Public License for more details.
26 * 
27 * You should have received a copy of the GNU General Public License
28 * along with SyntaxHighlighter.  If not, see <http://www.gnu.org/copyleft/lesser.html>.
29 */
30SyntaxHighlighter.brushes.CSharp = function()
31{
32	var keywords =	'abstract as base bool break byte case catch char checked class const ' +
33					'continue decimal default delegate do double else enum event explicit ' +
34					'extern false finally fixed float for foreach get goto if implicit in int ' +
35					'interface internal is lock long namespace new null object operator out ' +
36					'override params private protected public readonly ref return sbyte sealed set ' +
37					'short sizeof stackalloc static string struct switch this throw true try ' +
38					'typeof uint ulong unchecked unsafe ushort using virtual void while';
39
40	function fixComments(match, regexInfo)
41	{
42		var css = (match[0].indexOf("///") == 0)
43			? 'color1'
44			: 'comments'
45			;
46			
47		return [new SyntaxHighlighter.Match(match[0], match.index, css)];
48	}
49
50	this.regexList = [
51		{ regex: SyntaxHighlighter.regexLib.singleLineCComments,	func : fixComments },		// one line comments
52		{ regex: SyntaxHighlighter.regexLib.multiLineCComments,		css: 'comments' },			// multiline comments
53		{ regex: /@"(?:[^"]|"")*"/g,								css: 'string' },			// @-quoted strings
54		{ regex: SyntaxHighlighter.regexLib.doubleQuotedString,		css: 'string' },			// strings
55		{ regex: SyntaxHighlighter.regexLib.singleQuotedString,		css: 'string' },			// strings
56		{ regex: /^\s*#.*/gm,										css: 'preprocessor' },		// preprocessor tags like #region and #endregion
57		{ regex: new RegExp(this.getKeywords(keywords), 'gm'),		css: 'keyword' },			// c# keyword
58		{ regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g,	css: 'keyword' },			// contextual keyword: 'partial'
59		{ regex: /\byield(?=\s+(?:return|break)\b)/g,				css: 'keyword' }			// contextual keyword: 'yield'
60		];
61		
62	this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
63};
64
65SyntaxHighlighter.brushes.CSharp.prototype	= new SyntaxHighlighter.Highlighter();
66SyntaxHighlighter.brushes.CSharp.aliases	= ['c#', 'c-sharp', 'csharp'];
67

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.