diff options
author | JinweiClarkChao <[email protected]> | 2014-09-23 22:34:14 +0800 |
---|---|---|
committer | Jinwei Zhao <[email protected]> | 2017-01-13 15:07:44 +0800 |
commit | b214f38d2c24a890ce36512a0c8bab965e27a508 (patch) | |
tree | 1522b651444407cbf120798e79be4657f1b472ab /Code/Blocks/syntax/scripts/shBrushCSharp.js | |
parent | e13882d1656b143533cec307a19425e0a56ec999 (diff) | |
download | jinwei.me-b214f38d2c24a890ce36512a0c8bab965e27a508.tar.gz |
README
Diffstat (limited to 'Code/Blocks/syntax/scripts/shBrushCSharp.js')
-rw-r--r-- | Code/Blocks/syntax/scripts/shBrushCSharp.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Code/Blocks/syntax/scripts/shBrushCSharp.js b/Code/Blocks/syntax/scripts/shBrushCSharp.js new file mode 100644 index 0000000..079214e --- /dev/null +++ b/Code/Blocks/syntax/scripts/shBrushCSharp.js | |||
@@ -0,0 +1,65 @@ | |||
1 | /** | ||
2 | * SyntaxHighlighter | ||
3 | * http://alexgorbatchev.com/SyntaxHighlighter | ||
4 | * | ||
5 | * SyntaxHighlighter is donationware. If you are using it, please donate. | ||
6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html | ||
7 | * | ||
8 | * @version | ||
9 | * 3.0.83 (July 02 2010) | ||
10 | * | ||
11 | * @copyright | ||
12 | * Copyright (C) 2004-2010 Alex Gorbatchev. | ||
13 | * | ||
14 | * @license | ||
15 | * Dual licensed under the MIT and GPL licenses. | ||
16 | */ | ||
17 | ;(function() | ||
18 | { | ||
19 | // CommonJS | ||
20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; | ||
21 | |||
22 | function Brush() | ||
23 | { | ||
24 | var keywords = 'abstract as base bool break byte case catch char checked class const ' + | ||
25 | 'continue decimal default delegate do double else enum event explicit ' + | ||
26 | 'extern false finally fixed float for foreach get goto if implicit in int ' + | ||
27 | 'interface internal is lock long namespace new null object operator out ' + | ||
28 | 'override params private protected public readonly ref return sbyte sealed set ' + | ||
29 | 'short sizeof stackalloc static string struct switch this throw true try ' + | ||
30 | 'typeof uint ulong unchecked unsafe ushort using virtual void while'; | ||
31 | |||
32 | function fixComments(match, regexInfo) | ||
33 | { | ||
34 | var css = (match[0].indexOf("///") == 0) | ||
35 | ? 'color1' | ||
36 | : 'comments' | ||
37 | ; | ||
38 | |||
39 | return [new SyntaxHighlighter.Match(match[0], match.index, css)]; | ||
40 | } | ||
41 | |||
42 | this.regexList = [ | ||
43 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments | ||
44 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments | ||
45 | { regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings | ||
46 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings | ||
47 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings | ||
48 | { regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion | ||
49 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword | ||
50 | { regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial' | ||
51 | { regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield' | ||
52 | ]; | ||
53 | |||
54 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); | ||
55 | }; | ||
56 | |||
57 | Brush.prototype = new SyntaxHighlighter.Highlighter(); | ||
58 | Brush.aliases = ['c#', 'c-sharp', 'csharp']; | ||
59 | |||
60 | SyntaxHighlighter.brushes.CSharp = Brush; | ||
61 | |||
62 | // CommonJS | ||
63 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; | ||
64 | })(); | ||
65 | |||