PageRenderTime 39ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/Scripts/syntaxhighlighter/shBrushGroovy.js

#
JavaScript | 67 lines | 40 code | 7 blank | 20 comment | 5 complexity | 9c6ede0ba21cb804301e156e2b4fd03c MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  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 Andres Almiray
  24. // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter
  25. var keywords = 'as assert break case catch class continue def default do else extends finally ' +
  26. 'if in implements import instanceof interface new package property return switch ' +
  27. 'throw throws try while public protected private static';
  28. var types = 'void boolean byte char short int long float double';
  29. var constants = 'null';
  30. var methods = 'allProperties count get size '+
  31. 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' +
  32. 'findIndexOf grep inject max min reverseEach sort ' +
  33. 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' +
  34. 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' +
  35. 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' +
  36. 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' +
  37. 'transformChar transformLine withOutputStream withPrintWriter withStream ' +
  38. 'withStreams withWriter withWriterAppend write writeLine '+
  39. 'dump inspect invokeMethod print println step times upto use waitForOrKill '+
  40. 'getText';
  41. this.regexList = [
  42. { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
  43. { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
  44. { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
  45. { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
  46. { regex: /""".*"""/g, css: 'string' }, // GStrings
  47. { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers
  48. { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword
  49. { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type
  50. { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants
  51. { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods
  52. ];
  53. this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
  54. }
  55. Brush.prototype = new SyntaxHighlighter.Highlighter();
  56. Brush.aliases = ['groovy'];
  57. SyntaxHighlighter.brushes.Groovy = Brush;
  58. // CommonJS
  59. typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
  60. })();