1;(function() 2{ 3 // CommonJS 4 SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); 5 6 function Brush() 7 { 8 // Contributed by Andres Almiray 9 // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter 10 11 var keywords = 'as assert break case catch class continue def default do else extends finally ' + 12 'if in implements import instanceof interface new package property return switch ' + 13 'throw throws try while public protected private static'; 14 var types = 'void boolean byte char short int long float double'; 15 var constants = 'null'; 16 var methods = 'allProperties count get size '+ 17 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' + 18 'findIndexOf grep inject max min reverseEach sort ' + 19 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' + 20 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' + 21 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' + 22 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' + 23 'transformChar transformLine withOutputStream withPrintWriter withStream ' + 24 'withStreams withWriter withWriterAppend write writeLine '+ 25 'dump inspect invokeMethod print println step times upto use waitForOrKill '+ 26 'getText'; 27 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.doubleQuotedString, css: 'string' }, // strings 32 { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 33 { regex: /""".*"""/g, css: 'string' }, // GStrings 34 { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers 35 { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword 36 { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type 37 { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants 38 { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods 39 ]; 40 41 this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 42 } 43 44 Brush.prototype = new SyntaxHighlighter.Highlighter(); 45 Brush.aliases = ['groovy']; 46 47 SyntaxHighlighter.brushes.Groovy = Brush; 48 49 // CommonJS 50 typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 51})(); 52