1// Brush for the TypeScript language 2// Based on the JavaScript brush - shBrushJScript.js - with some minor alterations 3 4; (function () 5{ 6 // CommonJS 7 SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); 8 9 function Brush() 10 { 11 var keywords = 'break case catch class continue ' + 12 'default delete do else enum export extends false ' + 13 'for function if implements import in instanceof ' + 14 'interface let new null package private protected ' + 15 'static return super switch ' + 16 'this throw true try typeof var while with yield' + 17 ' any bool declare get module number public set string'; // TypeScript-specific, everything above is common with JavaScript 18 19 var r = SyntaxHighlighter.regexLib; 20 21 this.regexList = [ 22 { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 23 { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 24 { regex: r.singleLineCComments, css: 'comments' }, // one line comments 25 { regex: r.multiLineCComments, css: 'comments' }, // multiline comments 26 { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords 27 ]; 28 29 this.forHtmlScript(r.scriptScriptTags); 30 }; 31 32 Brush.prototype = new SyntaxHighlighter.Highlighter(); 33 Brush.aliases = ['ts', 'typescript']; 34 35 SyntaxHighlighter.brushes.TypeScript = Brush; 36 37 // CommonJS 38 typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 39})(); 40