Blame view

bower_components/prism/components/prism-kotlin.js 1.81 KB
f748e9cf   Luigi Serra   new controllet an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
  (function (Prism) {
  	Prism.languages.kotlin = Prism.languages.extend('clike', {
  		'keyword': {
  			// The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get
  			pattern: /(^|[^.])\b(?:abstract|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|else|enum|final|finally|for|fun|get|if|import|in|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|out|override|package|private|protected|public|reified|return|sealed|set|super|tailrec|this|throw|to|try|val|var|when|where|while)\b/,
  			lookbehind: true
  		},
  		'function': [
  			/\w+(?=\s*\()/,
  			{
  				pattern: /(\.)\w+(?=\s*\{)/,
  				lookbehind: true
  			}
  		],
  		'number': /\b(?:0[bx][\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?[fFL]?)\b/,
  		'operator': /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/
  	});
  
  	delete Prism.languages.kotlin["class-name"];
  
  	Prism.languages.insertBefore('kotlin', 'string', {
  		'raw-string': {
  			pattern: /(["'])\1\1[\s\S]*?\1{3}/,
  			alias: 'string'
  			// See interpolation below
  		}
  	});
  	Prism.languages.insertBefore('kotlin', 'keyword', {
  		'annotation': {
  			pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,
  			alias: 'builtin'
  		}
  	});
  	Prism.languages.insertBefore('kotlin', 'function', {
  		'label': {
  			pattern: /\w+@|@\w+/,
  			alias: 'symbol'
  		}
  	});
  
  	var interpolation = [
  		{
  			pattern: /\$\{[^}]+\}/,
  			inside: {
  				delimiter: {
  					pattern: /^\$\{|\}$/,
  					alias: 'variable'
  				},
  				rest: Prism.util.clone(Prism.languages.kotlin)
  			}
  		},
  		{
  			pattern: /\$\w+/,
  			alias: 'variable'
  		}
  	];
  
  	Prism.languages.kotlin['string'] = {
  		pattern: Prism.languages.kotlin['string'],
  		inside: {
  			interpolation: interpolation
  		}
  	};
  	Prism.languages.kotlin['raw-string'].inside = {
  		interpolation: interpolation
  	};
  
  }(Prism));