shBrushJScript.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ;(function()
  2. {
  3. // CommonJS
  4. SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
  5. function Brush()
  6. {
  7. var keywords = 'break case catch class continue ' +
  8. 'default delete do else enum export extends false ' +
  9. 'for function if implements import in instanceof ' +
  10. 'interface let new null package private protected ' +
  11. 'static return super switch ' +
  12. 'this throw true try typeof var while with yield';
  13. var r = SyntaxHighlighter.regexLib;
  14. this.regexList = [
  15. { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
  16. { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
  17. { regex: r.singleLineCComments, css: 'comments' }, // one line comments
  18. { regex: r.multiLineCComments, css: 'comments' }, // multiline comments
  19. { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
  20. { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
  21. ];
  22. this.forHtmlScript(r.scriptScriptTags);
  23. };
  24. Brush.prototype = new SyntaxHighlighter.Highlighter();
  25. Brush.aliases = ['js', 'jscript', 'javascript'];
  26. SyntaxHighlighter.brushes.JScript = Brush;
  27. // CommonJS
  28. typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
  29. })();