Initial import of 4.x module.
This commit is contained in:
parent
af67f93887
commit
b4d2df93d3
8 changed files with 193 additions and 0 deletions
70
brush.js
Normal file
70
brush.js
Normal file
|
@ -0,0 +1,70 @@
|
|||
var BrushBase = require('brush-base');
|
||||
var regexLib = require('syntaxhighlighter-regex').commonRegExp;
|
||||
|
||||
function Brush() {
|
||||
var keywords = 'abstract annotation as break by catch class companion const constructor continue' +
|
||||
' crossinline data do dynamic else enum external false final finally for fun get if' +
|
||||
' import in infix init inline inner interface internal is lateinit noinline null object' +
|
||||
' open operator out override package private protected public reified return sealed' +
|
||||
' set super tailrec this throw trait true try type val var vararg when where while' +
|
||||
' String Array Unit Int';
|
||||
|
||||
this.regexList = [
|
||||
{
|
||||
// line comment
|
||||
regex: regexLib.singleLineCComments,
|
||||
css: 'comments'
|
||||
},
|
||||
{
|
||||
// block comment
|
||||
regex: /\/\*([^\*][\s\S]*?)?\*\//gm,
|
||||
css: 'comments'
|
||||
},
|
||||
{
|
||||
// javadoc
|
||||
regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm,
|
||||
css: 'preprocessor'
|
||||
},
|
||||
{
|
||||
regex: regexLib.doubleQuotedString,
|
||||
css: 'string'
|
||||
},
|
||||
{
|
||||
regex: regexLib.singleQuotedString,
|
||||
css: 'string'
|
||||
},
|
||||
{
|
||||
// numbers
|
||||
regex: /\b([\d]+(\.[\d]+)?f?|[\d]+l?|0x[a-f0-9]+)\b/gi,
|
||||
css: 'value'
|
||||
},
|
||||
{
|
||||
// annotations
|
||||
regex: /\@(Target|Retention|Repeatable|MustBeDocumented|Test|Deprecated)/g,
|
||||
css: 'color2'
|
||||
},
|
||||
{
|
||||
// User-site targets
|
||||
regex: /\@(file|property|field|get|set|receiver|param|setparam|delegate):/g,
|
||||
css: 'color2'
|
||||
},
|
||||
{
|
||||
// @Inject annotation
|
||||
regex: /\@(Inject)\b/g,
|
||||
css: 'color3'
|
||||
},
|
||||
{
|
||||
regex: new RegExp(this.getKeywords(keywords), 'gm'),
|
||||
css: 'keyword'
|
||||
}
|
||||
];
|
||||
|
||||
this.forHtmlScript({
|
||||
left: /(<|<)%[@!=]?/g,
|
||||
right: /%(>|>)/g
|
||||
});
|
||||
};
|
||||
|
||||
Brush.prototype = new BrushBase();
|
||||
Brush.aliases = ['kotlin'];
|
||||
module.exports = Brush;
|
Loading…
Add table
Add a link
Reference in a new issue