Blame view

bower_components/prism/components/prism-crystal.js 1.25 KB
eb240478   Luigi Serra   public room cards...
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
  (function(Prism) {
  	Prism.languages.crystal = Prism.languages.extend('ruby', {
  		keyword: [
  			/\b(?:abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|ifdef|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|self|sizeof|struct|super|then|type|typeof|union|unless|until|when|while|with|yield|__DIR__|__FILE__|__LINE__)\b/,
  			{
  				pattern: /(\.\s*)(?:is_a|responds_to)\?/,
  				lookbehind: true
  			}
  		],
  
  		number: /\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[0-9a-fA-F_]*[0-9a-fA-F]|(?:[0-9](?:[0-9_]*[0-9])?)(?:\.[0-9_]*[0-9])?(?:[eE][+-]?[0-9_]*[0-9])?)(?:_(?:[uif](?:8|16|32|64))?)?\b/,
  	});
  
  	var rest = Prism.util.clone(Prism.languages.crystal);
  
  	Prism.languages.insertBefore('crystal', 'string', {
  		attribute: {
  			pattern: /@\[.+?\]/,
  			alias: 'attr-name',
  			inside: {
  				delimiter: {
  					pattern: /^@\[|\]$/,
  					alias: 'tag'
  				},
  				rest: rest
  			}
  		},
  
  		expansion: [
  		{
  			pattern: /\{\{.+?\}\}/,
  			inside: {
  				delimiter: {
  					pattern: /^\{\{|\}\}$/,
  					alias: 'tag'
  				},
  				rest: rest
  			}
  		},
  		{
  			pattern: /\{%.+?%\}/,
  			inside: {
  				delimiter: {
  					pattern: /^\{%|%\}$/,
  					alias: 'tag'
  				},
  				rest: rest
  			}
  		}
  		]
  	});
  
  }(Prism));