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