Additional keywords, regexp, etc.

This commit is contained in:
Erik C. Thauvin 2016-07-23 15:35:49 -07:00
parent 4d72d24e77
commit af67f93887

View file

@ -1,9 +1,9 @@
/** /**
* SyntaxHighlighter Syntax for Kotlin * SyntaxHighlighter Syntax for Kotlin
* https://github.com/ethauvin/shBrushKotlin * https://github.com/ethauvin/bursh-kotlin
* *
* @version * @version
* 0.1.0 (July 22, 2016) * 0.2.0 (July 23, 2016)
* *
* @copyright * @copyright
* Copyright (C) 2016 Erik C. Thauvin. http://erik.thauvin.net/ * Copyright (C) 2016 Erik C. Thauvin. http://erik.thauvin.net/
@ -21,20 +21,21 @@
{ {
var keywords = 'abstract annotation as break by catch class companion const constructor continue' + 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' + ' crossinline data do dynamic else enum external false final finally for fun get if' +
' import in infix inline inner interface internal is lateinit noinline null object' + ' import in infix init inline inner interface internal is lateinit noinline null object' +
' open operator out override package private protected public reified return sealed' + ' 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' + ' set super tailrec this throw trait true try type val var vararg when where while' +
' String Array Unit Int'; ' String Array Unit Int Boolean';
this.regexList = [ this.regexList = [
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
{ regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multi-line comments
{ regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
{ regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
{ regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno { regex: /\@(Target|Retention|Repeatable|MustBeDocumented|Test|Deprecated)/g, css: 'color2' }, // annotations
{ regex: /\@interface\b/g, css: 'color2' }, // @interface keyword { regex: /\@(file|property|field|get|set|receiver|param|setparam|delegate):/g, css: 'color2' }, // User-site Targets
{ regex: /\@(Inject)\b/g, css: 'color3' }, // @Inject annotation
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword
]; ];