1;(function() 2{ 3 // CommonJS 4 SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); 5 6 function Brush() 7 { 8 var keywords = 'abstract as async await base bool break byte case catch char checked class const ' + 9 'continue decimal default delegate do double else enum event explicit volatile ' + 10 'extern false finally fixed float for foreach get goto if implicit in int ' + 11 'interface internal is lock long namespace new null object operator out ' + 12 'override params private protected public readonly ref return sbyte sealed set ' + 13 'short sizeof stackalloc static string struct switch this throw true try ' + 14 'typeof uint ulong unchecked unsafe ushort using virtual void while var ' + 15 'from group by into select let where orderby join on equals ascending descending'; 16 17 function fixComments(match, regexInfo) 18 { 19 var css = (match[0].indexOf("///") == 0) 20 ? 'color1' 21 : 'comments' 22 ; 23 24 return [new SyntaxHighlighter.Match(match[0], match.index, css)]; 25 } 26 27 this.regexList = [ 28 { regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments 29 { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 30 { regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings 31 { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 32 { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 33 { regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 34 { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword 35 { regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial' 36 { regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield' 37 ]; 38 39 this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 40 }; 41 42 Brush.prototype = new SyntaxHighlighter.Highlighter(); 43 Brush.aliases = ['c#', 'c-sharp', 'csharp']; 44 45 SyntaxHighlighter.brushes.CSharp = Brush; 46 47 // CommonJS 48 typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 49})(); 50