History

Update prism.js to use spaces instead of tabs like it is now

Jasper van Merle committed 7 years ago

Commit f2a38db1 parent 0574de61 file · +2568 −2568Browse files

Showing the changes to assets/javascripts (1 of 1 file). Show all

Unified · Split

assets/javascripts/vendor/prism.js+2568−2568
@@ -1,12 +1,12 @@
1/* PrismJS 1.17.11/* PrismJS 1.17.1
2https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+c+bash+cpp+coffeescript+ruby+d+dart+markup-templating+elixir+erlang+go+groovy+java+php+json+julia+kotlin+crystal+lua+django+matlab+typescript+nginx+nim+perl+sql+scss+python+jsx+rust+yaml */2https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+c+bash+cpp+coffeescript+ruby+d+dart+markup-templating+elixir+erlang+go+groovy+java+php+json+julia+kotlin+crystal+lua+django+matlab+typescript+nginx+nim+perl+sql+scss+python+jsx+rust+yaml */
3var _self = (typeof window !== 'undefined')3var _self = (typeof window !== 'undefined')
4 ? window // if in browser4 ? window // if in browser
5 : (5 : (
6 (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)6 (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
7 ? self // if in worker7 ? self // if in worker
8 : {} // if in node js8 : {} // if in node js
9 );9 );
10 10
11/**11/**
12 * Prism: Lightweight, robust, elegant syntax highlighting12 * Prism: Lightweight, robust, elegant syntax highlighting
@@ -17,635 +17,635 @@ var _self = (typeof window !== 'undefined') · 4 unmodified lines
17var Prism = (function (_self){17var Prism = (function (_self){
18 18
19// Private helper vars19// Private helper vars
20var lang = /\blang(?:uage)?-([\w-]+)\b/i;20 var lang = /\blang(?:uage)?-([\w-]+)\b/i;
21var uniqueId = 0;21 var uniqueId = 0;
22 22
23var _ = {23 var _ = {
24 manual: _self.Prism && _self.Prism.manual,24 manual: _self.Prism && _self.Prism.manual,
25 disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,25 disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
26 util: {26 util: {
27 encode: function (tokens) {27 encode: function (tokens) {
28 if (tokens instanceof Token) {28 if (tokens instanceof Token) {
29 return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);29 return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
30 } else if (Array.isArray(tokens)) {30 } else if (Array.isArray(tokens)) {
31 return tokens.map(_.util.encode);31 return tokens.map(_.util.encode);
32 } else {32 } else {
33 return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');33 return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
34 }34 }
35 },35 },
36 36
37 type: function (o) {37 type: function (o) {
38 return Object.prototype.toString.call(o).slice(8, -1);38 return Object.prototype.toString.call(o).slice(8, -1);
39 },39 },
40 40
41 objId: function (obj) {41 objId: function (obj) {
42 if (!obj['__id']) {42 if (!obj['__id']) {
43 Object.defineProperty(obj, '__id', { value: ++uniqueId });43 Object.defineProperty(obj, '__id', { value: ++uniqueId });
44 }44 }
45 return obj['__id'];45 return obj['__id'];
46 },46 },
47 47
48 // Deep clone a language definition (e.g. to extend it)48 // Deep clone a language definition (e.g. to extend it)
49 clone: function deepClone(o, visited) {49 clone: function deepClone(o, visited) {
50 var clone, id, type = _.util.type(o);50 var clone, id, type = _.util.type(o);
51 visited = visited || {};51 visited = visited || {};
52 52
53 switch (type) {53 switch (type) {
54 case 'Object':54 case 'Object':
55 id = _.util.objId(o);55 id = _.util.objId(o);
56 if (visited[id]) {56 if (visited[id]) {
57 return visited[id];57 return visited[id];
58 }58 }
59 clone = {};59 clone = {};
60 visited[id] = clone;60 visited[id] = clone;
61 61
62 for (var key in o) {62 for (var key in o) {
63 if (o.hasOwnProperty(key)) {63 if (o.hasOwnProperty(key)) {
64 clone[key] = deepClone(o[key], visited);64 clone[key] = deepClone(o[key], visited);
65 }65 }
66 }66 }
67 67
68 return clone;68 return clone;
69 69
70 case 'Array':70 case 'Array':
71 id = _.util.objId(o);71 id = _.util.objId(o);
72 if (visited[id]) {72 if (visited[id]) {
73 return visited[id];73 return visited[id];
74 }74 }
75 clone = [];75 clone = [];
76 visited[id] = clone;76 visited[id] = clone;
77 77
78 o.forEach(function (v, i) {78 o.forEach(function (v, i) {
79 clone[i] = deepClone(v, visited);79 clone[i] = deepClone(v, visited);
80 });80 });
81 81
82 return clone;82 return clone;
83 83
84 default:84 default:
85 return o;85 return o;
86 }86 }
87 }87 }
88 },88 },
89 89
90 languages: {90 languages: {
91 extend: function (id, redef) {91 extend: function (id, redef) {
92 var lang = _.util.clone(_.languages[id]);92 var lang = _.util.clone(_.languages[id]);
93 93
94 for (var key in redef) {94 for (var key in redef) {
95 lang[key] = redef[key];95 lang[key] = redef[key];
96 }96 }
97 97
98 return lang;98 return lang;
99 },99 },
100 100
101 /**101 /**
102 * Insert a token before another token in a language literal102 * Insert a token before another token in a language literal
103 * As this needs to recreate the object (we cannot actually insert before keys in object literals),103 * As this needs to recreate the object (we cannot actually insert before keys in object literals),
104 * we cannot just provide an object, we need an object and a key.104 * we cannot just provide an object, we need an object and a key.
105 * @param inside The key (or language id) of the parent105 * @param inside The key (or language id) of the parent
106 * @param before The key to insert before.106 * @param before The key to insert before.
107 * @param insert Object with the key/value pairs to insert107 * @param insert Object with the key/value pairs to insert
108 * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.108 * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
109 */109 */
110 insertBefore: function (inside, before, insert, root) {110 insertBefore: function (inside, before, insert, root) {
111 root = root || _.languages;111 root = root || _.languages;
112 var grammar = root[inside];112 var grammar = root[inside];
113 var ret = {};113 var ret = {};
114 114
115 for (var token in grammar) {115 for (var token in grammar) {
116 if (grammar.hasOwnProperty(token)) {116 if (grammar.hasOwnProperty(token)) {
117 117
118 if (token == before) {118 if (token == before) {
119 for (var newToken in insert) {119 for (var newToken in insert) {
120 if (insert.hasOwnProperty(newToken)) {120 if (insert.hasOwnProperty(newToken)) {
121 ret[newToken] = insert[newToken];121 ret[newToken] = insert[newToken];
122 }122 }
123 }123 }
124 }124 }
125 125
126 // Do not insert token which also occur in insert. See #1525126 // Do not insert token which also occur in insert. See #1525
127 if (!insert.hasOwnProperty(token)) {127 if (!insert.hasOwnProperty(token)) {
128 ret[token] = grammar[token];128 ret[token] = grammar[token];
129 }129 }
130 }130 }
131 }131 }
132 132
133 var old = root[inside];133 var old = root[inside];
134 root[inside] = ret;134 root[inside] = ret;
135 135
136 // Update references in other language definitions136 // Update references in other language definitions
137 _.languages.DFS(_.languages, function(key, value) {137 _.languages.DFS(_.languages, function(key, value) {
138 if (value === old && key != inside) {138 if (value === old && key != inside) {
139 this[key] = ret;139 this[key] = ret;
140 }140 }
141 });141 });
142 142
143 return ret;143 return ret;
144 },144 },
145 145
146 // Traverse a language definition with Depth First Search146 // Traverse a language definition with Depth First Search
147 DFS: function DFS(o, callback, type, visited) {147 DFS: function DFS(o, callback, type, visited) {
148 visited = visited || {};148 visited = visited || {};
149 149
150 var objId = _.util.objId;150 var objId = _.util.objId;
151 151
152 for (var i in o) {152 for (var i in o) {
153 if (o.hasOwnProperty(i)) {153 if (o.hasOwnProperty(i)) {
154 callback.call(o, i, o[i], type || i);154 callback.call(o, i, o[i], type || i);
155 155
156 var property = o[i],156 var property = o[i],
157 propertyType = _.util.type(property);157 propertyType = _.util.type(property);
158 158
159 if (propertyType === 'Object' && !visited[objId(property)]) {159 if (propertyType === 'Object' && !visited[objId(property)]) {
160 visited[objId(property)] = true;160 visited[objId(property)] = true;
161 DFS(property, callback, null, visited);161 DFS(property, callback, null, visited);
162 }162 }
163 else if (propertyType === 'Array' && !visited[objId(property)]) {163 else if (propertyType === 'Array' && !visited[objId(property)]) {
164 visited[objId(property)] = true;164 visited[objId(property)] = true;
165 DFS(property, callback, i, visited);165 DFS(property, callback, i, visited);
166 }166 }
167 }167 }
168 }168 }
169 }169 }
170 },170 },
171 plugins: {},171 plugins: {},
172 172
173 highlightAll: function(async, callback) {173 highlightAll: function(async, callback) {
174 _.highlightAllUnder(document, async, callback);174 _.highlightAllUnder(document, async, callback);
175 },175 },
176 176
177 highlightAllUnder: function(container, async, callback) {177 highlightAllUnder: function(container, async, callback) {
178 var env = {178 var env = {
179 callback: callback,179 callback: callback,
180 selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'180 selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
181 };181 };
182 182
183 _.hooks.run('before-highlightall', env);183 _.hooks.run('before-highlightall', env);
184 184
185 var elements = container.querySelectorAll(env.selector);185 var elements = container.querySelectorAll(env.selector);
186 186
187 for (var i=0, element; element = elements[i++];) {187 for (var i=0, element; element = elements[i++];) {
188 _.highlightElement(element, async === true, env.callback);188 _.highlightElement(element, async === true, env.callback);
189 }189 }
190 },190 },
191 191
192 highlightElement: function(element, async, callback) {192 highlightElement: function(element, async, callback) {
193 // Find language193 // Find language
194 var language = 'none', grammar, parent = element;194 var language = 'none', grammar, parent = element;
195 195
196 while (parent && !lang.test(parent.className)) {196 while (parent && !lang.test(parent.className)) {
197 parent = parent.parentNode;197 parent = parent.parentNode;
198 }198 }
199 199
200 if (parent) {200 if (parent) {
201 language = (parent.className.match(lang) || [,'none'])[1].toLowerCase();201 language = (parent.className.match(lang) || [,'none'])[1].toLowerCase();
202 grammar = _.languages[language];202 grammar = _.languages[language];
203 }203 }
204 204
205 // Set language on the element, if not present205 // Set language on the element, if not present
206 element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;206 element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
207 207
208 if (element.parentNode) {208 if (element.parentNode) {
209 // Set language on the parent, for styling209 // Set language on the parent, for styling
210 parent = element.parentNode;210 parent = element.parentNode;
211 211
212 if (/pre/i.test(parent.nodeName)) {212 if (/pre/i.test(parent.nodeName)) {
213 parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;213 parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
214 }214 }
215 }215 }
216 216
217 var code = element.textContent;217 var code = element.textContent;
218 218
219 var env = {219 var env = {
220 element: element,220 element: element,
221 language: language,221 language: language,
222 grammar: grammar,222 grammar: grammar,
223 code: code223 code: code
224 };224 };
225 225
226 var insertHighlightedCode = function (highlightedCode) {226 var insertHighlightedCode = function (highlightedCode) {
227 env.highlightedCode = highlightedCode;227 env.highlightedCode = highlightedCode;
228 228
229 _.hooks.run('before-insert', env);229 _.hooks.run('before-insert', env);
230 230
231 env.element.innerHTML = env.highlightedCode;231 env.element.innerHTML = env.highlightedCode;
232 232
233 _.hooks.run('after-highlight', env);233 _.hooks.run('after-highlight', env);
234 _.hooks.run('complete', env);234 _.hooks.run('complete', env);
235 callback && callback.call(env.element);235 callback && callback.call(env.element);
236 }236 }
237 237
238 _.hooks.run('before-sanity-check', env);238 _.hooks.run('before-sanity-check', env);
239 239
240 if (!env.code) {240 if (!env.code) {
241 _.hooks.run('complete', env);241 _.hooks.run('complete', env);
242 return;242 return;
243 }243 }
244 244
245 _.hooks.run('before-highlight', env);245 _.hooks.run('before-highlight', env);
246 246
247 if (!env.grammar) {247 if (!env.grammar) {
248 insertHighlightedCode(_.util.encode(env.code));248 insertHighlightedCode(_.util.encode(env.code));
249 return;249 return;
250 }250 }
251 251
252 if (async && _self.Worker) {252 if (async && _self.Worker) {
253 var worker = new Worker(_.filename);253 var worker = new Worker(_.filename);
254 254
255 worker.onmessage = function(evt) {255 worker.onmessage = function(evt) {
256 insertHighlightedCode(evt.data);256 insertHighlightedCode(evt.data);
257 };257 };
258 258
259 worker.postMessage(JSON.stringify({259 worker.postMessage(JSON.stringify({
260 language: env.language,260 language: env.language,
261 code: env.code,261 code: env.code,
262 immediateClose: true262 immediateClose: true
263 }));263 }));
264 }264 }
265 else {265 else {
266 insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));266 insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
267 }267 }
268 },268 },
269 269
270 highlight: function (text, grammar, language) {270 highlight: function (text, grammar, language) {
271 var env = {271 var env = {
272 code: text,272 code: text,
273 grammar: grammar,273 grammar: grammar,
274 language: language274 language: language
275 };275 };
276 _.hooks.run('before-tokenize', env);276 _.hooks.run('before-tokenize', env);
277 env.tokens = _.tokenize(env.code, env.grammar);277 env.tokens = _.tokenize(env.code, env.grammar);
278 _.hooks.run('after-tokenize', env);278 _.hooks.run('after-tokenize', env);
279 return Token.stringify(_.util.encode(env.tokens), env.language);279 return Token.stringify(_.util.encode(env.tokens), env.language);
280 },280 },
281 281
282 matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {282 matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {
283 for (var token in grammar) {283 for (var token in grammar) {
284 if(!grammar.hasOwnProperty(token) || !grammar[token]) {284 if(!grammar.hasOwnProperty(token) || !grammar[token]) {
285 continue;285 continue;
286 }286 }
287 287
288 if (token == target) {288 if (token == target) {
289 return;289 return;
290 }290 }
291 291
292 var patterns = grammar[token];292 var patterns = grammar[token];
293 patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];293 patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];
294 294
295 for (var j = 0; j < patterns.length; ++j) {295 for (var j = 0; j < patterns.length; ++j) {
296 var pattern = patterns[j],296 var pattern = patterns[j],
297 inside = pattern.inside,297 inside = pattern.inside,
298 lookbehind = !!pattern.lookbehind,298 lookbehind = !!pattern.lookbehind,
299 greedy = !!pattern.greedy,299 greedy = !!pattern.greedy,
300 lookbehindLength = 0,300 lookbehindLength = 0,
301 alias = pattern.alias;301 alias = pattern.alias;
302 302
303 if (greedy && !pattern.pattern.global) {303 if (greedy && !pattern.pattern.global) {
304 // Without the global flag, lastIndex won't work304 // Without the global flag, lastIndex won't work
305 var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];305 var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];
306 pattern.pattern = RegExp(pattern.pattern.source, flags + "g");306 pattern.pattern = RegExp(pattern.pattern.source, flags + "g");
307 }307 }
308 308
309 pattern = pattern.pattern || pattern;309 pattern = pattern.pattern || pattern;
310 310
311 // Don’t cache length as it changes during the loop311 // Don’t cache length as it changes during the loop
312 for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {312 for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {
313 313
314 var str = strarr[i];314 var str = strarr[i];
315 315
316 if (strarr.length > text.length) {316 if (strarr.length > text.length) {
317 // Something went terribly wrong, ABORT, ABORT!317 // Something went terribly wrong, ABORT, ABORT!
318 return;318 return;
319 }319 }
320 320
321 if (str instanceof Token) {321 if (str instanceof Token) {
322 continue;322 continue;
323 }323 }
324 324
325 if (greedy && i != strarr.length - 1) {325 if (greedy && i != strarr.length - 1) {
326 pattern.lastIndex = pos;326 pattern.lastIndex = pos;
327 var match = pattern.exec(text);327 var match = pattern.exec(text);
328 if (!match) {328 if (!match) {
329 break;329 break;
330 }330 }
331 331
332 var from = match.index + (lookbehind ? match[1].length : 0),332 var from = match.index + (lookbehind ? match[1].length : 0),
333 to = match.index + match[0].length,333 to = match.index + match[0].length,
334 k = i,334 k = i,
335 p = pos;335 p = pos;
336 336
337 for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) {337 for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) {
338 p += strarr[k].length;338 p += strarr[k].length;
339 // Move the index i to the element in strarr that is closest to from339 // Move the index i to the element in strarr that is closest to from
340 if (from >= p) {340 if (from >= p) {
341 ++i;341 ++i;
342 pos = p;342 pos = p;
343 }343 }
344 }344 }
345 345
346 // If strarr[i] is a Token, then the match starts inside another Token, which is invalid346 // If strarr[i] is a Token, then the match starts inside another Token, which is invalid
347 if (strarr[i] instanceof Token) {347 if (strarr[i] instanceof Token) {
348 continue;348 continue;
349 }349 }
350 350
351 // Number of tokens to delete and replace with the new match351 // Number of tokens to delete and replace with the new match
352 delNum = k - i;352 delNum = k - i;
353 str = text.slice(pos, p);353 str = text.slice(pos, p);
354 match.index -= pos;354 match.index -= pos;
355 } else {355 } else {
356 pattern.lastIndex = 0;356 pattern.lastIndex = 0;
357 357
358 var match = pattern.exec(str),358 var match = pattern.exec(str),
359 delNum = 1;359 delNum = 1;
360 }360 }
361 361
362 if (!match) {362 if (!match) {
363 if (oneshot) {363 if (oneshot) {
364 break;364 break;
365 }365 }
366 366
367 continue;367 continue;
368 }368 }
369 369
370 if(lookbehind) {370 if(lookbehind) {
371 lookbehindLength = match[1] ? match[1].length : 0;371 lookbehindLength = match[1] ? match[1].length : 0;
372 }372 }
373 373
374 var from = match.index + lookbehindLength,374 var from = match.index + lookbehindLength,
375 match = match[0].slice(lookbehindLength),375 match = match[0].slice(lookbehindLength),
376 to = from + match.length,376 to = from + match.length,
377 before = str.slice(0, from),377 before = str.slice(0, from),
378 after = str.slice(to);378 after = str.slice(to);
379 379
380 var args = [i, delNum];380 var args = [i, delNum];
381
382 if (before) {
383 ++i;
384 pos += before.length;
385 args.push(before);
386 }
387
388 var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy);
389
390 args.push(wrapped);
391
392 if (after) {
393 args.push(after);
394 }
395
396 Array.prototype.splice.apply(strarr, args);
397
398 if (delNum != 1)
399 _.matchGrammar(text, strarr, grammar, i, pos, true, token);
400
401 if (oneshot)
402 break;
403 }
404 }
405 }
406 },
407
408 tokenize: function(text, grammar) {
409 var strarr = [text];
410
411 var rest = grammar.rest;
412
413 if (rest) {
414 for (var token in rest) {
415 grammar[token] = rest[token];
416 }
417
418 delete grammar.rest;
419 }
420
421 _.matchGrammar(text, strarr, grammar, 0, 0, false);
422
423 return strarr;
424 },
425
426 hooks: {
427 all: {},
428
429 add: function (name, callback) {
430 var hooks = _.hooks.all;
431
432 hooks[name] = hooks[name] || [];
433
434 hooks[name].push(callback);
435 },
436
437 run: function (name, env) {
438 var callbacks = _.hooks.all[name];
439
440 if (!callbacks || !callbacks.length) {
441 return;
442 }
381 443
382 if (before) {444 for (var i=0, callback; callback = callbacks[i++];) {
383 ++i;445 callback(env);
384 pos += before.length;446 }
385 args.push(before);447 }
386 }448 },
387 449
388 var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy);450 Token: Token
451 };
389 452
390 args.push(wrapped);453 _self.Prism = _;
391 454
392 if (after) {455 function Token(type, content, alias, matchedStr, greedy) {
393 args.push(after);456 this.type = type;
394 }457 this.content = content;
395 458 this.alias = alias;
396 Array.prototype.splice.apply(strarr, args);459 // Copy of the full string this token was created from
460 this.length = (matchedStr || "").length|0;
461 this.greedy = !!greedy;
462 }
397 463
398 if (delNum != 1)464 Token.stringify = function(o, language) {
399 _.matchGrammar(text, strarr, grammar, i, pos, true, token);465 if (typeof o == 'string') {
466 return o;
467 }
400 468
401 if (oneshot)469 if (Array.isArray(o)) {
402 break;470 return o.map(function(element) {
403 }471 return Token.stringify(element, language);
404 }472 }).join('');
405 }473 }
406 },
407 474
408 tokenize: function(text, grammar) {475 var env = {
409 var strarr = [text];476 type: o.type,
410 477 content: Token.stringify(o.content, language),
411 var rest = grammar.rest;478 tag: 'span',
412 479 classes: ['token', o.type],
413 if (rest) {480 attributes: {},
414 for (var token in rest) {481 language: language
415 grammar[token] = rest[token];482 };
416 }
417
418 delete grammar.rest;
419 }
420
421 _.matchGrammar(text, strarr, grammar, 0, 0, false);
422
423 return strarr;
424 },
425
426 hooks: {
427 all: {},
428 483
429 add: function (name, callback) {484 if (o.alias) {
430 var hooks = _.hooks.all;485 var aliases = Array.isArray(o.alias) ? o.alias : [o.alias];
486 Array.prototype.push.apply(env.classes, aliases);
487 }
431 488
432 hooks[name] = hooks[name] || [];489 _.hooks.run('wrap', env);
433 490
434 hooks[name].push(callback);491 var attributes = Object.keys(env.attributes).map(function(name) {
435 },492 return name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
493 }).join(' ');
436 494
437 run: function (name, env) {495 return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
438 var callbacks = _.hooks.all[name];496 };
439 497
440 if (!callbacks || !callbacks.length) {498 if (!_self.document) {
441 return;499 if (!_self.addEventListener) {
442 }500 // in Node.js
501 return _;
502 }
443 503
444 for (var i=0, callback; callback = callbacks[i++];) {504 if (!_.disableWorkerMessageHandler) {
445 callback(env);505 // In worker
446 }506 _self.addEventListener('message', function (evt) {
447 }507 var message = JSON.parse(evt.data),
448 },508 lang = message.language,
509 code = message.code,
510 immediateClose = message.immediateClose;
449 511
450 Token: Token512 _self.postMessage(_.highlight(code, _.languages[lang], lang));
451};513 if (immediateClose) {
514 _self.close();
515 }
516 }, false);
517 }
452 518
453_self.Prism = _;519 return _;
454 520 }
455function Token(type, content, alias, matchedStr, greedy) {
456 this.type = type;
457 this.content = content;
458 this.alias = alias;
459 // Copy of the full string this token was created from
460 this.length = (matchedStr || "").length|0;
461 this.greedy = !!greedy;
462}
463
464Token.stringify = function(o, language) {
465 if (typeof o == 'string') {
466 return o;
467 }
468
469 if (Array.isArray(o)) {
470 return o.map(function(element) {
471 return Token.stringify(element, language);
472 }).join('');
473 }
474
475 var env = {
476 type: o.type,
477 content: Token.stringify(o.content, language),
478 tag: 'span',
479 classes: ['token', o.type],
480 attributes: {},
481 language: language
482 };
483
484 if (o.alias) {
485 var aliases = Array.isArray(o.alias) ? o.alias : [o.alias];
486 Array.prototype.push.apply(env.classes, aliases);
487 }
488
489 _.hooks.run('wrap', env);
490
491 var attributes = Object.keys(env.attributes).map(function(name) {
492 return name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
493 }).join(' ');
494
495 return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
496};
497
498if (!_self.document) {
499 if (!_self.addEventListener) {
500 // in Node.js
501 return _;
502 }
503
504 if (!_.disableWorkerMessageHandler) {
505 // In worker
506 _self.addEventListener('message', function (evt) {
507 var message = JSON.parse(evt.data),
508 lang = message.language,
509 code = message.code,
510 immediateClose = message.immediateClose;
511
512 _self.postMessage(_.highlight(code, _.languages[lang], lang));
513 if (immediateClose) {
514 _self.close();
515 }
516 }, false);
517 }
518
519 return _;
520}
521 521
522//Get current script and highlight522//Get current script and highlight
523var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();523 var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();
524 524
525if (script) {525 if (script) {
526 _.filename = script.src;526 _.filename = script.src;
527 527
528 if (!_.manual && !script.hasAttribute('data-manual')) {528 if (!_.manual && !script.hasAttribute('data-manual')) {
529 if(document.readyState !== "loading") {529 if(document.readyState !== "loading") {
530 if (window.requestAnimationFrame) {530 if (window.requestAnimationFrame) {
531 window.requestAnimationFrame(_.highlightAll);531 window.requestAnimationFrame(_.highlightAll);
532 } else {532 } else {
533 window.setTimeout(_.highlightAll, 16);533 window.setTimeout(_.highlightAll, 16);
534 }534 }
535 }535 }
536 else {536 else {
537 document.addEventListener('DOMContentLoaded', _.highlightAll);537 document.addEventListener('DOMContentLoaded', _.highlightAll);
538 }538 }
539 }539 }
540}540 }
541 541
542return _;542 return _;
543 543
544})(_self);544})(_self);
545 545
546if (typeof module !== 'undefined' && module.exports) {546if (typeof module !== 'undefined' && module.exports) {
547 module.exports = Prism;547 module.exports = Prism;
548}548}
549 549
550// hack for components to work correctly in node.js550// hack for components to work correctly in node.js
551if (typeof global !== 'undefined') {551if (typeof global !== 'undefined') {
552 global.Prism = Prism;552 global.Prism = Prism;
553}553}
554;554;
555Prism.languages.markup = {555Prism.languages.markup = {
556 'comment': /<!--[\s\S]*?-->/,556 'comment': /<!--[\s\S]*?-->/,
557 'prolog': /<\?[\s\S]+?\?>/,557 'prolog': /<\?[\s\S]+?\?>/,
558 'doctype': /<!DOCTYPE[\s\S]+?>/i,558 'doctype': /<!DOCTYPE[\s\S]+?>/i,
559 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,559 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
560 'tag': {560 'tag': {
561 pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i,561 pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i,
562 greedy: true,562 greedy: true,
563 inside: {563 inside: {
564 'tag': {564 'tag': {
565 pattern: /^<\/?[^\s>\/]+/i,565 pattern: /^<\/?[^\s>\/]+/i,
566 inside: {566 inside: {
567 'punctuation': /^<\/?/,567 'punctuation': /^<\/?/,
568 'namespace': /^[^\s>\/:]+:/568 'namespace': /^[^\s>\/:]+:/
569 }569 }
570 },570 },
571 'attr-value': {571 'attr-value': {
572 pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/i,572 pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/i,
573 inside: {573 inside: {
574 'punctuation': [574 'punctuation': [
575 /^=/,575 /^=/,
576 {576 {
577 pattern: /^(\s*)["']|["']$/,577 pattern: /^(\s*)["']|["']$/,
578 lookbehind: true578 lookbehind: true
579 }579 }
580 ]580 ]
581 }581 }
582 },582 },
583 'punctuation': /\/?>/,583 'punctuation': /\/?>/,
584 'attr-name': {584 'attr-name': {
585 pattern: /[^\s>\/]+/,585 pattern: /[^\s>\/]+/,
586 inside: {586 inside: {
587 'namespace': /^[^\s>\/:]+:/587 'namespace': /^[^\s>\/:]+:/
588 }588 }
589 }589 }
590 590
591 }591 }
592 },592 },
593 'entity': /&#?[\da-z]{1,8};/i593 'entity': /&#?[\da-z]{1,8};/i
594};594};
595 595
596Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =596Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
597 Prism.languages.markup['entity'];597 Prism.languages.markup['entity'];
598 598
599// Plugin to make entity title show the real entity, idea by Roman Komarov599// Plugin to make entity title show the real entity, idea by Roman Komarov
600Prism.hooks.add('wrap', function(env) {600Prism.hooks.add('wrap', function(env) {
601 601
602 if (env.type === 'entity') {602 if (env.type === 'entity') {
603 env.attributes['title'] = env.content.replace(/&amp;/, '&');603 env.attributes['title'] = env.content.replace(/&amp;/, '&');
604 }604 }
605});605});
606 606
607Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {607Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
608 /**608 /**
609 * Adds an inlined language to markup.609 * Adds an inlined language to markup.
610 *610 *
611 * An example of an inlined language is CSS with `<style>` tags.611 * An example of an inlined language is CSS with `<style>` tags.
612 *612 *
613 * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as613 * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
614 * case insensitive.614 * case insensitive.
615 * @param {string} lang The language key.615 * @param {string} lang The language key.
616 * @example616 * @example
617 * addInlined('style', 'css');617 * addInlined('style', 'css');
618 */618 */
619 value: function addInlined(tagName, lang) {619 value: function addInlined(tagName, lang) {
620 var includedCdataInside = {};620 var includedCdataInside = {};
621 includedCdataInside['language-' + lang] = {621 includedCdataInside['language-' + lang] = {
622 pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,622 pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
623 lookbehind: true,623 lookbehind: true,
624 inside: Prism.languages[lang]624 inside: Prism.languages[lang]
625 };625 };
626 includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;626 includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
627 627
628 var inside = {628 var inside = {
629 'included-cdata': {629 'included-cdata': {
630 pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,630 pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
631 inside: includedCdataInside631 inside: includedCdataInside
632 }632 }
633 };633 };
634 inside['language-' + lang] = {634 inside['language-' + lang] = {
635 pattern: /[\s\S]+/,635 pattern: /[\s\S]+/,
636 inside: Prism.languages[lang]636 inside: Prism.languages[lang]
637 };637 };
638 638
639 var def = {};639 var def = {};
640 def[tagName] = {640 def[tagName] = {
641 pattern: RegExp(/(<__[\s\S]*?>)(?:<!\[CDATA\[[\s\S]*?\]\]>\s*|[\s\S])*?(?=<\/__>)/.source.replace(/__/g, tagName), 'i'),641 pattern: RegExp(/(<__[\s\S]*?>)(?:<!\[CDATA\[[\s\S]*?\]\]>\s*|[\s\S])*?(?=<\/__>)/.source.replace(/__/g, tagName), 'i'),
642 lookbehind: true,642 lookbehind: true,
643 greedy: true,643 greedy: true,
644 inside: inside644 inside: inside
645 };645 };
646 646
647 Prism.languages.insertBefore('markup', 'cdata', def);647 Prism.languages.insertBefore('markup', 'cdata', def);
648 }648 }
649});649});
650 650
651Prism.languages.xml = Prism.languages.extend('markup', {});651Prism.languages.xml = Prism.languages.extend('markup', {});
@@ -655,533 +655,533 @@ Prism.languages.svg = Prism.languages.markup; · 3 unmodified lines
655 655
656(function (Prism) {656(function (Prism) {
657 657
658 var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;658 var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
659 659
660 Prism.languages.css = {660 Prism.languages.css = {
661 'comment': /\/\*[\s\S]*?\*\//,661 'comment': /\/\*[\s\S]*?\*\//,
662 'atrule': {662 'atrule': {
663 pattern: /@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/,663 pattern: /@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/,
664 inside: {664 inside: {
665 'rule': /@[\w-]+/665 'rule': /@[\w-]+/
666 // See rest below666 // See rest below
667 }667 }
668 },668 },
669 'url': {669 'url': {
670 pattern: RegExp('url\\((?:' + string.source + '|[^\n\r()]*)\\)', 'i'),670 pattern: RegExp('url\\((?:' + string.source + '|[^\n\r()]*)\\)', 'i'),
671 inside: {671 inside: {
672 'function': /^url/i,672 'function': /^url/i,
673 'punctuation': /^\(|\)$/673 'punctuation': /^\(|\)$/
674 }674 }
675 },675 },
676 'selector': RegExp('[^{}\\s](?:[^{};"\']|' + string.source + ')*?(?=\\s*\\{)'),676 'selector': RegExp('[^{}\\s](?:[^{};"\']|' + string.source + ')*?(?=\\s*\\{)'),
677 'string': {677 'string': {
678 pattern: string,678 pattern: string,
679 greedy: true679 greedy: true
680 },680 },
681 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,681 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
682 'important': /!important\b/i,682 'important': /!important\b/i,
683 'function': /[-a-z0-9]+(?=\()/i,683 'function': /[-a-z0-9]+(?=\()/i,
684 'punctuation': /[(){};:,]/684 'punctuation': /[(){};:,]/
685 };685 };
686 686
687 Prism.languages.css['atrule'].inside.rest = Prism.languages.css;687 Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
688 688
689 var markup = Prism.languages.markup;689 var markup = Prism.languages.markup;
690 if (markup) {690 if (markup) {
691 markup.tag.addInlined('style', 'css');691 markup.tag.addInlined('style', 'css');
692 692
693 Prism.languages.insertBefore('inside', 'attr-value', {693 Prism.languages.insertBefore('inside', 'attr-value', {
694 'style-attr': {694 'style-attr': {
695 pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,695 pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
696 inside: {696 inside: {
697 'attr-name': {697 'attr-name': {
698 pattern: /^\s*style/i,698 pattern: /^\s*style/i,
699 inside: markup.tag.inside699 inside: markup.tag.inside
700 },700 },
701 'punctuation': /^\s*=\s*['"]|['"]\s*$/,701 'punctuation': /^\s*=\s*['"]|['"]\s*$/,
702 'attr-value': {702 'attr-value': {
703 pattern: /.+/i,703 pattern: /.+/i,
704 inside: Prism.languages.css704 inside: Prism.languages.css
705 }705 }
706 },706 },
707 alias: 'language-css'707 alias: 'language-css'
708 }708 }
709 }, markup.tag);709 }, markup.tag);
710 }710 }
711 711
712}(Prism));712}(Prism));
713 713
714Prism.languages.clike = {714Prism.languages.clike = {
715 'comment': [715 'comment': [
716 {716 {
717 pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,717 pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
718 lookbehind: true718 lookbehind: true
719 },719 },
720 {720 {
721 pattern: /(^|[^\\:])\/\/.*/,721 pattern: /(^|[^\\:])\/\/.*/,
722 lookbehind: true,722 lookbehind: true,
723 greedy: true723 greedy: true
724 }724 }
725 ],725 ],
726 'string': {726 'string': {
727 pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,727 pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
728 greedy: true728 greedy: true
729 },729 },
730 'class-name': {730 'class-name': {
731 pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,731 pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,
732 lookbehind: true,732 lookbehind: true,
733 inside: {733 inside: {
734 punctuation: /[.\\]/734 punctuation: /[.\\]/
735 }735 }
736 },736 },
737 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,737 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
738 'boolean': /\b(?:true|false)\b/,738 'boolean': /\b(?:true|false)\b/,
739 'function': /\w+(?=\()/,739 'function': /\w+(?=\()/,
740 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,740 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,
741 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,741 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
742 'punctuation': /[{}[\];(),.:]/742 'punctuation': /[{}[\];(),.:]/
743};743};
744 744
745Prism.languages.javascript = Prism.languages.extend('clike', {745Prism.languages.javascript = Prism.languages.extend('clike', {
746 'class-name': [746 'class-name': [
747 Prism.languages.clike['class-name'],747 Prism.languages.clike['class-name'],
748 {748 {
749 pattern: /(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,749 pattern: /(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,
750 lookbehind: true750 lookbehind: true
751 }751 }
752 ],752 ],
753 'keyword': [753 'keyword': [
754 {754 {
755 pattern: /((?:^|})\s*)(?:catch|finally)\b/,755 pattern: /((?:^|})\s*)(?:catch|finally)\b/,
756 lookbehind: true756 lookbehind: true
757 },757 },
758 {758 {
759 pattern: /(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|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|try|typeof|undefined|var|void|while|with|yield)\b/,759 pattern: /(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|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|try|typeof|undefined|var|void|while|with|yield)\b/,
760 lookbehind: true760 lookbehind: true
761 },761 },
762 ],762 ],
763 'number': /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,763 'number': /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,
764 // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)764 // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
765 'function': /#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,765 'function': /#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
766 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/766 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
767});767});
768 768
769Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;769Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;
770 770
771Prism.languages.insertBefore('javascript', 'keyword', {771Prism.languages.insertBefore('javascript', 'keyword', {
772 'regex': {772 'regex': {
773 pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/,773 pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/,
774 lookbehind: true,774 lookbehind: true,
775 greedy: true775 greedy: true
776 },776 },
777 // This must be declared before keyword because we use "function" inside the look-forward777 // This must be declared before keyword because we use "function" inside the look-forward
778 'function-variable': {778 'function-variable': {
779 pattern: /#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,779 pattern: /#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,
780 alias: 'function'780 alias: 'function'
781 },781 },
782 'parameter': [782 'parameter': [
783 {783 {
784 pattern: /(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,784 pattern: /(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,
785 lookbehind: true,785 lookbehind: true,
786 inside: Prism.languages.javascript786 inside: Prism.languages.javascript
787 },787 },
788 {788 {
789 pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,789 pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,
790 inside: Prism.languages.javascript790 inside: Prism.languages.javascript
791 },791 },
792 {792 {
793 pattern: /(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,793 pattern: /(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,
794 lookbehind: true,794 lookbehind: true,
795 inside: Prism.languages.javascript795 inside: Prism.languages.javascript
796 },796 },
797 {797 {
798 pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|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|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,798 pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|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|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,
799 lookbehind: true,799 lookbehind: true,
800 inside: Prism.languages.javascript800 inside: Prism.languages.javascript
801 }801 }
802 ],802 ],
803 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/803 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
804});804});
805 805
806Prism.languages.insertBefore('javascript', 'string', {806Prism.languages.insertBefore('javascript', 'string', {
807 'template-string': {807 'template-string': {
808 pattern: /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,808 pattern: /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,
809 greedy: true,809 greedy: true,
810 inside: {810 inside: {
811 'template-punctuation': {811 'template-punctuation': {
812 pattern: /^`|`$/,812 pattern: /^`|`$/,
813 alias: 'string'813 alias: 'string'
814 },814 },
815 'interpolation': {815 'interpolation': {
816 pattern: /((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,816 pattern: /((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,
817 lookbehind: true,817 lookbehind: true,
818 inside: {818 inside: {
819 'interpolation-punctuation': {819 'interpolation-punctuation': {
820 pattern: /^\${|}$/,820 pattern: /^\${|}$/,
821 alias: 'punctuation'821 alias: 'punctuation'
822 },822 },
823 rest: Prism.languages.javascript823 rest: Prism.languages.javascript
824 }824 }
825 },825 },
826 'string': /[\s\S]+/826 'string': /[\s\S]+/
827 }827 }
828 }828 }
829});829});
830 830
831if (Prism.languages.markup) {831if (Prism.languages.markup) {
832 Prism.languages.markup.tag.addInlined('script', 'javascript');832 Prism.languages.markup.tag.addInlined('script', 'javascript');
833}833}
834 834
835Prism.languages.js = Prism.languages.javascript;835Prism.languages.js = Prism.languages.javascript;
836 836
837Prism.languages.c = Prism.languages.extend('clike', {837Prism.languages.c = Prism.languages.extend('clike', {
838 'class-name': {838 'class-name': {
839 pattern: /(\b(?:enum|struct)\s+)\w+/,839 pattern: /(\b(?:enum|struct)\s+)\w+/,
840 lookbehind: true840 lookbehind: true
841 },841 },
842 'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,842 'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
843 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/,843 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/,
844 'number': /(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i844 'number': /(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i
845});845});
846 846
847Prism.languages.insertBefore('c', 'string', {847Prism.languages.insertBefore('c', 'string', {
848 'macro': {848 'macro': {
849 // allow for multiline macro definitions849 // allow for multiline macro definitions
850 // spaces after the # character compile fine with gcc850 // spaces after the # character compile fine with gcc
851 pattern: /(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im,851 pattern: /(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im,
852 lookbehind: true,852 lookbehind: true,
853 alias: 'property',853 alias: 'property',
854 inside: {854 inside: {
855 // highlight the path of the include statement as a string855 // highlight the path of the include statement as a string
856 'string': {856 'string': {
857 pattern: /(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,857 pattern: /(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,
858 lookbehind: true858 lookbehind: true
859 },859 },
860 // highlight macro directives as keywords860 // highlight macro directives as keywords
861 'directive': {861 'directive': {
862 pattern: /(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,862 pattern: /(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,
863 lookbehind: true,863 lookbehind: true,
864 alias: 'keyword'864 alias: 'keyword'
865 }865 }
866 }866 }
867 },867 },
868 // highlight predefined macros as constants868 // highlight predefined macros as constants
869 'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/869 'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/
870});870});
871 871
872delete Prism.languages.c['boolean'];872delete Prism.languages.c['boolean'];
873 873
874(function(Prism) {874(function(Prism) {
875 // $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'875 // $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
876 // + LC_ALL, RANDOM, REPLY, SECONDS.876 // + LC_ALL, RANDOM, REPLY, SECONDS.
877 // + make sure PS1..4 are here as they are not always set,877 // + make sure PS1..4 are here as they are not always set,
878 // - some useless things.878 // - some useless things.
879 var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b';879 var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b';
880 var insideString = {880 var insideString = {
881 'environment': {881 'environment': {
882 pattern: RegExp("\\$" + envVars),882 pattern: RegExp("\\$" + envVars),
883 alias: 'constant'883 alias: 'constant'
884 },884 },
885 'variable': [885 'variable': [
886 // [0]: Arithmetic Environment886 // [0]: Arithmetic Environment
887 {887 {
888 pattern: /\$?\(\([\s\S]+?\)\)/,888 pattern: /\$?\(\([\s\S]+?\)\)/,
889 greedy: true,889 greedy: true,
890 inside: {890 inside: {
891 // If there is a $ sign at the beginning highlight $(( and )) as variable891 // If there is a $ sign at the beginning highlight $(( and )) as variable
892 'variable': [892 'variable': [
893 {893 {
894 pattern: /(^\$\(\([\s\S]+)\)\)/,894 pattern: /(^\$\(\([\s\S]+)\)\)/,
895 lookbehind: true895 lookbehind: true
896 },896 },
897 /^\$\(\(/897 /^\$\(\(/
898 ],898 ],
899 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,899 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,
900 // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic900 // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
901 'operator': /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,901 'operator': /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,
902 // If there is no $ sign at the beginning highlight (( and )) as punctuation902 // If there is no $ sign at the beginning highlight (( and )) as punctuation
903 'punctuation': /\(\(?|\)\)?|,|;/903 'punctuation': /\(\(?|\)\)?|,|;/
904 }904 }
905 },905 },
906 // [1]: Command Substitution906 // [1]: Command Substitution
907 {907 {
908 pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,908 pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
909 greedy: true,909 greedy: true,
910 inside: {910 inside: {
911 'variable': /^\$\(|^`|\)$|`$/911 'variable': /^\$\(|^`|\)$|`$/
912 }912 }
913 },913 },
914 // [2]: Brace expansion914 // [2]: Brace expansion
915 {915 {
916 pattern: /\$\{[^}]+\}/,916 pattern: /\$\{[^}]+\}/,
917 greedy: true,917 greedy: true,
918 inside: {918 inside: {
919 'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,919 'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
920 'punctuation': /[\[\]]/,920 'punctuation': /[\[\]]/,
921 'environment': {921 'environment': {
922 pattern: RegExp("(\\{)" + envVars),922 pattern: RegExp("(\\{)" + envVars),
923 lookbehind: true,923 lookbehind: true,
924 alias: 'constant'924 alias: 'constant'
925 }925 }
926 }926 }
927 },927 },
928 /\$(?:\w+|[#?*!@$])/928 /\$(?:\w+|[#?*!@$])/
929 ],929 ],
930 // Escape sequences from echo and printf's manuals, and escaped quotes.930 // Escape sequences from echo and printf's manuals, and escaped quotes.
931 'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/931 'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/
932 };932 };
933 933
934 Prism.languages.bash = {934 Prism.languages.bash = {
935 'shebang': {935 'shebang': {
936 pattern: /^#!\s*\/.*/,936 pattern: /^#!\s*\/.*/,
937 alias: 'important'937 alias: 'important'
938 },938 },
939 'comment': {939 'comment': {
940 pattern: /(^|[^"{\\$])#.*/,940 pattern: /(^|[^"{\\$])#.*/,
941 lookbehind: true941 lookbehind: true
942 },942 },
943 'function-name': [943 'function-name': [
944 // a) function foo {944 // a) function foo {
945 // b) foo() {945 // b) foo() {
946 // c) function foo() {946 // c) function foo() {
947 // but not “foo {”947 // but not “foo {”
948 {948 {
949 // a) and c)949 // a) and c)
950 pattern: /(\bfunction\s+)\w+(?=(?:\s*\(?:\s*\))?\s*\{)/,950 pattern: /(\bfunction\s+)\w+(?=(?:\s*\(?:\s*\))?\s*\{)/,
951 lookbehind: true,951 lookbehind: true,
952 alias: 'function'952 alias: 'function'
953 },953 },
954 {954 {
955 // b)955 // b)
956 pattern: /\b\w+(?=\s*\(\s*\)\s*\{)/,956 pattern: /\b\w+(?=\s*\(\s*\)\s*\{)/,
957 alias: 'function'957 alias: 'function'
958 }958 }
959 ],959 ],
960 // Highlight variable names as variables in for and select beginnings.960 // Highlight variable names as variables in for and select beginnings.
961 'for-or-select': {961 'for-or-select': {
962 pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,962 pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
963 alias: 'variable',963 alias: 'variable',
964 lookbehind: true964 lookbehind: true
965 },965 },
966 // Highlight variable names as variables in the left-hand part966 // Highlight variable names as variables in the left-hand part
967 // of assignments (“=” and “+=”).967 // of assignments (“=” and “+=”).
968 'assign-left': {968 'assign-left': {
969 pattern: /(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,969 pattern: /(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,
970 inside: {970 inside: {
971 'environment': {971 'environment': {
972 pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + envVars),972 pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + envVars),
973 lookbehind: true,973 lookbehind: true,
974 alias: 'constant'974 alias: 'constant'
975 }975 }
976 },976 },
977 alias: 'variable',977 alias: 'variable',
978 lookbehind: true978 lookbehind: true
979 },979 },
980 'string': [980 'string': [
981 // Support for Here-documents https://en.wikipedia.org/wiki/Here_document981 // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
982 {982 {
983 pattern: /((?:^|[^<])<<-?\s*)(\w+?)\s*(?:\r?\n|\r)(?:[\s\S])*?(?:\r?\n|\r)\2/,983 pattern: /((?:^|[^<])<<-?\s*)(\w+?)\s*(?:\r?\n|\r)(?:[\s\S])*?(?:\r?\n|\r)\2/,
984 lookbehind: true,984 lookbehind: true,
985 greedy: true,985 greedy: true,
986 inside: insideString986 inside: insideString
987 },987 },
988 // Here-document with quotes around the tag988 // Here-document with quotes around the tag
989 // → No expansion (so no “inside”).989 // → No expansion (so no “inside”).
990 {990 {
991 pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s*(?:\r?\n|\r)(?:[\s\S])*?(?:\r?\n|\r)\3/,991 pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s*(?:\r?\n|\r)(?:[\s\S])*?(?:\r?\n|\r)\3/,
992 lookbehind: true,992 lookbehind: true,
993 greedy: true993 greedy: true
994 },994 },
995 // “Normal” string995 // “Normal” string
996 {996 {
997 pattern: /(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/,997 pattern: /(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/,
998 greedy: true,998 greedy: true,
999 inside: insideString999 inside: insideString
1000 }1000 }
1001 ],1001 ],
1002 'environment': {1002 'environment': {
1003 pattern: RegExp("\\$?" + envVars),1003 pattern: RegExp("\\$?" + envVars),
1004 alias: 'constant'1004 alias: 'constant'
1005 },1005 },
1006 'variable': insideString.variable,1006 'variable': insideString.variable,
1007 'function': {1007 'function': {
1008 pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|aptitude|apt-cache|apt-get|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,1008 pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|aptitude|apt-cache|apt-get|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
1009 lookbehind: true1009 lookbehind: true
1010 },1010 },
1011 'keyword': {1011 'keyword': {
1012 pattern: /(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/,1012 pattern: /(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/,
1013 lookbehind: true1013 lookbehind: true
1014 },1014 },
1015 // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html1015 // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
1016 'builtin': {1016 'builtin': {
1017 pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|pwd|readonly|return|shift|test|times|trap|umask|unset|alias|bind|builtin|caller|command|declare|echo|enable|help|let|local|logout|mapfile|printf|read|readarray|source|type|typeset|ulimit|unalias|set|shopt)(?=$|[)\s;|&])/,1017 pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|pwd|readonly|return|shift|test|times|trap|umask|unset|alias|bind|builtin|caller|command|declare|echo|enable|help|let|local|logout|mapfile|printf|read|readarray|source|type|typeset|ulimit|unalias|set|shopt)(?=$|[)\s;|&])/,
1018 lookbehind: true,1018 lookbehind: true,
1019 // Alias added to make those easier to distinguish from strings.1019 // Alias added to make those easier to distinguish from strings.
1020 alias: 'class-name'1020 alias: 'class-name'
1021 },1021 },
1022 'boolean': {1022 'boolean': {
1023 pattern: /(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/,1023 pattern: /(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/,
1024 lookbehind: true1024 lookbehind: true
1025 },1025 },
1026 'file-descriptor': {1026 'file-descriptor': {
1027 pattern: /\B&\d\b/,1027 pattern: /\B&\d\b/,
1028 alias: 'important'1028 alias: 'important'
1029 },1029 },
1030 'operator': {1030 'operator': {
1031 // Lots of redirections here, but not just that.1031 // Lots of redirections here, but not just that.
1032 pattern: /\d?<>|>\||\+=|==?|!=?|=~|<<[<-]?|[&\d]?>>|\d?[<>]&?|&[>&]?|\|[&|]?|<=?|>=?/,1032 pattern: /\d?<>|>\||\+=|==?|!=?|=~|<<[<-]?|[&\d]?>>|\d?[<>]&?|&[>&]?|\|[&|]?|<=?|>=?/,
1033 inside: {1033 inside: {
1034 'file-descriptor': {1034 'file-descriptor': {
1035 pattern: /^\d/,1035 pattern: /^\d/,
1036 alias: 'important'1036 alias: 'important'
1037 }1037 }
1038 }1038 }
1039 },1039 },
1040 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,1040 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
1041 'number': {1041 'number': {
1042 pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,1042 pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
1043 lookbehind: true1043 lookbehind: true
1044 }1044 }
1045 };1045 };
1046 1046
1047 /* Patterns in command substitution. */1047 /* Patterns in command substitution. */
1048 var toBeCopied = [1048 var toBeCopied = [
1049 'comment',1049 'comment',
1050 'function-name',1050 'function-name',
1051 'for-or-select',1051 'for-or-select',
1052 'assign-left',1052 'assign-left',
1053 'string',1053 'string',
1054 'environment',1054 'environment',
1055 'function',1055 'function',
1056 'keyword',1056 'keyword',
1057 'builtin',1057 'builtin',
1058 'boolean',1058 'boolean',
1059 'file-descriptor',1059 'file-descriptor',
1060 'operator',1060 'operator',
1061 'punctuation',1061 'punctuation',
1062 'number'1062 'number'
1063 ];1063 ];
1064 var inside = insideString.variable[1].inside;1064 var inside = insideString.variable[1].inside;
1065 for(var i = 0; i < toBeCopied.length; i++) {1065 for(var i = 0; i < toBeCopied.length; i++) {
1066 inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];1066 inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
1067 }1067 }
1068 1068
1069 Prism.languages.shell = Prism.languages.bash;1069 Prism.languages.shell = Prism.languages.bash;
1070})(Prism);1070})(Prism);
1071 1071
1072Prism.languages.cpp = Prism.languages.extend('c', {1072Prism.languages.cpp = Prism.languages.extend('c', {
1073 'class-name': {1073 'class-name': {
1074 pattern: /(\b(?:class|enum|struct)\s+)\w+/,1074 pattern: /(\b(?:class|enum|struct)\s+)\w+/,
1075 lookbehind: true1075 lookbehind: true
1076 },1076 },
1077 'keyword': /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,1077 'keyword': /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
1078 'number': {1078 'number': {
1079 pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+\.?[\da-f']*|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+\.?[\d']*|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]*/i,1079 pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+\.?[\da-f']*|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+\.?[\d']*|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]*/i,
1080 greedy: true1080 greedy: true
1081 },1081 },
1082 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,1082 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
1083 'boolean': /\b(?:true|false)\b/1083 'boolean': /\b(?:true|false)\b/
1084});1084});
1085 1085
1086Prism.languages.insertBefore('cpp', 'string', {1086Prism.languages.insertBefore('cpp', 'string', {
1087 'raw-string': {1087 'raw-string': {
1088 pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,1088 pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
1089 alias: 'string',1089 alias: 'string',
1090 greedy: true1090 greedy: true
1091 }1091 }
1092});1092});
1093 1093
1094(function(Prism) {1094(function(Prism) {
1095 1095
1096// Ignore comments starting with { to privilege string interpolation highlighting1096// Ignore comments starting with { to privilege string interpolation highlighting
1097var comment = /#(?!\{).+/,1097 var comment = /#(?!\{).+/,
1098 interpolation = {1098 interpolation = {
1099 pattern: /#\{[^}]+\}/,1099 pattern: /#\{[^}]+\}/,
1100 alias: 'variable'1100 alias: 'variable'
1101 };1101 };
1102 1102
1103Prism.languages.coffeescript = Prism.languages.extend('javascript', {1103 Prism.languages.coffeescript = Prism.languages.extend('javascript', {
1104 'comment': comment,1104 'comment': comment,
1105 'string': [1105 'string': [
1106 1106
1107 // Strings are multiline1107 // Strings are multiline
1108 {1108 {
1109 pattern: /'(?:\\[\s\S]|[^\\'])*'/,1109 pattern: /'(?:\\[\s\S]|[^\\'])*'/,
1110 greedy: true1110 greedy: true
1111 },1111 },
1112 1112
1113 {1113 {
1114 // Strings are multiline1114 // Strings are multiline
1115 pattern: /"(?:\\[\s\S]|[^\\"])*"/,1115 pattern: /"(?:\\[\s\S]|[^\\"])*"/,
1116 greedy: true,1116 greedy: true,
1117 inside: {1117 inside: {
1118 'interpolation': interpolation1118 'interpolation': interpolation
1119 }1119 }
1120 }1120 }
1121 ],1121 ],
1122 'keyword': /\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,1122 'keyword': /\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,
1123 'class-member': {1123 'class-member': {
1124 pattern: /@(?!\d)\w+/,1124 pattern: /@(?!\d)\w+/,
1125 alias: 'variable'1125 alias: 'variable'
1126 }1126 }
1127});1127 });
1128 1128
1129Prism.languages.insertBefore('coffeescript', 'comment', {1129 Prism.languages.insertBefore('coffeescript', 'comment', {
1130 'multiline-comment': {1130 'multiline-comment': {
1131 pattern: /###[\s\S]+?###/,1131 pattern: /###[\s\S]+?###/,
1132 alias: 'comment'1132 alias: 'comment'
1133 },1133 },
1134 1134
1135 // Block regexp can contain comments and interpolation1135 // Block regexp can contain comments and interpolation
1136 'block-regex': {1136 'block-regex': {
1137 pattern: /\/{3}[\s\S]*?\/{3}/,1137 pattern: /\/{3}[\s\S]*?\/{3}/,
1138 alias: 'regex',1138 alias: 'regex',
1139 inside: {1139 inside: {
1140 'comment': comment,1140 'comment': comment,
1141 'interpolation': interpolation1141 'interpolation': interpolation
1142 }1142 }
1143 }1143 }
1144});1144 });
1145 1145
1146Prism.languages.insertBefore('coffeescript', 'string', {1146 Prism.languages.insertBefore('coffeescript', 'string', {
1147 'inline-javascript': {1147 'inline-javascript': {
1148 pattern: /`(?:\\[\s\S]|[^\\`])*`/,1148 pattern: /`(?:\\[\s\S]|[^\\`])*`/,
1149 inside: {1149 inside: {
1150 'delimiter': {1150 'delimiter': {
1151 pattern: /^`|`$/,1151 pattern: /^`|`$/,
1152 alias: 'punctuation'1152 alias: 'punctuation'
1153 },1153 },
1154 rest: Prism.languages.javascript1154 rest: Prism.languages.javascript
1155 }1155 }
1156 },1156 },
1157 1157
1158 // Block strings1158 // Block strings
1159 'multiline-string': [1159 'multiline-string': [
1160 {1160 {
1161 pattern: /'''[\s\S]*?'''/,1161 pattern: /'''[\s\S]*?'''/,
1162 greedy: true,1162 greedy: true,
1163 alias: 'string'1163 alias: 'string'
1164 },1164 },
1165 {1165 {
1166 pattern: /"""[\s\S]*?"""/,1166 pattern: /"""[\s\S]*?"""/,
1167 greedy: true,1167 greedy: true,
1168 alias: 'string',1168 alias: 'string',
1169 inside: {1169 inside: {
1170 interpolation: interpolation1170 interpolation: interpolation
1171 }1171 }
1172 }1172 }
1173 ]1173 ]
1174 1174
1175});1175 });
1176 1176
1177Prism.languages.insertBefore('coffeescript', 'keyword', {1177 Prism.languages.insertBefore('coffeescript', 'keyword', {
1178 // Object property1178 // Object property
1179 'property': /(?!\d)\w+(?=\s*:(?!:))/1179 'property': /(?!\d)\w+(?=\s*:(?!:))/
1180});1180 });
1181 1181
1182delete Prism.languages.coffeescript['template-string'];1182 delete Prism.languages.coffeescript['template-string'];
1183 1183
1184Prism.languages.coffee = Prism.languages.coffeescript;1184 Prism.languages.coffee = Prism.languages.coffeescript;
1185}(Prism));1185}(Prism));
1186/**1186/**
1187 * Original by Samuel Flores1187 * Original by Samuel Flores
@@ -1190,621 +1190,621 @@ Prism.languages.coffee = Prism.languages.coffeescript; · 2 unmodified lines
1190 * constant, builtin, variable, symbol, regex1190 * constant, builtin, variable, symbol, regex
1191 */1191 */
1192(function(Prism) {1192(function(Prism) {
1193 Prism.languages.ruby = Prism.languages.extend('clike', {1193 Prism.languages.ruby = Prism.languages.extend('clike', {
1194 'comment': [1194 'comment': [
1195 /#.*/,1195 /#.*/,
1196 {1196 {
1197 pattern: /^=begin\s[\s\S]*?^=end/m,1197 pattern: /^=begin\s[\s\S]*?^=end/m,
1198 greedy: true1198 greedy: true
1199 }1199 }
1200 ],1200 ],
1201 'keyword': /\b(?:alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|protected|private|public|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/1201 'keyword': /\b(?:alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|protected|private|public|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/
1202 });1202 });
1203 1203
1204 var interpolation = {1204 var interpolation = {
1205 pattern: /#\{[^}]+\}/,1205 pattern: /#\{[^}]+\}/,
1206 inside: {1206 inside: {
1207 'delimiter': {1207 'delimiter': {
1208 pattern: /^#\{|\}$/,1208 pattern: /^#\{|\}$/,
1209 alias: 'tag'1209 alias: 'tag'
1210 },1210 },
1211 rest: Prism.languages.ruby1211 rest: Prism.languages.ruby
1212 }1212 }
1213 };1213 };
1214 1214
1215 delete Prism.languages.ruby.function;1215 delete Prism.languages.ruby.function;
1216 1216
1217 Prism.languages.insertBefore('ruby', 'keyword', {1217 Prism.languages.insertBefore('ruby', 'keyword', {
1218 'regex': [1218 'regex': [
1219 {1219 {
1220 pattern: /%r([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1[gim]{0,3}/,1220 pattern: /%r([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1[gim]{0,3}/,
1221 greedy: true,1221 greedy: true,
1222 inside: {1222 inside: {
1223 'interpolation': interpolation1223 'interpolation': interpolation
1224 }1224 }
1225 },1225 },
1226 {1226 {
1227 pattern: /%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,1227 pattern: /%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,
1228 greedy: true,1228 greedy: true,
1229 inside: {1229 inside: {
1230 'interpolation': interpolation1230 'interpolation': interpolation
1231 }1231 }
1232 },1232 },
1233 {1233 {
1234 // Here we need to specifically allow interpolation1234 // Here we need to specifically allow interpolation
1235 pattern: /%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,1235 pattern: /%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,
1236 greedy: true,1236 greedy: true,
1237 inside: {1237 inside: {
1238 'interpolation': interpolation1238 'interpolation': interpolation
1239 }1239 }
1240 },1240 },
1241 {1241 {
1242 pattern: /%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,1242 pattern: /%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,
1243 greedy: true,1243 greedy: true,
1244 inside: {1244 inside: {
1245 'interpolation': interpolation1245 'interpolation': interpolation
1246 }1246 }
1247 },1247 },
1248 {1248 {
1249 pattern: /%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,1249 pattern: /%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,
1250 greedy: true,1250 greedy: true,
1251 inside: {1251 inside: {
1252 'interpolation': interpolation1252 'interpolation': interpolation
1253 }1253 }
1254 },1254 },
1255 {1255 {
1256 pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,1256 pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,
1257 lookbehind: true,1257 lookbehind: true,
1258 greedy: true1258 greedy: true
1259 }1259 }
1260 ],1260 ],
1261 'variable': /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,1261 'variable': /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,
1262 'symbol': {1262 'symbol': {
1263 pattern: /(^|[^:]):[a-zA-Z_]\w*(?:[?!]|\b)/,1263 pattern: /(^|[^:]):[a-zA-Z_]\w*(?:[?!]|\b)/,
1264 lookbehind: true1264 lookbehind: true
1265 },1265 },
1266 'method-definition': {1266 'method-definition': {
1267 pattern: /(\bdef\s+)[\w.]+/,1267 pattern: /(\bdef\s+)[\w.]+/,
1268 lookbehind: true,1268 lookbehind: true,
1269 inside: {1269 inside: {
1270 'function': /\w+$/,1270 'function': /\w+$/,
1271 rest: Prism.languages.ruby1271 rest: Prism.languages.ruby
1272 }1272 }
1273 }1273 }
1274 });1274 });
1275 1275
1276 Prism.languages.insertBefore('ruby', 'number', {1276 Prism.languages.insertBefore('ruby', 'number', {
1277 'builtin': /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|Fixnum|Float|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,1277 'builtin': /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|Fixnum|Float|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,
1278 'constant': /\b[A-Z]\w*(?:[?!]|\b)/1278 'constant': /\b[A-Z]\w*(?:[?!]|\b)/
1279 });1279 });
1280 1280
1281 Prism.languages.ruby.string = [1281 Prism.languages.ruby.string = [
1282 {1282 {
1283 pattern: /%[qQiIwWxs]?([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/,1283 pattern: /%[qQiIwWxs]?([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/,
1284 greedy: true,1284 greedy: true,
1285 inside: {1285 inside: {
1286 'interpolation': interpolation1286 'interpolation': interpolation
1287 }1287 }
1288 },1288 },
1289 {1289 {
1290 pattern: /%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,1290 pattern: /%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,
1291 greedy: true,1291 greedy: true,
1292 inside: {1292 inside: {
1293 'interpolation': interpolation1293 'interpolation': interpolation
1294 }1294 }
1295 },1295 },
1296 {1296 {
1297 // Here we need to specifically allow interpolation1297 // Here we need to specifically allow interpolation
1298 pattern: /%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,1298 pattern: /%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,
1299 greedy: true,1299 greedy: true,
1300 inside: {1300 inside: {
1301 'interpolation': interpolation1301 'interpolation': interpolation
1302 }1302 }
1303 },1303 },
1304 {1304 {
1305 pattern: /%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,1305 pattern: /%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,
1306 greedy: true,1306 greedy: true,
1307 inside: {1307 inside: {
1308 'interpolation': interpolation1308 'interpolation': interpolation
1309 }1309 }
1310 },1310 },
1311 {1311 {
1312 pattern: /%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,1312 pattern: /%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,
1313 greedy: true,1313 greedy: true,
1314 inside: {1314 inside: {
1315 'interpolation': interpolation1315 'interpolation': interpolation
1316 }1316 }
1317 },1317 },
1318 {1318 {
1319 pattern: /("|')(?:#\{[^}]+\}|\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,1319 pattern: /("|')(?:#\{[^}]+\}|\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1320 greedy: true,1320 greedy: true,
1321 inside: {1321 inside: {
1322 'interpolation': interpolation1322 'interpolation': interpolation
1323 }1323 }
1324 }1324 }
1325 ];1325 ];
1326 1326
1327 Prism.languages.rb = Prism.languages.ruby;1327 Prism.languages.rb = Prism.languages.ruby;
1328}(Prism));1328}(Prism));
1329 1329
1330Prism.languages.d = Prism.languages.extend('clike', {1330Prism.languages.d = Prism.languages.extend('clike', {
1331 'string': [1331 'string': [
1332 // r"", x""1332 // r"", x""
1333 /\b[rx]"(?:\\[\s\S]|[^\\"])*"[cwd]?/,1333 /\b[rx]"(?:\\[\s\S]|[^\\"])*"[cwd]?/,
1334 // q"[]", q"()", q"<>", q"{}"1334 // q"[]", q"()", q"<>", q"{}"
1335 /\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/,1335 /\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/,
1336 // q"IDENT1336 // q"IDENT
1337 // ...1337 // ...
1338 // IDENT"1338 // IDENT"
1339 /\bq"([_a-zA-Z][_a-zA-Z\d]*)(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\1"/,1339 /\bq"([_a-zA-Z][_a-zA-Z\d]*)(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\1"/,
1340 // q"//", q"||", etc.1340 // q"//", q"||", etc.
1341 /\bq"(.)[\s\S]*?\1"/,1341 /\bq"(.)[\s\S]*?\1"/,
1342 // Characters1342 // Characters
1343 /'(?:\\'|\\?[^']+)'/,1343 /'(?:\\'|\\?[^']+)'/,
1344 1344
1345 /(["`])(?:\\[\s\S]|(?!\1)[^\\])*\1[cwd]?/1345 /(["`])(?:\\[\s\S]|(?!\1)[^\\])*\1[cwd]?/
1346 ],1346 ],
1347 1347
1348 'number': [1348 'number': [
1349 // The lookbehind and the negative look-ahead try to prevent bad highlighting of the .. operator1349 // The lookbehind and the negative look-ahead try to prevent bad highlighting of the .. operator
1350 // Hexadecimal numbers must be handled separately to avoid problems with exponent "e"1350 // Hexadecimal numbers must be handled separately to avoid problems with exponent "e"
1351 /\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*/i,1351 /\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*/i,
1352 {1352 {
1353 pattern: /((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]*/i,1353 pattern: /((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]*/i,
1354 lookbehind: true1354 lookbehind: true
1355 }1355 }
1356 ],1356 ],
1357 1357
1358 // In order: $, keywords and special tokens, globally defined symbols1358 // In order: $, keywords and special tokens, globally defined symbols
1359 'keyword': /\$|\b(?:abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t)\b/,1359 'keyword': /\$|\b(?:abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t)\b/,
1360 'operator': /\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/1360 'operator': /\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/
1361});1361});
1362 1362
1363 1363
1364Prism.languages.d.comment = [1364Prism.languages.d.comment = [
1365 // Shebang1365 // Shebang
1366 /^\s*#!.+/,1366 /^\s*#!.+/,
1367 // /+ +/1367 // /+ +/
1368 {1368 {
1369 // Allow one level of nesting1369 // Allow one level of nesting
1370 pattern: /(^|[^\\])\/\+(?:\/\+[\s\S]*?\+\/|[\s\S])*?\+\//,1370 pattern: /(^|[^\\])\/\+(?:\/\+[\s\S]*?\+\/|[\s\S])*?\+\//,
1371 lookbehind: true1371 lookbehind: true
1372 }1372 }
1373].concat(Prism.languages.d.comment);1373].concat(Prism.languages.d.comment);
1374 1374
1375Prism.languages.insertBefore('d', 'comment', {1375Prism.languages.insertBefore('d', 'comment', {
1376 'token-string': {1376 'token-string': {
1377 // Allow one level of nesting1377 // Allow one level of nesting
1378 pattern: /\bq\{(?:\{[^}]*\}|[^}])*\}/,1378 pattern: /\bq\{(?:\{[^}]*\}|[^}])*\}/,
1379 alias: 'string'1379 alias: 'string'
1380 }1380 }
1381});1381});
1382 1382
1383Prism.languages.insertBefore('d', 'keyword', {1383Prism.languages.insertBefore('d', 'keyword', {
1384 'property': /\B@\w*/1384 'property': /\B@\w*/
1385});1385});
1386 1386
1387Prism.languages.insertBefore('d', 'function', {1387Prism.languages.insertBefore('d', 'function', {
1388 'register': {1388 'register': {
1389 // Iasm registers1389 // Iasm registers
1390 pattern: /\b(?:[ABCD][LHX]|E[ABCD]X|E?(?:BP|SP|DI|SI)|[ECSDGF]S|CR[0234]|DR[012367]|TR[3-7]|X?MM[0-7]|R[ABCD]X|[BS]PL|R[BS]P|[DS]IL|R[DS]I|R(?:[89]|1[0-5])[BWD]?|XMM(?:[89]|1[0-5])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/,1390 pattern: /\b(?:[ABCD][LHX]|E[ABCD]X|E?(?:BP|SP|DI|SI)|[ECSDGF]S|CR[0234]|DR[012367]|TR[3-7]|X?MM[0-7]|R[ABCD]X|[BS]PL|R[BS]P|[DS]IL|R[DS]I|R(?:[89]|1[0-5])[BWD]?|XMM(?:[89]|1[0-5])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/,
1391 alias: 'variable'1391 alias: 'variable'
1392 }1392 }
1393});1393});
1394Prism.languages.dart = Prism.languages.extend('clike', {1394Prism.languages.dart = Prism.languages.extend('clike', {
1395 'string': [1395 'string': [
1396 {1396 {
1397 pattern: /r?("""|''')[\s\S]*?\1/,1397 pattern: /r?("""|''')[\s\S]*?\1/,
1398 greedy: true1398 greedy: true
1399 },1399 },
1400 {1400 {
1401 pattern: /r?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,1401 pattern: /r?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
1402 greedy: true1402 greedy: true
1403 }1403 }
1404 ],1404 ],
1405 'keyword': [1405 'keyword': [
1406 /\b(?:async|sync|yield)\*/,1406 /\b(?:async|sync|yield)\*/,
1407 /\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/1407 /\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/
1408 ],1408 ],
1409 'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/1409 'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/
1410});1410});
1411 1411
1412Prism.languages.insertBefore('dart','function',{1412Prism.languages.insertBefore('dart','function',{
1413 'metadata': {1413 'metadata': {
1414 pattern: /@\w+/,1414 pattern: /@\w+/,
1415 alias: 'symbol'1415 alias: 'symbol'
1416 }1416 }
1417});1417});
1418(function (Prism) {1418(function (Prism) {
1419 1419
1420 /**1420 /**
1421 * Returns the placeholder for the given language id and index.1421 * Returns the placeholder for the given language id and index.
1422 *1422 *
1423 * @param {string} language1423 * @param {string} language
1424 * @param {string|number} index1424 * @param {string|number} index
1425 * @returns {string}1425 * @returns {string}
1426 */1426 */
1427 function getPlaceholder(language, index) {1427 function getPlaceholder(language, index) {
1428 return '___' + language.toUpperCase() + index + '___';1428 return '___' + language.toUpperCase() + index + '___';
1429 }1429 }
1430 1430
1431 Object.defineProperties(Prism.languages['markup-templating'] = {}, {1431 Object.defineProperties(Prism.languages['markup-templating'] = {}, {
1432 buildPlaceholders: {1432 buildPlaceholders: {
1433 /**1433 /**
1434 * Tokenize all inline templating expressions matching `placeholderPattern`.1434 * Tokenize all inline templating expressions matching `placeholderPattern`.
1435 *1435 *
1436 * If `replaceFilter` is provided, only matches of `placeholderPattern` for which `replaceFilter` returns1436 * If `replaceFilter` is provided, only matches of `placeholderPattern` for which `replaceFilter` returns
1437 * `true` will be replaced.1437 * `true` will be replaced.
1438 *1438 *
1439 * @param {object} env The environment of the `before-tokenize` hook.1439 * @param {object} env The environment of the `before-tokenize` hook.
1440 * @param {string} language The language id.1440 * @param {string} language The language id.
1441 * @param {RegExp} placeholderPattern The matches of this pattern will be replaced by placeholders.1441 * @param {RegExp} placeholderPattern The matches of this pattern will be replaced by placeholders.
1442 * @param {(match: string) => boolean} [replaceFilter]1442 * @param {(match: string) => boolean} [replaceFilter]
1443 */1443 */
1444 value: function (env, language, placeholderPattern, replaceFilter) {1444 value: function (env, language, placeholderPattern, replaceFilter) {
1445 if (env.language !== language) {1445 if (env.language !== language) {
1446 return;1446 return;
1447 }1447 }
1448 1448
1449 var tokenStack = env.tokenStack = [];1449 var tokenStack = env.tokenStack = [];
1450 1450
1451 env.code = env.code.replace(placeholderPattern, function (match) {1451 env.code = env.code.replace(placeholderPattern, function (match) {
1452 if (typeof replaceFilter === 'function' && !replaceFilter(match)) {1452 if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
1453 return match;1453 return match;
1454 }1454 }
1455 var i = tokenStack.length;1455 var i = tokenStack.length;
1456 var placeholder;1456 var placeholder;
1457 1457
1458 // Check for existing strings1458 // Check for existing strings
1459 while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1)1459 while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1)
1460 ++i;1460 ++i;
1461 1461
1462 // Create a sparse array1462 // Create a sparse array
1463 tokenStack[i] = match;1463 tokenStack[i] = match;
1464 1464
1465 return placeholder;1465 return placeholder;
1466 });1466 });
1467 1467
1468 // Switch the grammar to markup1468 // Switch the grammar to markup
1469 env.grammar = Prism.languages.markup;1469 env.grammar = Prism.languages.markup;
1470 }1470 }
1471 },1471 },
1472 tokenizePlaceholders: {1472 tokenizePlaceholders: {
1473 /**1473 /**
1474 * Replace placeholders with proper tokens after tokenizing.1474 * Replace placeholders with proper tokens after tokenizing.
1475 *1475 *
1476 * @param {object} env The environment of the `after-tokenize` hook.1476 * @param {object} env The environment of the `after-tokenize` hook.
1477 * @param {string} language The language id.1477 * @param {string} language The language id.
1478 */1478 */
1479 value: function (env, language) {1479 value: function (env, language) {
1480 if (env.language !== language || !env.tokenStack) {1480 if (env.language !== language || !env.tokenStack) {
1481 return;1481 return;
1482 }1482 }
1483 1483
1484 // Switch the grammar back1484 // Switch the grammar back
1485 env.grammar = Prism.languages[language];1485 env.grammar = Prism.languages[language];
1486 1486
1487 var j = 0;1487 var j = 0;
1488 var keys = Object.keys(env.tokenStack);1488 var keys = Object.keys(env.tokenStack);
1489 1489
1490 function walkTokens(tokens) {1490 function walkTokens(tokens) {
1491 for (var i = 0; i < tokens.length; i++) {1491 for (var i = 0; i < tokens.length; i++) {
1492 // all placeholders are replaced already1492 // all placeholders are replaced already
1493 if (j >= keys.length) {1493 if (j >= keys.length) {
1494 break;1494 break;
1495 }1495 }
1496 1496
1497 var token = tokens[i];1497 var token = tokens[i];
1498 if (typeof token === 'string' || (token.content && typeof token.content === 'string')) {1498 if (typeof token === 'string' || (token.content && typeof token.content === 'string')) {
1499 var k = keys[j];1499 var k = keys[j];
1500 var t = env.tokenStack[k];1500 var t = env.tokenStack[k];
1501 var s = typeof token === 'string' ? token : token.content;1501 var s = typeof token === 'string' ? token : token.content;
1502 var placeholder = getPlaceholder(language, k);1502 var placeholder = getPlaceholder(language, k);
1503 1503
1504 var index = s.indexOf(placeholder);1504 var index = s.indexOf(placeholder);
1505 if (index > -1) {1505 if (index > -1) {
1506 ++j;1506 ++j;
1507 1507
1508 var before = s.substring(0, index);1508 var before = s.substring(0, index);
1509 var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);1509 var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);
1510 var after = s.substring(index + placeholder.length);1510 var after = s.substring(index + placeholder.length);
1511 1511
1512 var replacement = [];1512 var replacement = [];
1513 if (before) {1513 if (before) {
1514 replacement.push.apply(replacement, walkTokens([before]));1514 replacement.push.apply(replacement, walkTokens([before]));
1515 }1515 }
1516 replacement.push(middle);1516 replacement.push(middle);
1517 if (after) {1517 if (after) {
1518 replacement.push.apply(replacement, walkTokens([after]));1518 replacement.push.apply(replacement, walkTokens([after]));
1519 }1519 }
1520 1520
1521 if (typeof token === 'string') {1521 if (typeof token === 'string') {
1522 tokens.splice.apply(tokens, [i, 1].concat(replacement));1522 tokens.splice.apply(tokens, [i, 1].concat(replacement));
1523 } else {1523 } else {
1524 token.content = replacement;1524 token.content = replacement;
1525 }1525 }
1526 }1526 }
1527 } else if (token.content /* && typeof token.content !== 'string' */) {1527 } else if (token.content /* && typeof token.content !== 'string' */) {
1528 walkTokens(token.content);1528 walkTokens(token.content);
1529 }1529 }
1530 }1530 }
1531 1531
1532 return tokens;1532 return tokens;
1533 }1533 }
1534 1534
1535 walkTokens(env.tokens);1535 walkTokens(env.tokens);
1536 }1536 }
1537 }1537 }
1538 });1538 });
1539 1539
1540}(Prism));1540}(Prism));
1541 1541
1542Prism.languages.elixir = {1542Prism.languages.elixir = {
1543 'comment': /#.*/m,1543 'comment': /#.*/m,
1544 // ~r"""foo""" (multi-line), ~r'''foo''' (multi-line), ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo>1544 // ~r"""foo""" (multi-line), ~r'''foo''' (multi-line), ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo>
1545 'regex': {1545 'regex': {
1546 pattern: /~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/,1546 pattern: /~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/,
1547 greedy: true1547 greedy: true
1548 },1548 },
1549 'string': [1549 'string': [
1550 {1550 {
1551 // ~s"""foo""" (multi-line), ~s'''foo''' (multi-line), ~s/foo/, ~s|foo|, ~s"foo", ~s'foo', ~s(foo), ~s[foo], ~s{foo} (with interpolation care), ~s<foo>1551 // ~s"""foo""" (multi-line), ~s'''foo''' (multi-line), ~s/foo/, ~s|foo|, ~s"foo", ~s'foo', ~s(foo), ~s[foo], ~s{foo} (with interpolation care), ~s<foo>
1552 pattern: /~[cCsSwW](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|#\{[^}]+\}|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[csa]?/,1552 pattern: /~[cCsSwW](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|#\{[^}]+\}|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[csa]?/,
1553 greedy: true,1553 greedy: true,
1554 inside: {1554 inside: {
1555 // See interpolation below1555 // See interpolation below
1556 }1556 }
1557 },1557 },
1558 {1558 {
1559 pattern: /("""|''')[\s\S]*?\1/,1559 pattern: /("""|''')[\s\S]*?\1/,
1560 greedy: true,1560 greedy: true,
1561 inside: {1561 inside: {
1562 // See interpolation below1562 // See interpolation below
1563 }1563 }
1564 },1564 },
1565 {1565 {
1566 // Multi-line strings are allowed1566 // Multi-line strings are allowed
1567 pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,1567 pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1568 greedy: true,1568 greedy: true,
1569 inside: {1569 inside: {
1570 // See interpolation below1570 // See interpolation below
1571 }1571 }
1572 }1572 }
1573 ],1573 ],
1574 'atom': {1574 'atom': {
1575 // Look-behind prevents bad highlighting of the :: operator1575 // Look-behind prevents bad highlighting of the :: operator
1576 pattern: /(^|[^:]):\w+/,1576 pattern: /(^|[^:]):\w+/,
1577 lookbehind: true,1577 lookbehind: true,
1578 alias: 'symbol'1578 alias: 'symbol'
1579 },1579 },
1580 // Look-ahead prevents bad highlighting of the :: operator1580 // Look-ahead prevents bad highlighting of the :: operator
1581 'attr-name': /\w+:(?!:)/,1581 'attr-name': /\w+:(?!:)/,
1582 'capture': {1582 'capture': {
1583 // Look-behind prevents bad highlighting of the && operator1583 // Look-behind prevents bad highlighting of the && operator
1584 pattern: /(^|[^&])&(?:[^&\s\d()][^\s()]*|(?=\())/,1584 pattern: /(^|[^&])&(?:[^&\s\d()][^\s()]*|(?=\())/,
1585 lookbehind: true,1585 lookbehind: true,
1586 alias: 'function'1586 alias: 'function'
1587 },1587 },
1588 'argument': {1588 'argument': {
1589 // Look-behind prevents bad highlighting of the && operator1589 // Look-behind prevents bad highlighting of the && operator
1590 pattern: /(^|[^&])&\d+/,1590 pattern: /(^|[^&])&\d+/,
1591 lookbehind: true,1591 lookbehind: true,
1592 alias: 'variable'1592 alias: 'variable'
1593 },1593 },
1594 'attribute': {1594 'attribute': {
1595 pattern: /@\w+/,1595 pattern: /@\w+/,
1596 alias: 'variable'1596 alias: 'variable'
1597 },1597 },
1598 'number': /\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i,1598 'number': /\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i,
1599 'keyword': /\b(?:after|alias|and|case|catch|cond|def(?:callback|exception|impl|module|p|protocol|struct)?|do|else|end|fn|for|if|import|not|or|require|rescue|try|unless|use|when)\b/,1599 'keyword': /\b(?:after|alias|and|case|catch|cond|def(?:callback|exception|impl|module|p|protocol|struct)?|do|else|end|fn|for|if|import|not|or|require|rescue|try|unless|use|when)\b/,
1600 'boolean': /\b(?:true|false|nil)\b/,1600 'boolean': /\b(?:true|false|nil)\b/,
1601 'operator': [1601 'operator': [
1602 /\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/,1602 /\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/,
1603 {1603 {
1604 // We don't want to match <<1604 // We don't want to match <<
1605 pattern: /([^<])<(?!<)/,1605 pattern: /([^<])<(?!<)/,
1606 lookbehind: true1606 lookbehind: true
1607 },1607 },
1608 {1608 {
1609 // We don't want to match >>1609 // We don't want to match >>
1610 pattern: /([^>])>(?!>)/,1610 pattern: /([^>])>(?!>)/,
1611 lookbehind: true1611 lookbehind: true
1612 }1612 }
1613 ],1613 ],
1614 'punctuation': /<<|>>|[.,%\[\]{}()]/1614 'punctuation': /<<|>>|[.,%\[\]{}()]/
1615};1615};
1616 1616
1617Prism.languages.elixir.string.forEach(function(o) {1617Prism.languages.elixir.string.forEach(function(o) {
1618 o.inside = {1618 o.inside = {
1619 'interpolation': {1619 'interpolation': {
1620 pattern: /#\{[^}]+\}/,1620 pattern: /#\{[^}]+\}/,
1621 inside: {1621 inside: {
1622 'delimiter': {1622 'delimiter': {
1623 pattern: /^#\{|\}$/,1623 pattern: /^#\{|\}$/,
1624 alias: 'punctuation'1624 alias: 'punctuation'
1625 },1625 },
1626 rest: Prism.languages.elixir1626 rest: Prism.languages.elixir
1627 }1627 }
1628 }1628 }
1629 };1629 };
1630});1630});
1631 1631
1632Prism.languages.erlang = {1632Prism.languages.erlang = {
1633 'comment': /%.+/,1633 'comment': /%.+/,
1634 'string': {1634 'string': {
1635 pattern: /"(?:\\.|[^\\"\r\n])*"/,1635 pattern: /"(?:\\.|[^\\"\r\n])*"/,
1636 greedy: true1636 greedy: true
1637 },1637 },
1638 'quoted-function': {1638 'quoted-function': {
1639 pattern: /'(?:\\.|[^\\'\r\n])+'(?=\()/,1639 pattern: /'(?:\\.|[^\\'\r\n])+'(?=\()/,
1640 alias: 'function'1640 alias: 'function'
1641 },1641 },
1642 'quoted-atom': {1642 'quoted-atom': {
1643 pattern: /'(?:\\.|[^\\'\r\n])+'/,1643 pattern: /'(?:\\.|[^\\'\r\n])+'/,
1644 alias: 'atom'1644 alias: 'atom'
1645 },1645 },
1646 'boolean': /\b(?:true|false)\b/,1646 'boolean': /\b(?:true|false)\b/,
1647 'keyword': /\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,1647 'keyword': /\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,
1648 'number': [1648 'number': [
1649 /\$\\?./,1649 /\$\\?./,
1650 /\d+#[a-z0-9]+/i,1650 /\d+#[a-z0-9]+/i,
1651 /(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i1651 /(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i
1652 ],1652 ],
1653 'function': /\b[a-z][\w@]*(?=\()/,1653 'function': /\b[a-z][\w@]*(?=\()/,
1654 'variable': {1654 'variable': {
1655 // Look-behind is used to prevent wrong highlighting of atoms containing "@"1655 // Look-behind is used to prevent wrong highlighting of atoms containing "@"
1656 pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,1656 pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,
1657 lookbehind: true1657 lookbehind: true
1658 },1658 },
1659 'operator': [1659 'operator': [
1660 /[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,1660 /[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,
1661 {1661 {
1662 // We don't want to match <<1662 // We don't want to match <<
1663 pattern: /(^|[^<])<(?!<)/,1663 pattern: /(^|[^<])<(?!<)/,
1664 lookbehind: true1664 lookbehind: true
1665 },1665 },
1666 {1666 {
1667 // We don't want to match >>1667 // We don't want to match >>
1668 pattern: /(^|[^>])>(?!>)/,1668 pattern: /(^|[^>])>(?!>)/,
1669 lookbehind: true1669 lookbehind: true
1670 }1670 }
1671 ],1671 ],
1672 'atom': /\b[a-z][\w@]*/,1672 'atom': /\b[a-z][\w@]*/,
1673 'punctuation': /[()[\]{}:;,.#|]|<<|>>/1673 'punctuation': /[()[\]{}:;,.#|]|<<|>>/
1674 1674
1675};1675};
1676Prism.languages.go = Prism.languages.extend('clike', {1676Prism.languages.go = Prism.languages.extend('clike', {
1677 'keyword': /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,1677 'keyword': /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
1678 'builtin': /\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/,1678 'builtin': /\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/,
1679 'boolean': /\b(?:_|iota|nil|true|false)\b/,1679 'boolean': /\b(?:_|iota|nil|true|false)\b/,
1680 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,1680 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
1681 'number': /(?:\b0x[a-f\d]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[-+]?\d+)?)i?/i,1681 'number': /(?:\b0x[a-f\d]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[-+]?\d+)?)i?/i,
1682 'string': {1682 'string': {
1683 pattern: /(["'`])(\\[\s\S]|(?!\1)[^\\])*\1/,1683 pattern: /(["'`])(\\[\s\S]|(?!\1)[^\\])*\1/,
1684 greedy: true1684 greedy: true
1685 }1685 }
1686});1686});
1687delete Prism.languages.go['class-name'];1687delete Prism.languages.go['class-name'];
1688 1688
1689Prism.languages.groovy = Prism.languages.extend('clike', {1689Prism.languages.groovy = Prism.languages.extend('clike', {
1690 'keyword': /\b(?:as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/,1690 'keyword': /\b(?:as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/,
1691 'string': [1691 'string': [
1692 {1692 {
1693 pattern: /("""|''')[\s\S]*?\1|(?:\$\/)(?:\$\/\$|[\s\S])*?\/\$/,1693 pattern: /("""|''')[\s\S]*?\1|(?:\$\/)(?:\$\/\$|[\s\S])*?\/\$/,
1694 greedy: true1694 greedy: true
1695 },1695 },
1696 {1696 {
1697 pattern: /(["'\/])(?:\\.|(?!\1)[^\\\r\n])*\1/,1697 pattern: /(["'\/])(?:\\.|(?!\1)[^\\\r\n])*\1/,
1698 greedy: true1698 greedy: true
1699 }1699 }
1700 ],1700 ],
1701 'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?[\d]+)?)[glidf]?\b/i,1701 'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?[\d]+)?)[glidf]?\b/i,
1702 'operator': {1702 'operator': {
1703 pattern: /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.{1,2}(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/,1703 pattern: /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.{1,2}(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/,
1704 lookbehind: true1704 lookbehind: true
1705 },1705 },
1706 'punctuation': /\.+|[{}[\];(),:$]/1706 'punctuation': /\.+|[{}[\];(),:$]/
1707});1707});
1708 1708
1709Prism.languages.insertBefore('groovy', 'string', {1709Prism.languages.insertBefore('groovy', 'string', {
1710 'shebang': {1710 'shebang': {
1711 pattern: /#!.+/,1711 pattern: /#!.+/,
1712 alias: 'comment'1712 alias: 'comment'
1713 }1713 }
1714});1714});
1715 1715
1716Prism.languages.insertBefore('groovy', 'punctuation', {1716Prism.languages.insertBefore('groovy', 'punctuation', {
1717 'spock-block': /\b(?:setup|given|when|then|and|cleanup|expect|where):/1717 'spock-block': /\b(?:setup|given|when|then|and|cleanup|expect|where):/
1718});1718});
1719 1719
1720Prism.languages.insertBefore('groovy', 'function', {1720Prism.languages.insertBefore('groovy', 'function', {
1721 'annotation': {1721 'annotation': {
1722 alias: 'punctuation',1722 alias: 'punctuation',
1723 pattern: /(^|[^.])@\w+/,1723 pattern: /(^|[^.])@\w+/,
1724 lookbehind: true1724 lookbehind: true
1725 }1725 }
1726});1726});
1727 1727
1728// Handle string interpolation1728// Handle string interpolation
1729Prism.hooks.add('wrap', function(env) {1729Prism.hooks.add('wrap', function(env) {
1730 if (env.language === 'groovy' && env.type === 'string') {1730 if (env.language === 'groovy' && env.type === 'string') {
1731 var delimiter = env.content[0];1731 var delimiter = env.content[0];
1732 1732
1733 if (delimiter != "'") {1733 if (delimiter != "'") {
1734 var pattern = /([^\\])(?:\$(?:\{.*?\}|[\w.]+))/;1734 var pattern = /([^\\])(?:\$(?:\{.*?\}|[\w.]+))/;
1735 if (delimiter === '$') {1735 if (delimiter === '$') {
1736 pattern = /([^\$])(?:\$(?:\{.*?\}|[\w.]+))/;1736 pattern = /([^\$])(?:\$(?:\{.*?\}|[\w.]+))/;
1737 }1737 }
1738 1738
1739 // To prevent double HTML-encoding we have to decode env.content first1739 // To prevent double HTML-encoding we have to decode env.content first
1740 env.content = env.content.replace(/&lt;/g, '<').replace(/&amp;/g, '&');1740 env.content = env.content.replace(/&lt;/g, '<').replace(/&amp;/g, '&');
1741 1741
1742 env.content = Prism.highlight(env.content, {1742 env.content = Prism.highlight(env.content, {
1743 'expression': {1743 'expression': {
1744 pattern: pattern,1744 pattern: pattern,
1745 lookbehind: true,1745 lookbehind: true,
1746 inside: Prism.languages.groovy1746 inside: Prism.languages.groovy
1747 }1747 }
1748 });1748 });
1749 1749
1750 env.classes.push(delimiter === '/' ? 'regex' : 'gstring');1750 env.classes.push(delimiter === '/' ? 'regex' : 'gstring');
1751 }1751 }
1752 }1752 }
1753});1753});
1754 1754
1755(function (Prism) {1755(function (Prism) {
1756 1756
1757 var keywords = /\b(?:abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while|var|null|exports|module|open|opens|provides|requires|to|transitive|uses|with)\b/;1757 var keywords = /\b(?:abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while|var|null|exports|module|open|opens|provides|requires|to|transitive|uses|with)\b/;
1758 1758
1759 // based on the java naming conventions1759 // based on the java naming conventions
1760 var className = /\b[A-Z](?:\w*[a-z]\w*)?\b/;1760 var className = /\b[A-Z](?:\w*[a-z]\w*)?\b/;
1761 1761
1762 Prism.languages.java = Prism.languages.extend('clike', {1762 Prism.languages.java = Prism.languages.extend('clike', {
1763 'class-name': [1763 'class-name': [
1764 className,1764 className,
1765 1765
1766 // variables and parameters1766 // variables and parameters
1767 // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)1767 // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
1768 /\b[A-Z]\w*(?=\s+\w+\s*[;,=())])/1768 /\b[A-Z]\w*(?=\s+\w+\s*[;,=())])/
1769 ],1769 ],
1770 'keyword': keywords,1770 'keyword': keywords,
1771 'function': [1771 'function': [
1772 Prism.languages.clike.function,1772 Prism.languages.clike.function,
1773 {1773 {
1774 pattern: /(\:\:)[a-z_]\w*/,1774 pattern: /(\:\:)[a-z_]\w*/,
1775 lookbehind: true1775 lookbehind: true
1776 }1776 }
1777 ],1777 ],
1778 'number': /\b0b[01][01_]*L?\b|\b0x[\da-f_]*\.?[\da-f_p+-]+\b|(?:\b\d[\d_]*\.?[\d_]*|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,1778 'number': /\b0b[01][01_]*L?\b|\b0x[\da-f_]*\.?[\da-f_p+-]+\b|(?:\b\d[\d_]*\.?[\d_]*|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
1779 'operator': {1779 'operator': {
1780 pattern: /(^|[^.])(?:<<=?|>>>?=?|->|([-+&|])\2|[?:~]|[-+*/%&|^!=<>]=?)/m,1780 pattern: /(^|[^.])(?:<<=?|>>>?=?|->|([-+&|])\2|[?:~]|[-+*/%&|^!=<>]=?)/m,
1781 lookbehind: true1781 lookbehind: true
1782 }1782 }
1783 });1783 });
1784 1784
1785 Prism.languages.insertBefore('java', 'class-name', {1785 Prism.languages.insertBefore('java', 'class-name', {
1786 'annotation': {1786 'annotation': {
1787 alias: 'punctuation',1787 alias: 'punctuation',
1788 pattern: /(^|[^.])@\w+/,1788 pattern: /(^|[^.])@\w+/,
1789 lookbehind: true1789 lookbehind: true
1790 },1790 },
1791 'namespace': {1791 'namespace': {
1792 pattern: /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)[a-z]\w*(\.[a-z]\w*)+/,1792 pattern: /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)[a-z]\w*(\.[a-z]\w*)+/,
1793 lookbehind: true,1793 lookbehind: true,
1794 inside: {1794 inside: {
1795 'punctuation': /\./,1795 'punctuation': /\./,
1796 }1796 }
1797 },1797 },
1798 'generics': {1798 'generics': {
1799 pattern: /<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,1799 pattern: /<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,
1800 inside: {1800 inside: {
1801 'class-name': className,1801 'class-name': className,
1802 'keyword': keywords,1802 'keyword': keywords,
1803 'punctuation': /[<>(),.:]/,1803 'punctuation': /[<>(),.:]/,
1804 'operator': /[?&|]/1804 'operator': /[?&|]/
1805 }1805 }
1806 }1806 }
1807 });1807 });
1808}(Prism));1808}(Prism));
1809 1809
1810/**1810/**
@@ -1820,779 +1820,779 @@ Prism.hooks.add('wrap', function(env) { · 9 unmodified lines
1820 * constant, delimiter, variable, function, package1820 * constant, delimiter, variable, function, package
1821 */1821 */
1822(function (Prism) {1822(function (Prism) {
1823 Prism.languages.php = Prism.languages.extend('clike', {1823 Prism.languages.php = Prism.languages.extend('clike', {
1824 'keyword': /\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|new|or|parent|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i,1824 'keyword': /\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|new|or|parent|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i,
1825 'boolean': {1825 'boolean': {
1826 pattern: /\b(?:false|true)\b/i,1826 pattern: /\b(?:false|true)\b/i,
1827 alias: 'constant'1827 alias: 'constant'
1828 },1828 },
1829 'constant': [1829 'constant': [
1830 /\b[A-Z_][A-Z0-9_]*\b/,1830 /\b[A-Z_][A-Z0-9_]*\b/,
1831 /\b(?:null)\b/i,1831 /\b(?:null)\b/i,
1832 ],1832 ],
1833 'comment': {1833 'comment': {
1834 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,1834 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
1835 lookbehind: true1835 lookbehind: true
1836 }1836 }
1837 });1837 });
1838 1838
1839 Prism.languages.insertBefore('php', 'string', {1839 Prism.languages.insertBefore('php', 'string', {
1840 'shell-comment': {1840 'shell-comment': {
1841 pattern: /(^|[^\\])#.*/,1841 pattern: /(^|[^\\])#.*/,
1842 lookbehind: true,1842 lookbehind: true,
1843 alias: 'comment'1843 alias: 'comment'
1844 }1844 }
1845 });1845 });
1846 1846
1847 Prism.languages.insertBefore('php', 'comment', {1847 Prism.languages.insertBefore('php', 'comment', {
1848 'delimiter': {1848 'delimiter': {
1849 pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,1849 pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
1850 alias: 'important'1850 alias: 'important'
1851 }1851 }
1852 });1852 });
1853 1853
1854 Prism.languages.insertBefore('php', 'keyword', {1854 Prism.languages.insertBefore('php', 'keyword', {
1855 'variable': /\$+(?:\w+\b|(?={))/i,1855 'variable': /\$+(?:\w+\b|(?={))/i,
1856 'package': {1856 'package': {
1857 pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,1857 pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,
1858 lookbehind: true,1858 lookbehind: true,
1859 inside: {1859 inside: {
1860 punctuation: /\\/1860 punctuation: /\\/
1861 }1861 }
1862 }1862 }
1863 });1863 });
1864 1864
1865 // Must be defined after the function pattern1865 // Must be defined after the function pattern
1866 Prism.languages.insertBefore('php', 'operator', {1866 Prism.languages.insertBefore('php', 'operator', {
1867 'property': {1867 'property': {
1868 pattern: /(->)[\w]+/,1868 pattern: /(->)[\w]+/,
1869 lookbehind: true1869 lookbehind: true
1870 }1870 }
1871 });1871 });
1872 1872
1873 var string_interpolation = {1873 var string_interpolation = {
1874 pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/,1874 pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/,
1875 lookbehind: true,1875 lookbehind: true,
1876 inside: {1876 inside: {
1877 rest: Prism.languages.php1877 rest: Prism.languages.php
1878 }1878 }
1879 };1879 };
1880 1880
1881 Prism.languages.insertBefore('php', 'string', {1881 Prism.languages.insertBefore('php', 'string', {
1882 'nowdoc-string': {1882 'nowdoc-string': {
1883 pattern: /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/,1883 pattern: /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/,
1884 greedy: true,1884 greedy: true,
1885 alias: 'string',1885 alias: 'string',
1886 inside: {1886 inside: {
1887 'delimiter': {1887 'delimiter': {
1888 pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,1888 pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
1889 alias: 'symbol',1889 alias: 'symbol',
1890 inside: {1890 inside: {
1891 'punctuation': /^<<<'?|[';]$/1891 'punctuation': /^<<<'?|[';]$/
1892 }1892 }
1893 }1893 }
1894 }1894 }
1895 },1895 },
1896 'heredoc-string': {1896 'heredoc-string': {
1897 pattern: /<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i,1897 pattern: /<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i,
1898 greedy: true,1898 greedy: true,
1899 alias: 'string',1899 alias: 'string',
1900 inside: {1900 inside: {
1901 'delimiter': {1901 'delimiter': {
1902 pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,1902 pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
1903 alias: 'symbol',1903 alias: 'symbol',
1904 inside: {1904 inside: {
1905 'punctuation': /^<<<"?|[";]$/1905 'punctuation': /^<<<"?|[";]$/
1906 }1906 }
1907 },1907 },
1908 'interpolation': string_interpolation // See below1908 'interpolation': string_interpolation // See below
1909 }1909 }
1910 },1910 },
1911 'single-quoted-string': {1911 'single-quoted-string': {
1912 pattern: /'(?:\\[\s\S]|[^\\'])*'/,1912 pattern: /'(?:\\[\s\S]|[^\\'])*'/,
1913 greedy: true,1913 greedy: true,
1914 alias: 'string'1914 alias: 'string'
1915 },1915 },
1916 'double-quoted-string': {1916 'double-quoted-string': {
1917 pattern: /"(?:\\[\s\S]|[^\\"])*"/,1917 pattern: /"(?:\\[\s\S]|[^\\"])*"/,
1918 greedy: true,1918 greedy: true,
1919 alias: 'string',1919 alias: 'string',
1920 inside: {1920 inside: {
1921 'interpolation': string_interpolation // See below1921 'interpolation': string_interpolation // See below
1922 }1922 }
1923 }1923 }
1924 });1924 });
1925 // The different types of PHP strings "replace" the C-like standard string1925 // The different types of PHP strings "replace" the C-like standard string
1926 delete Prism.languages.php['string'];1926 delete Prism.languages.php['string'];
1927 1927
1928 Prism.hooks.add('before-tokenize', function(env) {1928 Prism.hooks.add('before-tokenize', function(env) {
1929 if (!/<\?/.test(env.code)) {1929 if (!/<\?/.test(env.code)) {
1930 return;1930 return;
1931 }1931 }
1932 1932
1933 var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#)(?:[^?\n\r]|\?(?!>))*|\/\*[\s\S]*?(?:\*\/|$))*?(?:\?>|$)/ig;1933 var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#)(?:[^?\n\r]|\?(?!>))*|\/\*[\s\S]*?(?:\*\/|$))*?(?:\?>|$)/ig;
1934 Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);1934 Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);
1935 });1935 });
1936 1936
1937 Prism.hooks.add('after-tokenize', function(env) {1937 Prism.hooks.add('after-tokenize', function(env) {
1938 Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');1938 Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');
1939 });1939 });
1940 1940
1941}(Prism));1941}(Prism));
1942 1942
1943Prism.languages.json = {1943Prism.languages.json = {
1944 'property': {1944 'property': {
1945 pattern: /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,1945 pattern: /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
1946 greedy: true1946 greedy: true
1947 },1947 },
1948 'string': {1948 'string': {
1949 pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,1949 pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
1950 greedy: true1950 greedy: true
1951 },1951 },
1952 'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,1952 'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
1953 'number': /-?\d+\.?\d*(e[+-]?\d+)?/i,1953 'number': /-?\d+\.?\d*(e[+-]?\d+)?/i,
1954 'punctuation': /[{}[\],]/,1954 'punctuation': /[{}[\],]/,
1955 'operator': /:/,1955 'operator': /:/,
1956 'boolean': /\b(?:true|false)\b/,1956 'boolean': /\b(?:true|false)\b/,
1957 'null': {1957 'null': {
1958 pattern: /\bnull\b/,1958 pattern: /\bnull\b/,
1959 alias: 'keyword'1959 alias: 'keyword'
1960 }1960 }
1961};1961};
1962 1962
1963Prism.languages.julia= {1963Prism.languages.julia= {
1964 'comment': {1964 'comment': {
1965 pattern: /(^|[^\\])#.*/,1965 pattern: /(^|[^\\])#.*/,
1966 lookbehind: true1966 lookbehind: true
1967 },1967 },
1968 'string': /("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2/,1968 'string': /("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2/,
1969 'keyword' : /\b(?:abstract|baremodule|begin|bitstype|break|catch|ccall|const|continue|do|else|elseif|end|export|finally|for|function|global|if|immutable|import|importall|in|let|local|macro|module|print|println|quote|return|struct|try|type|typealias|using|while)\b/,1969 'keyword' : /\b(?:abstract|baremodule|begin|bitstype|break|catch|ccall|const|continue|do|else|elseif|end|export|finally|for|function|global|if|immutable|import|importall|in|let|local|macro|module|print|println|quote|return|struct|try|type|typealias|using|while)\b/,
1970 'boolean' : /\b(?:true|false)\b/,1970 'boolean' : /\b(?:true|false)\b/,
1971 'number' : /(?:\b(?=\d)|\B(?=\.))(?:0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:[efp][+-]?\d+)?j?/i,1971 'number' : /(?:\b(?=\d)|\B(?=\.))(?:0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:[efp][+-]?\d+)?j?/i,
1972 'operator': /[-+*^%÷&$\\]=?|\/[\/=]?|!=?=?|\|[=>]?|<(?:<=?|[=:])?|>(?:=|>>?=?)?|==?=?|[~≠≤≥]/,1972 'operator': /[-+*^%÷&$\\]=?|\/[\/=]?|!=?=?|\|[=>]?|<(?:<=?|[=:])?|>(?:=|>>?=?)?|==?=?|[~≠≤≥]/,
1973 'punctuation' : /[{}[\];(),.:]/,1973 'punctuation' : /[{}[\];(),.:]/,
1974 'constant': /\b(?:(?:NaN|Inf)(?:16|32|64)?)\b/1974 'constant': /\b(?:(?:NaN|Inf)(?:16|32|64)?)\b/
1975};1975};
1976 1976
1977(function (Prism) {1977(function (Prism) {
1978 Prism.languages.kotlin = Prism.languages.extend('clike', {1978 Prism.languages.kotlin = Prism.languages.extend('clike', {
1979 'keyword': {1979 'keyword': {
1980 // The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get1980 // The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get
1981 pattern: /(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,1981 pattern: /(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,
1982 lookbehind: true1982 lookbehind: true
1983 },1983 },
1984 'function': [1984 'function': [
1985 /\w+(?=\s*\()/,1985 /\w+(?=\s*\()/,
1986 {1986 {
1987 pattern: /(\.)\w+(?=\s*\{)/,1987 pattern: /(\.)\w+(?=\s*\{)/,
1988 lookbehind: true1988 lookbehind: true
1989 }1989 }
1990 ],1990 ],
1991 'number': /\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,1991 'number': /\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,
1992 'operator': /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/1992 'operator': /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/
1993 });1993 });
1994 1994
1995 delete Prism.languages.kotlin["class-name"];1995 delete Prism.languages.kotlin["class-name"];
1996 1996
1997 Prism.languages.insertBefore('kotlin', 'string', {1997 Prism.languages.insertBefore('kotlin', 'string', {
1998 'raw-string': {1998 'raw-string': {
1999 pattern: /("""|''')[\s\S]*?\1/,1999 pattern: /("""|''')[\s\S]*?\1/,
2000 alias: 'string'2000 alias: 'string'
2001 // See interpolation below2001 // See interpolation below
2002 }2002 }
2003 });2003 });
2004 Prism.languages.insertBefore('kotlin', 'keyword', {2004 Prism.languages.insertBefore('kotlin', 'keyword', {
2005 'annotation': {2005 'annotation': {
2006 pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,2006 pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,
2007 alias: 'builtin'2007 alias: 'builtin'
2008 }2008 }
2009 });2009 });
2010 Prism.languages.insertBefore('kotlin', 'function', {2010 Prism.languages.insertBefore('kotlin', 'function', {
2011 'label': {2011 'label': {
2012 pattern: /\w+@|@\w+/,2012 pattern: /\w+@|@\w+/,
2013 alias: 'symbol'2013 alias: 'symbol'
2014 }2014 }
2015 });2015 });
2016 2016
2017 var interpolation = [2017 var interpolation = [
2018 {2018 {
2019 pattern: /\$\{[^}]+\}/,2019 pattern: /\$\{[^}]+\}/,
2020 inside: {2020 inside: {
2021 delimiter: {2021 delimiter: {
2022 pattern: /^\$\{|\}$/,2022 pattern: /^\$\{|\}$/,
2023 alias: 'variable'2023 alias: 'variable'
2024 },2024 },
2025 rest: Prism.languages.kotlin2025 rest: Prism.languages.kotlin
2026 }2026 }
2027 },2027 },
2028 {2028 {
2029 pattern: /\$\w+/,2029 pattern: /\$\w+/,
2030 alias: 'variable'2030 alias: 'variable'
2031 }2031 }
2032 ];2032 ];
2033 2033
2034 Prism.languages.kotlin['string'].inside = Prism.languages.kotlin['raw-string'].inside = {2034 Prism.languages.kotlin['string'].inside = Prism.languages.kotlin['raw-string'].inside = {
2035 interpolation: interpolation2035 interpolation: interpolation
2036 };2036 };
2037 2037
2038}(Prism));2038}(Prism));
2039 2039
2040(function(Prism) {2040(function(Prism) {
2041 Prism.languages.crystal = Prism.languages.extend('ruby', {2041 Prism.languages.crystal = Prism.languages.extend('ruby', {
2042 keyword: [2042 keyword: [
2043 /\b(?:abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|select|self|sizeof|struct|super|then|type|typeof|uninitialized|union|unless|until|when|while|with|yield|__DIR__|__END_LINE__|__FILE__|__LINE__)\b/,2043 /\b(?:abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|select|self|sizeof|struct|super|then|type|typeof|uninitialized|union|unless|until|when|while|with|yield|__DIR__|__END_LINE__|__FILE__|__LINE__)\b/,
2044 {2044 {
2045 pattern: /(\.\s*)(?:is_a|responds_to)\?/,2045 pattern: /(\.\s*)(?:is_a|responds_to)\?/,
2046 lookbehind: true2046 lookbehind: true
2047 }2047 }
2048 ],2048 ],
2049 2049
2050 number: /\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[\da-fA-F_]*[\da-fA-F]|(?:\d(?:[\d_]*\d)?)(?:\.[\d_]*\d)?(?:[eE][+-]?[\d_]*\d)?)(?:_(?:[uif](?:8|16|32|64))?)?\b/2050 number: /\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[\da-fA-F_]*[\da-fA-F]|(?:\d(?:[\d_]*\d)?)(?:\.[\d_]*\d)?(?:[eE][+-]?[\d_]*\d)?)(?:_(?:[uif](?:8|16|32|64))?)?\b/
2051 });2051 });
2052 2052
2053 Prism.languages.insertBefore('crystal', 'string', {2053 Prism.languages.insertBefore('crystal', 'string', {
2054 attribute: {2054 attribute: {
2055 pattern: /@\[.+?\]/,2055 pattern: /@\[.+?\]/,
2056 alias: 'attr-name',2056 alias: 'attr-name',
2057 inside: {2057 inside: {
2058 delimiter: {2058 delimiter: {
2059 pattern: /^@\[|\]$/,2059 pattern: /^@\[|\]$/,
2060 alias: 'tag'2060 alias: 'tag'
2061 },2061 },
2062 rest: Prism.languages.crystal2062 rest: Prism.languages.crystal
2063 }2063 }
2064 },2064 },
2065 2065
2066 expansion: [2066 expansion: [
2067 {2067 {
2068 pattern: /\{\{.+?\}\}/,2068 pattern: /\{\{.+?\}\}/,
2069 inside: {2069 inside: {
2070 delimiter: {2070 delimiter: {
2071 pattern: /^\{\{|\}\}$/,2071 pattern: /^\{\{|\}\}$/,
2072 alias: 'tag'2072 alias: 'tag'
2073 },2073 },
2074 rest: Prism.languages.crystal2074 rest: Prism.languages.crystal
2075 }2075 }
2076 },2076 },
2077 {2077 {
2078 pattern: /\{%.+?%\}/,2078 pattern: /\{%.+?%\}/,
2079 inside: {2079 inside: {
2080 delimiter: {2080 delimiter: {
2081 pattern: /^\{%|%\}$/,2081 pattern: /^\{%|%\}$/,
2082 alias: 'tag'2082 alias: 'tag'
2083 },2083 },
2084 rest: Prism.languages.crystal2084 rest: Prism.languages.crystal
2085 }2085 }
2086 }2086 }
2087 ]2087 ]
2088 });2088 });
2089 2089
2090}(Prism));2090}(Prism));
2091 2091
2092Prism.languages.lua = {2092Prism.languages.lua = {
2093 'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,2093 'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,
2094 // \z may be used to skip the following space2094 // \z may be used to skip the following space
2095 'string': {2095 'string': {
2096 pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[\s\S]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,2096 pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[\s\S]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,
2097 greedy: true2097 greedy: true
2098 },2098 },
2099 'number': /\b0x[a-f\d]+\.?[a-f\d]*(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|\.?\d*(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,2099 'number': /\b0x[a-f\d]+\.?[a-f\d]*(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|\.?\d*(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,
2100 'keyword': /\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,2100 'keyword': /\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,
2101 'function': /(?!\d)\w+(?=\s*(?:[({]))/,2101 'function': /(?!\d)\w+(?=\s*(?:[({]))/,
2102 'operator': [2102 'operator': [
2103 /[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,2103 /[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,
2104 {2104 {
2105 // Match ".." but don't break "..."2105 // Match ".." but don't break "..."
2106 pattern: /(^|[^.])\.\.(?!\.)/,2106 pattern: /(^|[^.])\.\.(?!\.)/,
2107 lookbehind: true2107 lookbehind: true
2108 }2108 }
2109 ],2109 ],
2110 'punctuation': /[\[\](){},;]|\.+|:+/2110 'punctuation': /[\[\](){},;]|\.+|:+/
2111};2111};
2112// Django/Jinja2 syntax definition for Prism.js <http://prismjs.com> syntax highlighter.2112// Django/Jinja2 syntax definition for Prism.js <http://prismjs.com> syntax highlighter.
2113// Mostly it works OK but can paint code incorrectly on complex html/template tag combinations.2113// Mostly it works OK but can paint code incorrectly on complex html/template tag combinations.
2114 2114
2115(function (Prism) {2115(function (Prism) {
2116 2116
2117 Prism.languages.django = {2117 Prism.languages.django = {
2118 'comment': /^{#[\s\S]*?#}$/,2118 'comment': /^{#[\s\S]*?#}$/,
2119 'tag': {2119 'tag': {
2120 pattern: /(^{%[+-]?\s*)\w+/,2120 pattern: /(^{%[+-]?\s*)\w+/,
2121 lookbehind: true,2121 lookbehind: true,
2122 alias: 'keyword'2122 alias: 'keyword'
2123 },2123 },
2124 'delimiter': {2124 'delimiter': {
2125 pattern: /^{[{%][+-]?|[+-]?[}%]}$/,2125 pattern: /^{[{%][+-]?|[+-]?[}%]}$/,
2126 alias: 'punctuation'2126 alias: 'punctuation'
2127 },2127 },
2128 'string': {2128 'string': {
2129 pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,2129 pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
2130 greedy: true2130 greedy: true
2131 },2131 },
2132 'filter': {2132 'filter': {
2133 pattern: /(\|)\w+/,2133 pattern: /(\|)\w+/,
2134 lookbehind: true,2134 lookbehind: true,
2135 alias: 'function'2135 alias: 'function'
2136 },2136 },
2137 'test': {2137 'test': {
2138 pattern: /(\bis\s+(?:not\s+)?)(?!not\b)\w+/,2138 pattern: /(\bis\s+(?:not\s+)?)(?!not\b)\w+/,
2139 lookbehind: true,2139 lookbehind: true,
2140 alias: 'function'2140 alias: 'function'
2141 },2141 },
2142 'function': /\b[a-z_]\w+(?=\s*\()/i,2142 'function': /\b[a-z_]\w+(?=\s*\()/i,
2143 'keyword': /\b(?:and|as|by|else|for|if|import|in|is|loop|not|or|recursive|with|without)\b/,2143 'keyword': /\b(?:and|as|by|else|for|if|import|in|is|loop|not|or|recursive|with|without)\b/,
2144 'operator': /[-+*/%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,2144 'operator': /[-+*/%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
2145 'number': /\b\d+(?:\.\d+)?\b/,2145 'number': /\b\d+(?:\.\d+)?\b/,
2146 'boolean': /[Tt]rue|[Ff]alse|[Nn]one/,2146 'boolean': /[Tt]rue|[Ff]alse|[Nn]one/,
2147 'variable': /\b\w+?\b/,2147 'variable': /\b\w+?\b/,
2148 'punctuation': /[{}[\](),.:;]/2148 'punctuation': /[{}[\](),.:;]/
2149 };2149 };
2150 2150
2151 2151
2152 var pattern = /{{[\s\S]*?}}|{%[\s\S]*?%}|{#[\s\S]*?#}/g;2152 var pattern = /{{[\s\S]*?}}|{%[\s\S]*?%}|{#[\s\S]*?#}/g;
2153 var markupTemplating = Prism.languages['markup-templating'];2153 var markupTemplating = Prism.languages['markup-templating'];
2154 2154
2155 Prism.hooks.add('before-tokenize', function (env) {2155 Prism.hooks.add('before-tokenize', function (env) {
2156 markupTemplating.buildPlaceholders(env, 'django', pattern);2156 markupTemplating.buildPlaceholders(env, 'django', pattern);
2157 });2157 });
2158 Prism.hooks.add('after-tokenize', function (env) {2158 Prism.hooks.add('after-tokenize', function (env) {
2159 markupTemplating.tokenizePlaceholders(env, 'django');2159 markupTemplating.tokenizePlaceholders(env, 'django');
2160 });2160 });
2161 2161
2162 // Add an Jinja2 alias2162 // Add an Jinja2 alias
2163 Prism.languages.jinja2 = Prism.languages.django;2163 Prism.languages.jinja2 = Prism.languages.django;
2164 Prism.hooks.add('before-tokenize', function (env) {2164 Prism.hooks.add('before-tokenize', function (env) {
2165 markupTemplating.buildPlaceholders(env, 'jinja2', pattern);2165 markupTemplating.buildPlaceholders(env, 'jinja2', pattern);
2166 });2166 });
2167 Prism.hooks.add('after-tokenize', function (env) {2167 Prism.hooks.add('after-tokenize', function (env) {
2168 markupTemplating.tokenizePlaceholders(env, 'jinja2');2168 markupTemplating.tokenizePlaceholders(env, 'jinja2');
2169 });2169 });
2170 2170
2171})(Prism);2171})(Prism);
2172 2172
2173Prism.languages.matlab = {2173Prism.languages.matlab = {
2174 'comment': [2174 'comment': [
2175 /%\{[\s\S]*?\}%/,2175 /%\{[\s\S]*?\}%/,
2176 /%.+/2176 /%.+/
2177 ],2177 ],
2178 'string': {2178 'string': {
2179 pattern: /\B'(?:''|[^'\r\n])*'/,2179 pattern: /\B'(?:''|[^'\r\n])*'/,
2180 greedy: true2180 greedy: true
2181 },2181 },
2182 // FIXME We could handle imaginary numbers as a whole2182 // FIXME We could handle imaginary numbers as a whole
2183 'number': /(?:\b\d+\.?\d*|\B\.\d+)(?:[eE][+-]?\d+)?(?:[ij])?|\b[ij]\b/,2183 'number': /(?:\b\d+\.?\d*|\B\.\d+)(?:[eE][+-]?\d+)?(?:[ij])?|\b[ij]\b/,
2184 'keyword': /\b(?:break|case|catch|continue|else|elseif|end|for|function|if|inf|NaN|otherwise|parfor|pause|pi|return|switch|try|while)\b/,2184 'keyword': /\b(?:break|case|catch|continue|else|elseif|end|for|function|if|inf|NaN|otherwise|parfor|pause|pi|return|switch|try|while)\b/,
2185 'function': /(?!\d)\w+(?=\s*\()/,2185 'function': /(?!\d)\w+(?=\s*\()/,
2186 'operator': /\.?[*^\/\\']|[+\-:@]|[<>=~]=?|&&?|\|\|?/,2186 'operator': /\.?[*^\/\\']|[+\-:@]|[<>=~]=?|&&?|\|\|?/,
2187 'punctuation': /\.{3}|[.,;\[\](){}!]/2187 'punctuation': /\.{3}|[.,;\[\](){}!]/
2188};2188};
2189Prism.languages.typescript = Prism.languages.extend('javascript', {2189Prism.languages.typescript = Prism.languages.extend('javascript', {
2190 // From JavaScript Prism keyword list and TypeScript language spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#221-reserved-words2190 // From JavaScript Prism keyword list and TypeScript language spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#221-reserved-words
2191 'keyword': /\b(?:abstract|as|async|await|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|is|keyof|let|module|namespace|new|null|of|package|private|protected|public|readonly|return|require|set|static|super|switch|this|throw|try|type|typeof|var|void|while|with|yield)\b/,2191 'keyword': /\b(?:abstract|as|async|await|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|is|keyof|let|module|namespace|new|null|of|package|private|protected|public|readonly|return|require|set|static|super|switch|this|throw|try|type|typeof|var|void|while|with|yield)\b/,
2192 'builtin': /\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/,2192 'builtin': /\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/,
2193});2193});
2194 2194
2195Prism.languages.ts = Prism.languages.typescript;2195Prism.languages.ts = Prism.languages.typescript;
2196 2196
2197Prism.languages.nginx = Prism.languages.extend('clike', {2197Prism.languages.nginx = Prism.languages.extend('clike', {
2198 'comment': {2198 'comment': {
2199 pattern: /(^|[^"{\\])#.*/,2199 pattern: /(^|[^"{\\])#.*/,
2200 lookbehind: true2200 lookbehind: true
2201 },2201 },
2202 'keyword': /\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|events|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types|ssl_session_tickets|ssl_stapling|ssl_stapling_verify|ssl_ecdh_curve|ssl_trusted_certificate|more_set_headers|ssl_early_data)\b/i2202 'keyword': /\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|events|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types|ssl_session_tickets|ssl_stapling|ssl_stapling_verify|ssl_ecdh_curve|ssl_trusted_certificate|more_set_headers|ssl_early_data)\b/i
2203});2203});
2204 2204
2205Prism.languages.insertBefore('nginx', 'keyword', {2205Prism.languages.insertBefore('nginx', 'keyword', {
2206 'variable': /\$[a-z_]+/i2206 'variable': /\$[a-z_]+/i
2207});2207});
2208 2208
2209Prism.languages.nim = {2209Prism.languages.nim = {
2210 'comment': /#.*/,2210 'comment': /#.*/,
2211 // Double-quoted strings can be prefixed by an identifier (Generalized raw string literals)2211 // Double-quoted strings can be prefixed by an identifier (Generalized raw string literals)
2212 // Character literals are handled specifically to prevent issues with numeric type suffixes2212 // Character literals are handled specifically to prevent issues with numeric type suffixes
2213 'string': {2213 'string': {
2214 pattern: /(?:(?:\b(?!\d)(?:\w|\\x[8-9a-fA-F][0-9a-fA-F])+)?(?:"""[\s\S]*?"""(?!")|"(?:\\[\s\S]|""|[^"\\])*")|'(?:\\(?:\d+|x[\da-fA-F]{2}|.)|[^'])')/,2214 pattern: /(?:(?:\b(?!\d)(?:\w|\\x[8-9a-fA-F][0-9a-fA-F])+)?(?:"""[\s\S]*?"""(?!")|"(?:\\[\s\S]|""|[^"\\])*")|'(?:\\(?:\d+|x[\da-fA-F]{2}|.)|[^'])')/,
2215 greedy: true2215 greedy: true
2216 },2216 },
2217 // The negative look ahead prevents wrong highlighting of the .. operator2217 // The negative look ahead prevents wrong highlighting of the .. operator
2218 'number': /\b(?:0[xXoObB][\da-fA-F_]+|\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)(?:'?[iuf]\d*)?/,2218 'number': /\b(?:0[xXoObB][\da-fA-F_]+|\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)(?:'?[iuf]\d*)?/,
2219 'keyword': /\b(?:addr|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|include|interface|iterator|let|macro|method|mixin|nil|object|out|proc|ptr|raise|ref|return|static|template|try|tuple|type|using|var|when|while|with|without|yield)\b/,2219 'keyword': /\b(?:addr|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|include|interface|iterator|let|macro|method|mixin|nil|object|out|proc|ptr|raise|ref|return|static|template|try|tuple|type|using|var|when|while|with|without|yield)\b/,
2220 'function': {2220 'function': {
2221 pattern: /(?:(?!\d)(?:\w|\\x[8-9a-fA-F][0-9a-fA-F])+|`[^`\r\n]+`)\*?(?:\[[^\]]+\])?(?=\s*\()/,2221 pattern: /(?:(?!\d)(?:\w|\\x[8-9a-fA-F][0-9a-fA-F])+|`[^`\r\n]+`)\*?(?:\[[^\]]+\])?(?=\s*\()/,
2222 inside: {2222 inside: {
2223 'operator': /\*$/2223 'operator': /\*$/
2224 }2224 }
2225 },2225 },
2226 // We don't want to highlight operators inside backticks2226 // We don't want to highlight operators inside backticks
2227 'ignore': {2227 'ignore': {
2228 pattern: /`[^`\r\n]+`/,2228 pattern: /`[^`\r\n]+`/,
2229 inside: {2229 inside: {
2230 'punctuation': /`/2230 'punctuation': /`/
2231 }2231 }
2232 },2232 },
2233 'operator': {2233 'operator': {
2234 // Look behind and look ahead prevent wrong highlighting of punctuations [. .] {. .} (. .)2234 // Look behind and look ahead prevent wrong highlighting of punctuations [. .] {. .} (. .)
2235 // but allow the slice operator .. to take precedence over them2235 // but allow the slice operator .. to take precedence over them
2236 // One can define his own operators in Nim so all combination of operators might be an operator.2236 // One can define his own operators in Nim so all combination of operators might be an operator.
2237 pattern: /(^|[({\[](?=\.\.)|(?![({\[]\.).)(?:(?:[=+\-*\/<>@$~&%|!?^:\\]|\.\.|\.(?![)}\]]))+|\b(?:and|div|of|or|in|is|isnot|mod|not|notin|shl|shr|xor)\b)/m,2237 pattern: /(^|[({\[](?=\.\.)|(?![({\[]\.).)(?:(?:[=+\-*\/<>@$~&%|!?^:\\]|\.\.|\.(?![)}\]]))+|\b(?:and|div|of|or|in|is|isnot|mod|not|notin|shl|shr|xor)\b)/m,
2238 lookbehind: true2238 lookbehind: true
2239 },2239 },
2240 'punctuation': /[({\[]\.|\.[)}\]]|[`(){}\[\],:]/2240 'punctuation': /[({\[]\.|\.[)}\]]|[`(){}\[\],:]/
2241};2241};
2242Prism.languages.perl = {2242Prism.languages.perl = {
2243 'comment': [2243 'comment': [
2244 {2244 {
2245 // POD2245 // POD
2246 pattern: /(^\s*)=\w+[\s\S]*?=cut.*/m,2246 pattern: /(^\s*)=\w+[\s\S]*?=cut.*/m,
2247 lookbehind: true2247 lookbehind: true
2248 },2248 },
2249 {2249 {
2250 pattern: /(^|[^\\$])#.*/,2250 pattern: /(^|[^\\$])#.*/,
2251 lookbehind: true2251 lookbehind: true
2252 }2252 }
2253 ],2253 ],
2254 // TODO Could be nice to handle Heredoc too.2254 // TODO Could be nice to handle Heredoc too.
2255 'string': [2255 'string': [
2256 // q/.../2256 // q/.../
2257 {2257 {
2258 pattern: /\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/,2258 pattern: /\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/,
2259 greedy: true2259 greedy: true
2260 },2260 },
2261 2261
2262 // q a...a2262 // q a...a
2263 {2263 {
2264 pattern: /\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1/,2264 pattern: /\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1/,
2265 greedy: true2265 greedy: true
2266 },2266 },
2267 2267
2268 // q(...)2268 // q(...)
2269 {2269 {
2270 pattern: /\b(?:q|qq|qx|qw)\s*\((?:[^()\\]|\\[\s\S])*\)/,2270 pattern: /\b(?:q|qq|qx|qw)\s*\((?:[^()\\]|\\[\s\S])*\)/,
2271 greedy: true2271 greedy: true
2272 },2272 },
2273 2273
2274 // q{...}2274 // q{...}
2275 {2275 {
2276 pattern: /\b(?:q|qq|qx|qw)\s*\{(?:[^{}\\]|\\[\s\S])*\}/,2276 pattern: /\b(?:q|qq|qx|qw)\s*\{(?:[^{}\\]|\\[\s\S])*\}/,
2277 greedy: true2277 greedy: true
2278 },2278 },
2279 2279
2280 // q[...]2280 // q[...]
2281 {2281 {
2282 pattern: /\b(?:q|qq|qx|qw)\s*\[(?:[^[\]\\]|\\[\s\S])*\]/,2282 pattern: /\b(?:q|qq|qx|qw)\s*\[(?:[^[\]\\]|\\[\s\S])*\]/,
2283 greedy: true2283 greedy: true
2284 },2284 },
2285 2285
2286 // q<...>2286 // q<...>
2287 {2287 {
2288 pattern: /\b(?:q|qq|qx|qw)\s*<(?:[^<>\\]|\\[\s\S])*>/,2288 pattern: /\b(?:q|qq|qx|qw)\s*<(?:[^<>\\]|\\[\s\S])*>/,
2289 greedy: true2289 greedy: true
2290 },2290 },
2291 2291
2292 // "...", `...`2292 // "...", `...`
2293 {2293 {
2294 pattern: /("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,2294 pattern: /("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,
2295 greedy: true2295 greedy: true
2296 },2296 },
2297 2297
2298 // '...'2298 // '...'
2299 // FIXME Multi-line single-quoted strings are not supported as they would break variables containing '2299 // FIXME Multi-line single-quoted strings are not supported as they would break variables containing '
2300 {2300 {
2301 pattern: /'(?:[^'\\\r\n]|\\.)*'/,2301 pattern: /'(?:[^'\\\r\n]|\\.)*'/,
2302 greedy: true2302 greedy: true
2303 }2303 }
2304 ],2304 ],
2305 'regex': [2305 'regex': [
2306 // m/.../2306 // m/.../
2307 {2307 {
2308 pattern: /\b(?:m|qr)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/,2308 pattern: /\b(?:m|qr)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/,
2309 greedy: true2309 greedy: true
2310 },2310 },
2311 2311
2312 // m a...a2312 // m a...a
2313 {2313 {
2314 pattern: /\b(?:m|qr)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/,2314 pattern: /\b(?:m|qr)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/,
2315 greedy: true2315 greedy: true
2316 },2316 },
2317 2317
2318 // m(...)2318 // m(...)
2319 {2319 {
2320 pattern: /\b(?:m|qr)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngc]*/,2320 pattern: /\b(?:m|qr)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngc]*/,
2321 greedy: true2321 greedy: true
2322 },2322 },
2323 2323
2324 // m{...}2324 // m{...}
2325 {2325 {
2326 pattern: /\b(?:m|qr)\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngc]*/,2326 pattern: /\b(?:m|qr)\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngc]*/,
2327 greedy: true2327 greedy: true
2328 },2328 },
2329 2329
2330 // m[...]2330 // m[...]
2331 {2331 {
2332 pattern: /\b(?:m|qr)\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngc]*/,2332 pattern: /\b(?:m|qr)\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngc]*/,
2333 greedy: true2333 greedy: true
2334 },2334 },
2335 2335
2336 // m<...>2336 // m<...>
2337 {2337 {
2338 pattern: /\b(?:m|qr)\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngc]*/,2338 pattern: /\b(?:m|qr)\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngc]*/,
2339 greedy: true2339 greedy: true
2340 },2340 },
2341 2341
2342 // The lookbehinds prevent -s from breaking2342 // The lookbehinds prevent -s from breaking
2343 // FIXME We don't handle change of separator like s(...)[...]2343 // FIXME We don't handle change of separator like s(...)[...]
2344 // s/.../.../2344 // s/.../.../
2345 {2345 {
2346 pattern: /(^|[^-]\b)(?:s|tr|y)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2[msixpodualngcer]*/,2346 pattern: /(^|[^-]\b)(?:s|tr|y)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2[msixpodualngcer]*/,
2347 lookbehind: true,2347 lookbehind: true,
2348 greedy: true2348 greedy: true
2349 },2349 },
2350 2350
2351 // s a...a...a2351 // s a...a...a
2352 {2352 {
2353 pattern: /(^|[^-]\b)(?:s|tr|y)\s+([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2[msixpodualngcer]*/,2353 pattern: /(^|[^-]\b)(?:s|tr|y)\s+([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2[msixpodualngcer]*/,
2354 lookbehind: true,2354 lookbehind: true,
2355 greedy: true2355 greedy: true
2356 },2356 },
2357 2357
2358 // s(...)(...)2358 // s(...)(...)
2359 {2359 {
2360 pattern: /(^|[^-]\b)(?:s|tr|y)\s*\((?:[^()\\]|\\[\s\S])*\)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngcer]*/,2360 pattern: /(^|[^-]\b)(?:s|tr|y)\s*\((?:[^()\\]|\\[\s\S])*\)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngcer]*/,
2361 lookbehind: true,2361 lookbehind: true,
2362 greedy: true2362 greedy: true
2363 },2363 },
2364 2364
2365 // s{...}{...}2365 // s{...}{...}
2366 {2366 {
2367 pattern: /(^|[^-]\b)(?:s|tr|y)\s*\{(?:[^{}\\]|\\[\s\S])*\}\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngcer]*/,2367 pattern: /(^|[^-]\b)(?:s|tr|y)\s*\{(?:[^{}\\]|\\[\s\S])*\}\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngcer]*/,
2368 lookbehind: true,2368 lookbehind: true,
2369 greedy: true2369 greedy: true
2370 },2370 },
2371 2371
2372 // s[...][...]2372 // s[...][...]
2373 {2373 {
2374 pattern: /(^|[^-]\b)(?:s|tr|y)\s*\[(?:[^[\]\\]|\\[\s\S])*\]\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngcer]*/,2374 pattern: /(^|[^-]\b)(?:s|tr|y)\s*\[(?:[^[\]\\]|\\[\s\S])*\]\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngcer]*/,
2375 lookbehind: true,2375 lookbehind: true,
2376 greedy: true2376 greedy: true
2377 },2377 },
2378 2378
2379 // s<...><...>2379 // s<...><...>
2380 {2380 {
2381 pattern: /(^|[^-]\b)(?:s|tr|y)\s*<(?:[^<>\\]|\\[\s\S])*>\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngcer]*/,2381 pattern: /(^|[^-]\b)(?:s|tr|y)\s*<(?:[^<>\\]|\\[\s\S])*>\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngcer]*/,
2382 lookbehind: true,2382 lookbehind: true,
2383 greedy: true2383 greedy: true
2384 },2384 },
2385 2385
2386 // /.../2386 // /.../
2387 // The look-ahead tries to prevent two divisions on2387 // The look-ahead tries to prevent two divisions on
2388 // the same line from being highlighted as regex.2388 // the same line from being highlighted as regex.
2389 // This does not support multi-line regex.2389 // This does not support multi-line regex.
2390 {2390 {
2391 pattern: /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/,2391 pattern: /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/,
2392 greedy: true2392 greedy: true
2393 }2393 }
2394 ],2394 ],
2395 2395
2396 // FIXME Not sure about the handling of ::, ', and #2396 // FIXME Not sure about the handling of ::, ', and #
2397 'variable': [2397 'variable': [
2398 // ${^POSTMATCH}2398 // ${^POSTMATCH}
2399 /[&*$@%]\{\^[A-Z]+\}/,2399 /[&*$@%]\{\^[A-Z]+\}/,
2400 // $^V2400 // $^V
2401 /[&*$@%]\^[A-Z_]/,2401 /[&*$@%]\^[A-Z_]/,
2402 // ${...}2402 // ${...}
2403 /[&*$@%]#?(?=\{)/,2403 /[&*$@%]#?(?=\{)/,
2404 // $foo2404 // $foo
2405 /[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+)+(?:::)*/i,2405 /[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+)+(?:::)*/i,
2406 // $12406 // $1
2407 /[&*$@%]\d+/,2407 /[&*$@%]\d+/,
2408 // $_, @_, %!2408 // $_, @_, %!
2409 // The negative lookahead prevents from breaking the %= operator2409 // The negative lookahead prevents from breaking the %= operator
2410 /(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/2410 /(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/
2411 ],2411 ],
2412 'filehandle': {2412 'filehandle': {
2413 // <>, <FOO>, _2413 // <>, <FOO>, _
2414 pattern: /<(?![<=])\S*>|\b_\b/,2414 pattern: /<(?![<=])\S*>|\b_\b/,
2415 alias: 'symbol'2415 alias: 'symbol'
2416 },2416 },
2417 'vstring': {2417 'vstring': {
2418 // v1.2, 1.2.32418 // v1.2, 1.2.3
2419 pattern: /v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,2419 pattern: /v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,
2420 alias: 'string'2420 alias: 'string'
2421 },2421 },
2422 'function': {2422 'function': {
2423 pattern: /sub [a-z0-9_]+/i,2423 pattern: /sub [a-z0-9_]+/i,
2424 inside: {2424 inside: {
2425 keyword: /sub/2425 keyword: /sub/
2426 }2426 }
2427 },2427 },
2428 'keyword': /\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,2428 'keyword': /\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,
2429 'number': /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:\d(?:_?\d)*)?\.?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,2429 'number': /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:\d(?:_?\d)*)?\.?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,
2430 'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:lt|gt|le|ge|eq|ne|cmp|not|and|or|xor)\b/,2430 'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:lt|gt|le|ge|eq|ne|cmp|not|and|or|xor)\b/,
2431 'punctuation': /[{}[\];(),:]/2431 'punctuation': /[{}[\];(),:]/
2432};2432};
2433 2433
2434Prism.languages.sql = {2434Prism.languages.sql = {
2435 'comment': {2435 'comment': {
2436 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,2436 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
2437 lookbehind: true2437 lookbehind: true
2438 },2438 },
2439 'variable': [2439 'variable': [
2440 {2440 {
2441 pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,2441 pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
2442 greedy: true2442 greedy: true
2443 },2443 },
2444 /@[\w.$]+/2444 /@[\w.$]+/
2445 ],2445 ],
2446 'string': {2446 'string': {
2447 pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,2447 pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
2448 greedy: true,2448 greedy: true,
2449 lookbehind: true2449 lookbehind: true
2450 },2450 },
2451 'function': /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i, // Should we highlight user defined functions too?2451 'function': /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i, // Should we highlight user defined functions too?
2452 'keyword': /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,2452 'keyword': /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
2453 'boolean': /\b(?:TRUE|FALSE|NULL)\b/i,2453 'boolean': /\b(?:TRUE|FALSE|NULL)\b/i,
2454 'number': /\b0x[\da-f]+\b|\b\d+\.?\d*|\B\.\d+\b/i,2454 'number': /\b0x[\da-f]+\b|\b\d+\.?\d*|\B\.\d+\b/i,
2455 'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,2455 'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
2456 'punctuation': /[;[\]()`,.]/2456 'punctuation': /[;[\]()`,.]/
2457};2457};
2458 2458
2459Prism.languages.scss = Prism.languages.extend('css', {2459Prism.languages.scss = Prism.languages.extend('css', {
2460 'comment': {2460 'comment': {
2461 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,2461 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
2462 lookbehind: true2462 lookbehind: true
2463 },2463 },
2464 'atrule': {2464 'atrule': {
2465 pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/,2465 pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/,
2466 inside: {2466 inside: {
2467 'rule': /@[\w-]+/2467 'rule': /@[\w-]+/
2468 // See rest below2468 // See rest below
2469 }2469 }
2470 },2470 },
2471 // url, compassified2471 // url, compassified
2472 'url': /(?:[-a-z]+-)?url(?=\()/i,2472 'url': /(?:[-a-z]+-)?url(?=\()/i,
2473 // CSS selector regex is not appropriate for Sass2473 // CSS selector regex is not appropriate for Sass
2474 // since there can be lot more things (var, @ directive, nesting..)2474 // since there can be lot more things (var, @ directive, nesting..)
2475 // a selector must start at the end of a property or after a brace (end of other rules or nesting)2475 // a selector must start at the end of a property or after a brace (end of other rules or nesting)
2476 // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable2476 // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
2477 // the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var2477 // the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var
2478 // can "pass" as a selector- e.g: proper#{$erty})2478 // can "pass" as a selector- e.g: proper#{$erty})
2479 // this one was hard to do, so please be careful if you edit this one :)2479 // this one was hard to do, so please be careful if you edit this one :)
2480 'selector': {2480 'selector': {
2481 // Initial look-ahead is used to prevent matching of blank selectors2481 // Initial look-ahead is used to prevent matching of blank selectors
2482 pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()]|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}]+[:{][^}]+))/m,2482 pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()]|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}]+[:{][^}]+))/m,
2483 inside: {2483 inside: {
2484 'parent': {2484 'parent': {
2485 pattern: /&/,2485 pattern: /&/,
2486 alias: 'important'2486 alias: 'important'
2487 },2487 },
2488 'placeholder': /%[-\w]+/,2488 'placeholder': /%[-\w]+/,
2489 'variable': /\$[-\w]+|#\{\$[-\w]+\}/2489 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2490 }2490 }
2491 },2491 },
2492 'property': {2492 'property': {
2493 pattern: /(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/,2493 pattern: /(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/,
2494 inside: {2494 inside: {
2495 'variable': /\$[-\w]+|#\{\$[-\w]+\}/2495 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2496 }2496 }
2497 }2497 }
2498});2498});
2499 2499
2500Prism.languages.insertBefore('scss', 'atrule', {2500Prism.languages.insertBefore('scss', 'atrule', {
2501 'keyword': [2501 'keyword': [
2502 /@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)/i,2502 /@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)/i,
2503 {2503 {
2504 pattern: /( +)(?:from|through)(?= )/,2504 pattern: /( +)(?:from|through)(?= )/,
2505 lookbehind: true2505 lookbehind: true
2506 }2506 }
2507 ]2507 ]
2508});2508});
2509 2509
2510Prism.languages.insertBefore('scss', 'important', {2510Prism.languages.insertBefore('scss', 'important', {
2511 // var and interpolated vars2511 // var and interpolated vars
2512 'variable': /\$[-\w]+|#\{\$[-\w]+\}/2512 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2513});2513});
2514 2514
2515Prism.languages.insertBefore('scss', 'function', {2515Prism.languages.insertBefore('scss', 'function', {
2516 'placeholder': {2516 'placeholder': {
2517 pattern: /%[-\w]+/,2517 pattern: /%[-\w]+/,
2518 alias: 'selector'2518 alias: 'selector'
2519 },2519 },
2520 'statement': {2520 'statement': {
2521 pattern: /\B!(?:default|optional)\b/i,2521 pattern: /\B!(?:default|optional)\b/i,
2522 alias: 'keyword'2522 alias: 'keyword'
2523 },2523 },
2524 'boolean': /\b(?:true|false)\b/,2524 'boolean': /\b(?:true|false)\b/,
2525 'null': {2525 'null': {
2526 pattern: /\bnull\b/,2526 pattern: /\bnull\b/,
2527 alias: 'keyword'2527 alias: 'keyword'
2528 },2528 },
2529 'operator': {2529 'operator': {
2530 pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/,2530 pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/,
2531 lookbehind: true2531 lookbehind: true
2532 }2532 }
2533});2533});
2534 2534
2535Prism.languages.scss['atrule'].inside.rest = Prism.languages.scss;2535Prism.languages.scss['atrule'].inside.rest = Prism.languages.scss;
2536 2536
2537Prism.languages.python = {2537Prism.languages.python = {
2538 'comment': {2538 'comment': {
2539 pattern: /(^|[^\\])#.*/,2539 pattern: /(^|[^\\])#.*/,
2540 lookbehind: true2540 lookbehind: true
2541 },2541 },
2542 'string-interpolation': {2542 'string-interpolation': {
2543 pattern: /(?:f|rf|fr)(?:("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,2543 pattern: /(?:f|rf|fr)(?:("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
2544 greedy: true,2544 greedy: true,
2545 inside: {2545 inside: {
2546 'interpolation': {2546 'interpolation': {
2547 // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"2547 // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
2548 pattern: /((?:^|[^{])(?:{{)*){(?!{)(?:[^{}]|{(?!{)(?:[^{}]|{(?!{)(?:[^{}])+})+})+}/,2548 pattern: /((?:^|[^{])(?:{{)*){(?!{)(?:[^{}]|{(?!{)(?:[^{}]|{(?!{)(?:[^{}])+})+})+}/,
2549 lookbehind: true,2549 lookbehind: true,
2550 inside: {2550 inside: {
2551 'format-spec': {2551 'format-spec': {
2552 pattern: /(:)[^:(){}]+(?=}$)/,2552 pattern: /(:)[^:(){}]+(?=}$)/,
2553 lookbehind: true2553 lookbehind: true
2554 },2554 },
2555 'conversion-option': {2555 'conversion-option': {
2556 pattern: /![sra](?=[:}]$)/,2556 pattern: /![sra](?=[:}]$)/,
2557 alias: 'punctuation'2557 alias: 'punctuation'
2558 },2558 },
2559 rest: null2559 rest: null
2560 }2560 }
2561 },2561 },
2562 'string': /[\s\S]+/2562 'string': /[\s\S]+/
2563 }2563 }
2564 },2564 },
2565 'triple-quoted-string': {2565 'triple-quoted-string': {
2566 pattern: /(?:[rub]|rb|br)?("""|''')[\s\S]+?\1/i,2566 pattern: /(?:[rub]|rb|br)?("""|''')[\s\S]+?\1/i,
2567 greedy: true,2567 greedy: true,
2568 alias: 'string'2568 alias: 'string'
2569 },2569 },
2570 'string': {2570 'string': {
2571 pattern: /(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,2571 pattern: /(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
2572 greedy: true2572 greedy: true
2573 },2573 },
2574 'function': {2574 'function': {
2575 pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,2575 pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
2576 lookbehind: true2576 lookbehind: true
2577 },2577 },
2578 'class-name': {2578 'class-name': {
2579 pattern: /(\bclass\s+)\w+/i,2579 pattern: /(\bclass\s+)\w+/i,
2580 lookbehind: true2580 lookbehind: true
2581 },2581 },
2582 'decorator': {2582 'decorator': {
2583 pattern: /(^\s*)@\w+(?:\.\w+)*/i,2583 pattern: /(^\s*)@\w+(?:\.\w+)*/i,
2584 lookbehind: true,2584 lookbehind: true,
2585 alias: ['annotation', 'punctuation'],2585 alias: ['annotation', 'punctuation'],
2586 inside: {2586 inside: {
2587 'punctuation': /\./2587 'punctuation': /\./
2588 }2588 }
2589 },2589 },
2590 'keyword': /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,2590 'keyword': /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
2591 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,2591 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
2592 'boolean': /\b(?:True|False|None)\b/,2592 'boolean': /\b(?:True|False|None)\b/,
2593 'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,2593 'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
2594 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,2594 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
2595 'punctuation': /[{}[\];(),.:]/2595 'punctuation': /[{}[\];(),.:]/
2596};2596};
2597 2597
2598Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;2598Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
@@ -2600,128 +2600,128 @@ Prism.languages.python['string-interpolation'].inside['interpolation'].inside.re · 1 unmodified line
2600Prism.languages.py = Prism.languages.python;2600Prism.languages.py = Prism.languages.python;
2601(function(Prism) {2601(function(Prism) {
2602 2602
2603var javascript = Prism.util.clone(Prism.languages.javascript);2603 var javascript = Prism.util.clone(Prism.languages.javascript);
2604 2604
2605Prism.languages.jsx = Prism.languages.extend('markup', javascript);2605 Prism.languages.jsx = Prism.languages.extend('markup', javascript);
2606Prism.languages.jsx.tag.pattern= /<\/?(?:[\w.:-]+\s*(?:\s+(?:[\w.:-]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s{'">=]+|\{(?:\{(?:\{[^}]*\}|[^{}])*\}|[^{}])+\}))?|\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}))*\s*\/?)?>/i;2606 Prism.languages.jsx.tag.pattern= /<\/?(?:[\w.:-]+\s*(?:\s+(?:[\w.:-]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s{'">=]+|\{(?:\{(?:\{[^}]*\}|[^{}])*\}|[^{}])+\}))?|\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}))*\s*\/?)?>/i;
2607 2607
2608Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/i;2608 Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/i;
2609Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">]+)/i;2609 Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">]+)/i;
2610Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;2610 Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
2611 2611
2612Prism.languages.insertBefore('inside', 'attr-name', {2612 Prism.languages.insertBefore('inside', 'attr-name', {
2613 'spread': {2613 'spread': {
2614 pattern: /\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}/,2614 pattern: /\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}/,
2615 inside: {2615 inside: {
2616 'punctuation': /\.{3}|[{}.]/,2616 'punctuation': /\.{3}|[{}.]/,
2617 'attr-value': /\w+/2617 'attr-value': /\w+/
2618 }2618 }
2619 }2619 }
2620}, Prism.languages.jsx.tag);2620 }, Prism.languages.jsx.tag);
2621 2621
2622Prism.languages.insertBefore('inside', 'attr-value',{2622 Prism.languages.insertBefore('inside', 'attr-value',{
2623 'script': {2623 'script': {
2624 // Allow for two levels of nesting2624 // Allow for two levels of nesting
2625 pattern: /=(\{(?:\{(?:\{[^}]*\}|[^}])*\}|[^}])+\})/i,2625 pattern: /=(\{(?:\{(?:\{[^}]*\}|[^}])*\}|[^}])+\})/i,
2626 inside: {2626 inside: {
2627 'script-punctuation': {2627 'script-punctuation': {
2628 pattern: /^=(?={)/,2628 pattern: /^=(?={)/,
2629 alias: 'punctuation'2629 alias: 'punctuation'
2630 },2630 },
2631 rest: Prism.languages.jsx2631 rest: Prism.languages.jsx
2632 },2632 },
2633 'alias': 'language-javascript'2633 'alias': 'language-javascript'
2634 }2634 }
2635}, Prism.languages.jsx.tag);

394 more lines aren’t shown here.