shBrushJScript.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 (July 02 2010)
  10. *
  11. * @copyright
  12. * Copyright (C) 2004-2010 Alex Gorbatchev.
  13. *
  14. * @license
  15. * Dual licensed under the MIT and GPL licenses.
  16. */
  17. ;(function()
  18. {
  19. // CommonJS
  20. typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
  21. function Brush()
  22. {
  23. var keywords = 'break case catch continue ' +
  24. 'default delete do else false ' +
  25. 'for function if in instanceof ' +
  26. 'new null return super switch ' +
  27. 'this throw true try typeof var while with'
  28. ;
  29. var r = SyntaxHighlighter.regexLib;
  30. this.regexList = [
  31. { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
  32. { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
  33. { regex: r.singleLineCComments, css: 'comments' }, // one line comments
  34. { regex: r.multiLineCComments, css: 'comments' }, // multiline comments
  35. { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
  36. { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
  37. ];
  38. this.forHtmlScript(r.scriptScriptTags);
  39. };
  40. Brush.prototype = new SyntaxHighlighter.Highlighter();
  41. Brush.aliases = ['js', 'jscript', 'javascript'];
  42. SyntaxHighlighter.brushes.JScript = Brush;
  43. // CommonJS
  44. typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
  45. })();