shBrushScala.js 1.8 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. // Contributed by Yegor Jbanov and David Bernard.
  24. var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' +
  25. 'override try lazy for var catch throw type extends class while with new final yield abstract ' +
  26. 'else do if return protected private this package false';
  27. var keyops = '[_:=><%#@]+';
  28. this.regexList = [
  29. { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
  30. { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
  31. { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings
  32. { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string
  33. { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
  34. { regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers
  35. { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
  36. { regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword
  37. ];
  38. }
  39. Brush.prototype = new SyntaxHighlighter.Highlighter();
  40. Brush.aliases = ['scala'];
  41. SyntaxHighlighter.brushes.Scala = Brush;
  42. // CommonJS
  43. typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
  44. })();