|
| 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 (Wed, 16 Apr 2014 03:56:09 GMT) |
| 10 | + * |
| 11 | + * @copyright |
| 12 | + * Copyright (C) 2004-2013 Alex Gorbatchev. |
| 13 | + * |
| 14 | + * @license |
| 15 | + * Dual licensed under the MIT and GPL licenses. |
| 16 | + */ |
| 17 | +(function () { |
| 18 | + // CommonJS |
| 19 | + SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); |
| 20 | + |
| 21 | + function Brush() { |
| 22 | + var keywords = |
| 23 | + 'bool break byte case chan complex128 complex64 const continue default defer else ' + |
| 24 | + 'fallthrough float32 float64 for func go goto if import int int16 int32 int64 int8 ' + |
| 25 | + 'interface map package range return rune select string struct switch type uint ' + |
| 26 | + 'uint16 uint32 uint64 uint8 uintptr var'; |
| 27 | + var funcs = |
| 28 | + 'append cap close complex copy imag len make new panic print println real recover delete'; |
| 29 | + var special = 'true false iota nil'; |
| 30 | + |
| 31 | + this.regexList = [ |
| 32 | + { |
| 33 | + regex: SyntaxHighlighter.regexLib.singleLineCComments, |
| 34 | + css: 'comments', |
| 35 | + }, // one line comments |
| 36 | + { regex: /\/\*([^\*][\s\S]*?)?\*\//gm, css: 'comments' }, // multiline comments |
| 37 | + { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments |
| 38 | + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings |
| 39 | + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings |
| 40 | + { regex: XRegExp('`([^\\\\`]|\\\\.)*`', 'gs'), css: 'string' }, // strings |
| 41 | + { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers |
| 42 | + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords |
| 43 | + { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // built-in functions |
| 44 | + { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' }, // literals |
| 45 | + ]; |
| 46 | + |
| 47 | + this.forHtmlScript({ |
| 48 | + left: /(<|<)%[@!=]?/g, |
| 49 | + right: /%(>|>)/g, |
| 50 | + }); |
| 51 | + } |
| 52 | + |
| 53 | + Brush.prototype = new SyntaxHighlighter.Highlighter(); |
| 54 | + Brush.aliases = ['go', 'golang']; |
| 55 | + |
| 56 | + SyntaxHighlighter.brushes.Go = Brush; |
| 57 | + |
| 58 | + // CommonJS |
| 59 | + typeof exports != 'undefined' ? (exports.Brush = Brush) : null; |
| 60 | +})(); |
0 commit comments