Debian Codegraph @

src/site/resources/scripts/shBrushGroovy.js

raw
1 dp.sh.Brushes.Groovy = function()
2 {
3 var keywords = 'as assert break case catch class continue def default do else extends finally ' +
4 'if in implements import instanceof interface new package property return switch ' +
5 'throw throws try while';
6 var types = 'void boolean byte char short int long float double';
7 var modifiers = 'public protected private static';
8 var constants = 'null';
9 var methods = 'allProperties count get size '+
10 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' +
11 'findIndexOf grep inject max min reverseEach sort ' +
12 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' +
13 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' +
14 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' +
15 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' +
16 'transformChar transformLine withOutputStream withPrintWriter withStream ' +
17 'withStreams withWriter withWriterAppend write writeLine '+
18 'dump inspect invokeMethod print println step times upto use waitForOrKill '+
19 'getText';
20
21 this.regexList = [
22 { regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line comments
23 { regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments
24 { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // strings
25 { regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // strings
26 { regex: new RegExp('""".*"""','g'), css: 'string' }, // GStrings
27 { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'number' }, // numbers
28 { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword
29 { regex: new RegExp(this.GetKeywords(types), 'gm'), css: 'type' }, // goovy/java type
30 { regex: new RegExp(this.GetKeywords(modifiers), 'gm'), css: 'modifier' }, // java modifier
31 { regex: new RegExp(this.GetKeywords(constants), 'gm'), css: 'constant' }, // constants
32 { regex: new RegExp(this.GetKeywords(methods), 'gm'), css: 'method' } // methods
33 ];
34
35 this.CssClass = 'dp-g';
36 }
37
38 dp.sh.Brushes.Groovy.prototype = new dp.sh.Highlighter();
39 dp.sh.Brushes.Groovy.Aliases = ['groovy'];