1/** 2 * SyntaxHighlighter 3 * http://alexgorbatchev.com/ 4 * 5 * SyntaxHighlighter is donationware. If you are using it, please donate. 6 * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 * 8 * @version 9 * 2.1.364 (October 15 2009) 10 * 11 * @copyright 12 * Copyright (C) 2004-2009 Alex Gorbatchev. 13 * 14 * @license 15 * This file is part of SyntaxHighlighter. 16 * 17 * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 * it under the terms of the GNU Lesser General Public License as published by 19 * the Free Software Foundation, either version 3 of the License, or 20 * (at your option) any later version. 21 * 22 * SyntaxHighlighter is distributed in the hope that it will be useful, 23 * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 * GNU General Public License for more details. 26 * 27 * You should have received a copy of the GNU General Public License 28 * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>. 29 */ 30SyntaxHighlighter.brushes.Groovy = function() 31{ 32 // Contributed by Andres Almiray 33 // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter 34 35 var keywords = 'as assert break case catch class continue def default do else extends finally ' + 36 'if in implements import instanceof interface new package property return switch ' + 37 'throw throws try while public protected private static'; 38 var types = 'void boolean byte char short int long float double'; 39 var constants = 'null'; 40 var methods = 'allProperties count get size '+ 41 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' + 42 'findIndexOf grep inject max min reverseEach sort ' + 43 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' + 44 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' + 45 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' + 46 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' + 47 'transformChar transformLine withOutputStream withPrintWriter withStream ' + 48 'withStreams withWriter withWriterAppend write writeLine '+ 49 'dump inspect invokeMethod print println step times upto use waitForOrKill '+ 50 'getText'; 51 52 this.regexList = [ 53 { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 54 { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 55 { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 56 { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 57 { regex: /""".*"""/g, css: 'string' }, // GStrings 58 { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers 59 { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword 60 { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type 61 { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants 62 { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods 63 ]; 64 65 this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 66} 67 68SyntaxHighlighter.brushes.Groovy.prototype = new SyntaxHighlighter.Highlighter(); 69SyntaxHighlighter.brushes.Groovy.aliases = ['groovy'];
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.