shBrushR.js 1.0 KB

123456789101112131415161718192021
  1. /**
  2. * Author: Yihui Xie <xie@yihui.name>
  3. * URL: http://yihui.name/en/2010/09/syntaxhighlighter-brush-for-the-r-language
  4. * License: GPL-2 | GPL-3
  5. */
  6. SyntaxHighlighter.brushes.R = function()
  7. {
  8. var keywords = 'if else repeat while function for in next break TRUE FALSE NULL Inf NaN NA NA_integer_ NA_real_ NA_complex_ NA_character_';
  9. var constants = 'LETTERS letters month.abb month.name pi';
  10. this.regexList = [
  11. { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' },
  12. { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
  13. { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
  14. { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' },
  15. { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' },
  16. { regex: /[\w._]+[ \t]*(?=\()/gm, css: 'functions' },
  17. ];
  18. };
  19. SyntaxHighlighter.brushes.R.prototype = new SyntaxHighlighter.Highlighter();
  20. SyntaxHighlighter.brushes.R.aliases = ['r', 's', 'splus'];