comparison 2015_05_25/highlighter/shBrushGroovy.js @ 0:47676a16ed13

Add Slides
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Tue, 14 Jul 2015 17:23:04 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:47676a16ed13
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
22 function Brush()
23 {
24 // Contributed by Andres Almiray
25 // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter
26
27 var keywords = 'as assert break case catch class continue def default do else extends finally ' +
28 'if in implements import instanceof interface new package property return switch ' +
29 'throw throws try while public protected private static';
30 var types = 'void boolean byte char short int long float double';
31 var constants = 'null';
32 var methods = 'allProperties count get size '+
33 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' +
34 'findIndexOf grep inject max min reverseEach sort ' +
35 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' +
36 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' +
37 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' +
38 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' +
39 'transformChar transformLine withOutputStream withPrintWriter withStream ' +
40 'withStreams withWriter withWriterAppend write writeLine '+
41 'dump inspect invokeMethod print println step times upto use waitForOrKill '+
42 'getText';
43
44 this.regexList = [
45 { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
46 { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
47 { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
48 { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
49 { regex: /""".*"""/g, css: 'string' }, // GStrings
50 { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers
51 { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword
52 { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type
53 { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants
54 { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods
55 ];
56
57 this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
58 }
59
60 Brush.prototype = new SyntaxHighlighter.Highlighter();
61 Brush.aliases = ['groovy'];
62
63 SyntaxHighlighter.brushes.Groovy = Brush;
64
65 // CommonJS
66 typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
67 })();