-
Notifications
You must be signed in to change notification settings - Fork 6
/
brush.js
41 lines (37 loc) · 1.15 KB
/
brush.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var BrushBase = require('brush-base');
var regexLib = require('syntaxhighlighter-regex').commonRegExp;
function Brush() {
var keywords = 'break case catch class continue ' +
'default delete do else enum export extends false ' +
'for function if implements import in instanceof ' +
'interface let new null package private protected ' +
'static return super switch ' +
'this throw true try typeof var while with yield' +
' any bool declare get module never number public readonly set string'; // TypeScript-specific, everything above is common with JavaScript
this.regexList = [
{
regex: regexLib.multiLineDoubleQuotedString,
css: 'string'
},
{
regex: regexLib.multiLineSingleQuotedString,
css: 'string'
},
{
regex: regexLib.singleLineCComments,
css: 'comments'
},
{
regex: regexLib.multiLineCComments,
css: 'comments'
},
{
regex: new RegExp(this.getKeywords(keywords), 'gm'),
css: 'keyword'
}
];
this.forHtmlScript(regexLib.scriptScriptTags);
};
Brush.prototype = new BrushBase();
Brush.aliases = ['ts', 'typescript'];
module.exports = Brush;