Blame view

bower_components/prism/components/prism-batch.js 2.37 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
  (function (Prism) {
  	var variable = /%%?[~:\w]+%?|!\S+!/;
  	var parameter = {
  		pattern: /\/[a-z?]+(?=[ :]|$):?|-[a-z]\b|--[a-z-]+\b/im,
  		alias: 'attr-name',
  		inside: {
  			'punctuation': /:/
  		}
  	};
  	var string = /"[^"]*"/;
  	var number = /(?:\b|-)\d+\b/;
  
  	Prism.languages.batch = {
  		'comment': [
  			/^::.*/m,
  			{
  				pattern: /((?:^|[&(])[ \t]*)rem\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
  				lookbehind: true
  			}
  		],
  		'label': {
  			pattern: /^:.*/m,
  			alias: 'property'
  		},
  		'command': [
  			{
  				// FOR command
  				pattern: /((?:^|[&(])[ \t]*)for(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* \S+ in \([^)]+\) do/im,
  				lookbehind: true,
  				inside: {
  					'keyword': /^for\b|\b(?:in|do)\b/i,
  					'string': string,
  					'parameter': parameter,
  					'variable': variable,
  					'number': number,
  					'punctuation': /[()',]/
  				}
  			},
  			{
  				// IF command
  				pattern: /((?:^|[&(])[ \t]*)if(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* (?:not )?(?:cmdextversion \d+|defined \w+|errorlevel \d+|exist \S+|(?:"[^"]*"|\S+)?(?:==| (?:equ|neq|lss|leq|gtr|geq) )(?:"[^"]*"|\S+))/im,
  				lookbehind: true,
  				inside: {
  					'keyword': /^if\b|\b(?:not|cmdextversion|defined|errorlevel|exist)\b/i,
  					'string': string,
  					'parameter': parameter,
  					'variable': variable,
  					'number': number,
  					'operator': /\^|==|\b(?:equ|neq|lss|leq|gtr|geq)\b/i
  				}
  			},
  			{
  				// ELSE command
  				pattern: /((?:^|[&()])[ \t]*)else\b/im,
  				lookbehind: true,
  				inside: {
  					'keyword': /^else\b/i
  				}
  			},
  			{
  				// SET command
  				pattern: /((?:^|[&(])[ \t]*)set(?: ?\/[a-z](?:[ :](?:"[^"]*"|\S+))?)* (?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
  				lookbehind: true,
  				inside: {
  					'keyword': /^set\b/i,
  					'string': string,
  					'parameter': parameter,
  					'variable': [
  						variable,
  						/\w+(?=(?:[*\/%+\-&^|]|<<|>>)?=)/
  					],
  					'number': number,
  					'operator': /[*\/%+\-&^|]=?|<<=?|>>=?|[!~_=]/,
  					'punctuation': /[()',]/
  				}
  			},
  			{
  				// Other commands
  				pattern: /((?:^|[&(])[ \t]*@?)\w+\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
  				lookbehind: true,
  				inside: {
  					'keyword': /^\w+\b/i,
  					'string': string,
  					'parameter': parameter,
  					'label': {
  						pattern: /(^\s*):\S+/m,
  						lookbehind: true,
  						alias: 'property'
  					},
  					'variable': variable,
  					'number': number,
  					'operator': /\^/
  				}
  			}
  		],
  		'operator': /[&@]/,
  		'punctuation': /[()']/
  	};
  }(Prism));