Blame view

bower_components/prism/components/prism-javascript.js 1.47 KB
73bcce88   luigser   COMPONENTS
1
2
3
  Prism.languages.javascript = Prism.languages.extend('clike', {
  	'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,
  	'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
eb240478   Luigi Serra   public room cards...
4
5
  	// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
  	'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i
73bcce88   luigser   COMPONENTS
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
  });
  
  Prism.languages.insertBefore('javascript', 'keyword', {
  	'regex': {
  		pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
  		lookbehind: true
  	}
  });
  
  Prism.languages.insertBefore('javascript', 'class-name', {
  	'template-string': {
  		pattern: /`(?:\\`|\\?[^`])*`/,
  		inside: {
  			'interpolation': {
  				pattern: /\$\{[^}]+\}/,
  				inside: {
  					'interpolation-punctuation': {
  						pattern: /^\$\{|\}$/,
  						alias: 'punctuation'
  					},
  					rest: Prism.languages.javascript
  				}
  			},
  			'string': /[\s\S]+/
  		}
  	}
  });
  
  if (Prism.languages.markup) {
  	Prism.languages.insertBefore('markup', 'tag', {
  		'script': {
eb240478   Luigi Serra   public room cards...
37
38
39
  			pattern: /(<script[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,
  			lookbehind: true,
  			inside: Prism.languages.javascript,
73bcce88   luigser   COMPONENTS
40
41
42
43
  			alias: 'language-javascript'
  		}
  	});
  }
eb240478   Luigi Serra   public room cards...
44
45
  
  Prism.languages.js = Prism.languages.javascript;