| @@ -1,4 +1,5 @@ |
| 1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+c+bash+cpp+coffeescript+ruby+d+django+elixir+erlang+go+java+json+kotlin+lua+nginx+nim+perl+php+python+jsx+crystal+rust+scss+sql+typescript+yaml */ | 1 | /* PrismJS 1.15.0 |
| | 2 | https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+c+bash+cpp+coffeescript+ruby+d+dart+django+elixir+markup-templating+erlang+go+java+json+kotlin+lua+crystal+nginx+nim+perl+php+sql+scss+python+jsx+typescript+rust+yaml */ |
| 2 | var _self = (typeof window !== 'undefined') | 3 | var _self = (typeof window !== 'undefined') |
| 3 | ? window // if in browser | 4 | ? window // if in browser |
| 4 | : ( | 5 | : ( |
| @@ -16,11 +17,12 @@ var _self = (typeof window !== 'undefined') · 11 unmodified lines |
| 16 | var Prism = (function(){ | 17 | var Prism = (function(){ |
| 17 | | 18 | |
| 18 | // Private helper vars | 19 | // Private helper vars |
| 19 | var lang = /\blang(?:uage)?-(\w+)\b/i; | 20 | var lang = /\blang(?:uage)?-([\w-]+)\b/i; |
| 20 | var uniqueId = 0; | 21 | var uniqueId = 0; |
| 21 | | 22 | |
| 22 | var _ = _self.Prism = { | 23 | var _ = _self.Prism = { |
| 23 | manual: _self.Prism && _self.Prism.manual, | 24 | manual: _self.Prism && _self.Prism.manual, |
| | 25 | disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler, |
| 24 | util: { | 26 | util: { |
| 25 | encode: function (tokens) { | 27 | encode: function (tokens) { |
| 26 | if (tokens instanceof Token) { | 28 | if (tokens instanceof Token) { |
| @@ -44,23 +46,38 @@ var _ = _self.Prism = { · 17 unmodified lines |
| 44 | }, | 46 | }, |
| 45 | | 47 | |
| 46 | // Deep clone a language definition (e.g. to extend it) | 48 | // Deep clone a language definition (e.g. to extend it) |
| 47 | clone: function (o) { | 49 | clone: function (o, visited) { |
| 48 | var type = _.util.type(o); | 50 | var type = _.util.type(o); |
| | 51 | visited = visited || {}; |
| 49 | | 52 | |
| 50 | switch (type) { | 53 | switch (type) { |
| 51 | case 'Object': | 54 | case 'Object': |
| | 55 | if (visited[_.util.objId(o)]) { |
| | 56 | return visited[_.util.objId(o)]; |
| | 57 | } |
| 52 | var clone = {}; | 58 | var clone = {}; |
| | 59 | visited[_.util.objId(o)] = clone; |
| 53 | | 60 | |
| 54 | for (var key in o) { | 61 | for (var key in o) { |
| 55 | if (o.hasOwnProperty(key)) { | 62 | if (o.hasOwnProperty(key)) { |
| 56 | clone[key] = _.util.clone(o[key]); | 63 | clone[key] = _.util.clone(o[key], visited); |
| 57 | } | 64 | } |
| 58 | } | 65 | } |
| 59 | | 66 | |
| 60 | return clone; | 67 | return clone; |
| 61 | | 68 | |
| 62 | case 'Array': | 69 | case 'Array': |
| 63 | return o.map(function(v) { return _.util.clone(v); }); | 70 | if (visited[_.util.objId(o)]) { |
| | 71 | return visited[_.util.objId(o)]; |
| | 72 | } |
| | 73 | var clone = []; |
| | 74 | visited[_.util.objId(o)] = clone; |
| | 75 | |
| | 76 | o.forEach(function (v, i) { |
| | 77 | clone[i] = _.util.clone(v, visited); |
| | 78 | }); |
| | 79 | |
| | 80 | return clone; |
| 64 | } | 81 | } |
| 65 | | 82 | |
| 66 | return o; | 83 | return o; |
| @@ -155,6 +172,10 @@ var _ = _self.Prism = { · 88 unmodified lines |
| 155 | plugins: {}, | 172 | plugins: {}, |
| 156 | | 173 | |
| 157 | highlightAll: function(async, callback) { | 174 | highlightAll: function(async, callback) { |
| | 175 | _.highlightAllUnder(document, async, callback); |
| | 176 | }, |
| | 177 | |
| | 178 | highlightAllUnder: function(container, async, callback) { |
| 158 | var env = { | 179 | var env = { |
| 159 | callback: callback, | 180 | callback: callback, |
| 160 | selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code' | 181 | selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code' |
| @@ -162,7 +183,7 @@ var _ = _self.Prism = { · 1 unmodified line |
| 162 | | 183 | |
| 163 | _.hooks.run("before-highlightall", env); | 184 | _.hooks.run("before-highlightall", env); |
| 164 | | 185 | |
| 165 | var elements = env.elements || document.querySelectorAll(env.selector); | 186 | var elements = env.elements || container.querySelectorAll(env.selector); |
| 166 | | 187 | |
| 167 | for (var i=0, element; element = elements[i++];) { | 188 | for (var i=0, element; element = elements[i++];) { |
| 168 | _.highlightElement(element, async === true, env.callback); | 189 | _.highlightElement(element, async === true, env.callback); |
| @@ -185,11 +206,13 @@ var _ = _self.Prism = { · 16 unmodified lines |
| 185 | // Set language on the element, if not present | 206 | // Set language on the element, if not present |
| 186 | element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; | 207 | element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; |
| 187 | | 208 | |
| 188 | // Set language on the parent, for styling | 209 | if (element.parentNode) { |
| 189 | parent = element.parentNode; | 210 | // Set language on the parent, for styling |
| | 211 | parent = element.parentNode; |
| 190 | | 212 | |
| 191 | if (/pre/i.test(parent.nodeName)) { | 213 | if (/pre/i.test(parent.nodeName)) { |
| 192 | parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; | 214 | parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; |
| | 215 | } |
| 193 | } | 216 | } |
| 194 | | 217 | |
| 195 | var code = element.textContent; | 218 | var code = element.textContent; |
| @@ -251,8 +274,15 @@ var _ = _self.Prism = { · 55 unmodified lines |
| 251 | }, | 274 | }, |
| 252 | | 275 | |
| 253 | highlight: function (text, grammar, language) { | 276 | highlight: function (text, grammar, language) { |
| 254 | var tokens = _.tokenize(text, grammar); | 277 | var env = { |
| 255 | return Token.stringify(_.util.encode(tokens), language); | 278 | code: text, |
| | 279 | grammar: grammar, |
| | 280 | language: language |
| | 281 | }; |
| | 282 | _.hooks.run('before-tokenize', env); |
| | 283 | env.tokens = _.tokenize(env.code, env.grammar); |
| | 284 | _.hooks.run('after-tokenize', env); |
| | 285 | return Token.stringify(_.util.encode(env.tokens), env.language); |
| 256 | }, | 286 | }, |
| 257 | | 287 | |
| 258 | matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) { | 288 | matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) { |
| @@ -300,15 +330,9 @@ var _ = _self.Prism = { · 41 unmodified lines |
| 300 | continue; | 330 | continue; |
| 301 | } | 331 | } |
| 302 | | 332 | |
| 303 | pattern.lastIndex = 0; | 333 | if (greedy && i != strarr.length - 1) { |
| 304 | | | |
| 305 | var match = pattern.exec(str), | | |
| 306 | delNum = 1; | | |
| 307 | | | |
| 308 | // Greedy patterns can override/remove up to two previously matched tokens | | |
| 309 | if (!match && greedy && i != strarr.length - 1) { | | |
| 310 | pattern.lastIndex = pos; | 334 | pattern.lastIndex = pos; |
| 311 | match = pattern.exec(text); | 335 | var match = pattern.exec(text); |
| 312 | if (!match) { | 336 | if (!match) { |
| 313 | break; | 337 | break; |
| 314 | } | 338 | } |
| @@ -327,11 +351,8 @@ var _ = _self.Prism = { · 12 unmodified lines |
| 327 | } | 351 | } |
| 328 | } | 352 | } |
| 329 | | 353 | |
| 330 | /* | 354 | // If strarr[i] is a Token, then the match starts inside another Token, which is invalid |
| 331 | * If strarr[i] is a Token, then the match starts inside another Token, which is invalid | 355 | if (strarr[i] instanceof Token) { |
| 332 | * If strarr[k - 1] is greedy we are in conflict with another greedy pattern | | |
| 333 | */ | | |
| 334 | if (strarr[i] instanceof Token || strarr[k - 1].greedy) { | | |
| 335 | continue; | 356 | continue; |
| 336 | } | 357 | } |
| 337 | | 358 | |
| @@ -339,6 +360,11 @@ var _ = _self.Prism = { · 1 unmodified line |
| 339 | delNum = k - i; | 360 | delNum = k - i; |
| 340 | str = text.slice(pos, p); | 361 | str = text.slice(pos, p); |
| 341 | match.index -= pos; | 362 | match.index -= pos; |
| | 363 | } else { |
| | 364 | pattern.lastIndex = 0; |
| | 365 | |
| | 366 | var match = pattern.exec(str), |
| | 367 | delNum = 1; |
| 342 | } | 368 | } |
| 343 | | 369 | |
| 344 | if (!match) { | 370 | if (!match) { |
| @@ -350,7 +376,7 @@ var _ = _self.Prism = { · 5 unmodified lines |
| 350 | } | 376 | } |
| 351 | | 377 | |
| 352 | if(lookbehind) { | 378 | if(lookbehind) { |
| 353 | lookbehindLength = match[1].length; | 379 | lookbehindLength = match[1] ? match[1].length : 0; |
| 354 | } | 380 | } |
| 355 | | 381 | |
| 356 | var from = match.index + lookbehindLength, | 382 | var from = match.index + lookbehindLength, |
| @@ -480,18 +506,21 @@ Token.stringify = function(o, language, parent) { · 123 unmodified lines |
| 480 | // // in Node.js | 506 | // // in Node.js |
| 481 | // return _self.Prism; | 507 | // return _self.Prism; |
| 482 | // } | 508 | // } |
| 483 | // // In worker | 509 | |
| 484 | // _self.addEventListener('message', function(evt) { | 510 | // if (!_.disableWorkerMessageHandler) { |
| 485 | // var message = JSON.parse(evt.data), | 511 | // // In worker |
| 486 | // lang = message.language, | 512 | // _self.addEventListener('message', function (evt) { |
| 487 | // code = message.code, | 513 | // var message = JSON.parse(evt.data), |
| 488 | // immediateClose = message.immediateClose; | 514 | // lang = message.language, |
| 489 | | 515 | // code = message.code, |
| 490 | // _self.postMessage(_.highlight(code, _.languages[lang], lang)); | 516 | // immediateClose = message.immediateClose; |
| 491 | // if (immediateClose) { | 517 | |
| 492 | // _self.close(); | 518 | // _self.postMessage(_.highlight(code, _.languages[lang], lang)); |
| 493 | // } | 519 | // if (immediateClose) { |
| 494 | // }, false); | 520 | // _self.close(); |
| | 521 | // } |
| | 522 | // }, false); |
| | 523 | // } |
| 495 | | 524 | |
| 496 | // return _self.Prism; | 525 | // return _self.Prism; |
| 497 | // } | 526 | // } |
| @@ -535,7 +564,8 @@ Prism.languages.markup = { · 37 unmodified lines |
| 535 | 'doctype': /<!DOCTYPE[\s\S]+?>/i, | 564 | 'doctype': /<!DOCTYPE[\s\S]+?>/i, |
| 536 | 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i, | 565 | 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i, |
| 537 | 'tag': { | 566 | 'tag': { |
| 538 | pattern: /<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i, | 567 | pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i, |
| | 568 | greedy: true, |
| 539 | inside: { | 569 | inside: { |
| 540 | 'tag': { | 570 | 'tag': { |
| 541 | pattern: /^<\/?[^\s>\/]+/i, | 571 | pattern: /^<\/?[^\s>\/]+/i, |
| @@ -600,13 +630,13 @@ Prism.languages.css = { · 58 unmodified lines |
| 600 | pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, | 630 | pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, |
| 601 | greedy: true | 631 | greedy: true |
| 602 | }, | 632 | }, |
| 603 | 'property': /[\w-]+(?=\s*:)/i, | 633 | 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i, |
| 604 | 'important': /\B!important\b/i, | 634 | 'important': /\B!important\b/i, |
| 605 | 'function': /[-a-z0-9]+(?=\()/i, | 635 | 'function': /[-a-z0-9]+(?=\()/i, |
| 606 | 'punctuation': /[(){};:]/ | 636 | 'punctuation': /[(){};:]/ |
| 607 | }; | 637 | }; |
| 608 | | 638 | |
| 609 | Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css); | 639 | Prism.languages.css['atrule'].inside.rest = Prism.languages.css; |
| 610 | | 640 | |
| 611 | if (Prism.languages.markup) { | 641 | if (Prism.languages.markup) { |
| 612 | Prism.languages.insertBefore('markup', 'tag', { | 642 | Prism.languages.insertBefore('markup', 'tag', { |
| @@ -614,10 +644,11 @@ if (Prism.languages.markup) { · 1 unmodified line |
| 614 | pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i, | 644 | pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i, |
| 615 | lookbehind: true, | 645 | lookbehind: true, |
| 616 | inside: Prism.languages.css, | 646 | inside: Prism.languages.css, |
| 617 | alias: 'language-css' | 647 | alias: 'language-css', |
| | 648 | greedy: true |
| 618 | } | 649 | } |
| 619 | }); | 650 | }); |
| 620 | | 651 | |
| 621 | Prism.languages.insertBefore('inside', 'attr-value', { | 652 | Prism.languages.insertBefore('inside', 'attr-value', { |
| 622 | 'style-attr': { | 653 | 'style-attr': { |
| 623 | pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i, | 654 | pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i, |
| @@ -644,7 +675,8 @@ Prism.languages.clike = { · 20 unmodified lines |
| 644 | }, | 675 | }, |
| 645 | { | 676 | { |
| 646 | pattern: /(^|[^\\:])\/\/.*/, | 677 | pattern: /(^|[^\\:])\/\/.*/, |
| 647 | lookbehind: true | 678 | lookbehind: true, |
| | 679 | greedy: true |
| 648 | } | 680 | } |
| 649 | ], | 681 | ], |
| 650 | 'string': { | 682 | 'string': { |
| @@ -661,51 +693,53 @@ Prism.languages.clike = { · 10 unmodified lines |
| 661 | 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, | 693 | 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, |
| 662 | 'boolean': /\b(?:true|false)\b/, | 694 | 'boolean': /\b(?:true|false)\b/, |
| 663 | 'function': /[a-z0-9_]+(?=\()/i, | 695 | 'function': /[a-z0-9_]+(?=\()/i, |
| 664 | 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i, | 696 | 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, |
| 665 | 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, | 697 | 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, |
| 666 | 'punctuation': /[{}[\];(),.:]/ | 698 | 'punctuation': /[{}[\];(),.:]/ |
| 667 | }; | 699 | }; |
| 668 | | 700 | |
| 669 | Prism.languages.javascript = Prism.languages.extend('clike', { | 701 | Prism.languages.javascript = Prism.languages.extend('clike', { |
| 670 | 'keyword': /\b(?: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|var|void|while|with|yield)\b/, | 702 | 'keyword': /\b(?: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|var|void|while|with|yield)\b/, |
| 671 | 'number': /\b-?(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+(?:[Ee][+-]?\d+)?|NaN|Infinity)\b/, | 703 | 'number': /\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/, |
| 672 | // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) | 704 | // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) |
| 673 | 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\s*\()/i, | 705 | 'function': /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i, |
| 674 | 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ | 706 | 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ |
| 675 | }); | 707 | }); |
| 676 | | 708 | |
| 677 | Prism.languages.insertBefore('javascript', 'keyword', { | 709 | Prism.languages.insertBefore('javascript', 'keyword', { |
| 678 | 'regex': { | 710 | 'regex': { |
| 679 | pattern: /(^|[^/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/, | 711 | pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/, |
| 680 | lookbehind: true, | 712 | lookbehind: true, |
| 681 | greedy: true | 713 | greedy: true |
| 682 | }, | 714 | }, |
| 683 | // This must be declared before keyword because we use "function" inside the look-forward | 715 | // This must be declared before keyword because we use "function" inside the look-forward |
| 684 | 'function-variable': { | 716 | 'function-variable': { |
| 685 | pattern: /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)\s*=>))/i, | 717 | pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i, |
| 686 | alias: 'function' | 718 | alias: 'function' |
| 687 | } | 719 | }, |
| | 720 | 'constant': /\b[A-Z][A-Z\d_]*\b/ |
| 688 | }); | 721 | }); |
| 689 | | 722 | |
| 690 | Prism.languages.insertBefore('javascript', 'string', { | 723 | Prism.languages.insertBefore('javascript', 'string', { |
| 691 | 'template-string': { | 724 | 'template-string': { |
| 692 | pattern: /`(?:\\[\s\S]|[^\\`])*`/, | 725 | pattern: /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/, |
| 693 | greedy: true, | 726 | greedy: true, |
| 694 | inside: { | 727 | inside: { |
| 695 | 'interpolation': { | 728 | 'interpolation': { |
| 696 | pattern: /\$\{[^}]+\}/, | 729 | pattern: /\${[^}]+}/, |
| 697 | inside: { | 730 | inside: { |
| 698 | 'interpolation-punctuation': { | 731 | 'interpolation-punctuation': { |
| 699 | pattern: /^\$\{|\}$/, | 732 | pattern: /^\${|}$/, |
| 700 | alias: 'punctuation' | 733 | alias: 'punctuation' |
| 701 | }, | 734 | }, |
| 702 | rest: Prism.languages.javascript | 735 | rest: null // See below |
| 703 | } | 736 | } |
| 704 | }, | 737 | }, |
| 705 | 'string': /[\s\S]+/ | 738 | 'string': /[\s\S]+/ |
| 706 | } | 739 | } |
| 707 | } | 740 | } |
| 708 | }); | 741 | }); |
| | 742 | Prism.languages.javascript['template-string'].inside['interpolation'].inside.rest = Prism.languages.javascript; |
| 709 | | 743 | |
| 710 | if (Prism.languages.markup) { | 744 | if (Prism.languages.markup) { |
| 711 | Prism.languages.insertBefore('markup', 'tag', { | 745 | Prism.languages.insertBefore('markup', 'tag', { |
| @@ -713,7 +747,8 @@ if (Prism.languages.markup) { · 1 unmodified line |
| 713 | pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i, | 747 | pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i, |
| 714 | lookbehind: true, | 748 | lookbehind: true, |
| 715 | inside: Prism.languages.javascript, | 749 | inside: Prism.languages.javascript, |
| 716 | alias: 'language-javascript' | 750 | alias: 'language-javascript', |
| | 751 | greedy: true |
| 717 | } | 752 | } |
| 718 | }); | 753 | }); |
| 719 | } | 754 | } |
| @@ -723,7 +758,7 @@ Prism.languages.js = Prism.languages.javascript; · 3 unmodified lines |
| 723 | Prism.languages.c = Prism.languages.extend('clike', { | 758 | Prism.languages.c = Prism.languages.extend('clike', { |
| 724 | '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/, | 759 | '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/, |
| 725 | 'operator': /-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/]/, | 760 | 'operator': /-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/]/, |
| 726 | 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i | 761 | 'number': /(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i |
| 727 | }); | 762 | }); |
| 728 | | 763 | |
| 729 | Prism.languages.insertBefore('c', 'string', { | 764 | Prism.languages.insertBefore('c', 'string', { |
| @@ -768,7 +803,7 @@ delete Prism.languages.c['boolean']; · 38 unmodified lines |
| 768 | }, | 803 | }, |
| 769 | /^\$\(\(/ | 804 | /^\$\(\(/ |
| 770 | ], | 805 | ], |
| 771 | number: /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee]-?\d+)?)\b/, | 806 | number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/, |
| 772 | // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic | 807 | // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic |
| 773 | operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/, | 808 | operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/, |
| 774 | // If there is no $ sign at the beginning highlight (( and )) as punctuation | 809 | // If there is no $ sign at the beginning highlight (( and )) as punctuation |
| @@ -778,6 +813,7 @@ delete Prism.languages.c['boolean']; · 3 unmodified lines |
| 778 | // Command Substitution | 813 | // Command Substitution |
| 779 | { | 814 | { |
| 780 | pattern: /\$\([^)]+\)|`[^`]+`/, | 815 | pattern: /\$\([^)]+\)|`[^`]+`/, |
| | 816 | greedy: true, |
| 781 | inside: { | 817 | inside: { |
| 782 | variable: /^\$\(|^`|\)$|`$/ | 818 | variable: /^\$\(|^`|\)$|`$/ |
| 783 | } | 819 | } |
| @@ -804,7 +840,7 @@ delete Prism.languages.c['boolean']; · 20 unmodified lines |
| 804 | inside: insideString | 840 | inside: insideString |
| 805 | }, | 841 | }, |
| 806 | { | 842 | { |
| 807 | pattern: /(["'])(?:\\[\s\S]|(?!\1)[^\\])*\1/, | 843 | pattern: /(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/, |
| 808 | greedy: true, | 844 | greedy: true, |
| 809 | inside: insideString | 845 | inside: insideString |
| 810 | } | 846 | } |
| @@ -812,7 +848,7 @@ delete Prism.languages.c['boolean']; · 1 unmodified line |
| 812 | 'variable': insideString.variable, | 848 | 'variable': insideString.variable, |
| 813 | // Originally based on http://ss64.com/bash/ | 849 | // Originally based on http://ss64.com/bash/ |
| 814 | 'function': { | 850 | 'function': { |
| 815 | pattern: /(^|[\s;|&])(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|[\s;|&])/, | 851 | pattern: /(^|[\s;|&])(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|[\s;|&])/, |
| 816 | lookbehind: true | 852 | lookbehind: true |
| 817 | }, | 853 | }, |
| 818 | 'keyword': { | 854 | 'keyword': { |
| @@ -828,15 +864,18 @@ delete Prism.languages.c['boolean']; · 9 unmodified lines |
| 828 | }; | 864 | }; |
| 829 | | 865 | |
| 830 | var inside = insideString.variable[1].inside; | 866 | var inside = insideString.variable[1].inside; |
| | 867 | inside.string = Prism.languages.bash.string; |
| 831 | inside['function'] = Prism.languages.bash['function']; | 868 | inside['function'] = Prism.languages.bash['function']; |
| 832 | inside.keyword = Prism.languages.bash.keyword; | 869 | inside.keyword = Prism.languages.bash.keyword; |
| 833 | inside.boolean = Prism.languages.bash.boolean; | 870 | inside['boolean'] = Prism.languages.bash['boolean']; |
| 834 | inside.operator = Prism.languages.bash.operator; | 871 | inside.operator = Prism.languages.bash.operator; |
| 835 | inside.punctuation = Prism.languages.bash.punctuation; | 872 | inside.punctuation = Prism.languages.bash.punctuation; |
| | 873 | |
| | 874 | Prism.languages.shell = Prism.languages.bash; |
| 836 | })(Prism); | 875 | })(Prism); |
| 837 | | 876 | |
| 838 | Prism.languages.cpp = Prism.languages.extend('c', { | 877 | Prism.languages.cpp = Prism.languages.extend('c', { |
| 839 | '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|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/, | 878 | '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/, |
| 840 | 'boolean': /\b(?:true|false)\b/, | 879 | 'boolean': /\b(?:true|false)\b/, |
| 841 | 'operator': /--?|\+\+?|!=?|<{1,2}=?|>{1,2}=?|->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|\|?|\?|\*|\/|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/ | 880 | 'operator': /--?|\+\+?|!=?|<{1,2}=?|>{1,2}=?|->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|\|?|\?|\*|\/|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/ |
| 842 | }); | 881 | }); |
| @@ -847,6 +886,15 @@ Prism.languages.insertBefore('cpp', 'keyword', { · 4 unmodified lines |
| 847 | lookbehind: true | 886 | lookbehind: true |
| 848 | } | 887 | } |
| 849 | }); | 888 | }); |
| | 889 | |
| | 890 | Prism.languages.insertBefore('cpp', 'string', { |
| | 891 | 'raw-string': { |
| | 892 | pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/, |
| | 893 | alias: 'string', |
| | 894 | greedy: true |
| | 895 | } |
| | 896 | }); |
| | 897 | |
| 850 | (function(Prism) { | 898 | (function(Prism) { |
| 851 | | 899 | |
| 852 | // Ignore comments starting with { to privilege string interpolation highlighting | 900 | // Ignore comments starting with { to privilege string interpolation highlighting |
| @@ -947,10 +995,13 @@ delete Prism.languages.coffeescript['template-string']; · 94 unmodified lines |
| 947 | (function(Prism) { | 995 | (function(Prism) { |
| 948 | Prism.languages.ruby = Prism.languages.extend('clike', { | 996 | Prism.languages.ruby = Prism.languages.extend('clike', { |
| 949 | 'comment': [ | 997 | 'comment': [ |
| 950 | /#(?!\{[^\r\n]*?\}).*/, | 998 | /#.*/, |
| 951 | /^=begin(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?=end/m | 999 | { |
| | 1000 | pattern: /^=begin(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?=end/m, |
| | 1001 | greedy: true |
| | 1002 | } |
| 952 | ], | 1003 | ], |
| 953 | '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|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/ | 1004 | '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/ |
| 954 | }); | 1005 | }); |
| 955 | | 1006 | |
| 956 | var interpolation = { | 1007 | var interpolation = { |
| @@ -960,7 +1011,7 @@ delete Prism.languages.coffeescript['template-string']; · 3 unmodified lines |
| 960 | pattern: /^#\{|\}$/, | 1011 | pattern: /^#\{|\}$/, |
| 961 | alias: 'tag' | 1012 | alias: 'tag' |
| 962 | }, | 1013 | }, |
| 963 | rest: Prism.util.clone(Prism.languages.ruby) | 1014 | rest: Prism.languages.ruby |
| 964 | } | 1015 | } |
| 965 | }; | 1016 | }; |
| 966 | | 1017 | |
| @@ -1009,7 +1060,10 @@ delete Prism.languages.coffeescript['template-string']; · 42 unmodified lines |
| 1009 | } | 1060 | } |
| 1010 | ], | 1061 | ], |
| 1011 | 'variable': /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/, | 1062 | 'variable': /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/, |
| 1012 | 'symbol': /:[a-zA-Z_]\w*(?:[?!]|\b)/ | 1063 | 'symbol': { |
| | 1064 | pattern: /(^|[^:]):[a-zA-Z_]\w*(?:[?!]|\b)/, |
| | 1065 | lookbehind: true |
| | 1066 | } |
| 1013 | }); | 1067 | }); |
| 1014 | | 1068 | |
| 1015 | Prism.languages.insertBefore('ruby', 'number', { | 1069 | Prism.languages.insertBefore('ruby', 'number', { |
| @@ -1127,6 +1181,30 @@ Prism.languages.insertBefore('d', 'function', { · 111 unmodified lines |
| 1127 | alias: 'variable' | 1181 | alias: 'variable' |
| 1128 | } | 1182 | } |
| 1129 | }); | 1183 | }); |
| | 1184 | Prism.languages.dart = Prism.languages.extend('clike', { |
| | 1185 | 'string': [ |
| | 1186 | { |
| | 1187 | pattern: /r?("""|''')[\s\S]*?\1/, |
| | 1188 | greedy: true |
| | 1189 | }, |
| | 1190 | { |
| | 1191 | pattern: /r?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, |
| | 1192 | greedy: true |
| | 1193 | } |
| | 1194 | ], |
| | 1195 | 'keyword': [ |
| | 1196 | /\b(?:async|sync|yield)\*/, |
| | 1197 | /\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/ |
| | 1198 | ], |
| | 1199 | 'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/ |
| | 1200 | }); |
| | 1201 | |
| | 1202 | Prism.languages.insertBefore('dart','function',{ |
| | 1203 | 'metadata': { |
| | 1204 | pattern: /@\w+/, |
| | 1205 | alias: 'symbol' |
| | 1206 | } |
| | 1207 | }); |
| 1130 | // Django/Jinja2 syntax definition for Prism.js <http://prismjs.com> syntax highlighter. | 1208 | // Django/Jinja2 syntax definition for Prism.js <http://prismjs.com> syntax highlighter. |
| 1131 | // Mostly it works OK but can paint code incorrectly on complex html/template tag combinations. | 1209 | // Mostly it works OK but can paint code incorrectly on complex html/template tag combinations. |
| 1132 | | 1210 | |
| @@ -1170,15 +1248,15 @@ if (Prism.languages.css) { · 37 unmodified lines |
| 1170 | Prism.languages.jinja2 = Prism.languages.django; | 1248 | Prism.languages.jinja2 = Prism.languages.django; |
| 1171 | | 1249 | |
| 1172 | Prism.languages.elixir = { | 1250 | Prism.languages.elixir = { |
| 1173 | // Negative look-ahead is needed for string interpolation | | |
| 1174 | // Negative look-behind is needed to avoid highlighting markdown headers in | | |
| 1175 | // multi-line doc strings | | |
| 1176 | 'comment': { | 1251 | 'comment': { |
| 1177 | pattern: /(^|[^#])#(?![{#]).*/m, | 1252 | pattern: /#.*/m, |
| 1178 | lookbehind: true | 1253 | lookbehind: true |
| 1179 | }, | 1254 | }, |
| 1180 | // ~r"""foo""" (multi-line), ~r'''foo''' (multi-line), ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo> | 1255 | // ~r"""foo""" (multi-line), ~r'''foo''' (multi-line), ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo> |
| 1181 | 'regex': /~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/, | 1256 | 'regex': { |
| | 1257 | pattern: /~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/, |
| | 1258 | greedy: true |
| | 1259 | }, |
| 1182 | 'string': [ | 1260 | 'string': [ |
| 1183 | { | 1261 | { |
| 1184 | // ~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> | 1262 | // ~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> |
| @@ -1225,7 +1303,7 @@ Prism.languages.elixir = { · 40 unmodified lines |
| 1225 | alias: 'variable' | 1303 | alias: 'variable' |
| 1226 | }, | 1304 | }, |
| 1227 | 'attribute': { | 1305 | 'attribute': { |
| 1228 | pattern: /@[\S]+/, | 1306 | pattern: /@\w+/, |
| 1229 | alias: 'variable' | 1307 | alias: 'variable' |
| 1230 | }, | 1308 | }, |
| 1231 | 'number': /\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i, | 1309 | 'number': /\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i, |
| @@ -1256,13 +1334,102 @@ Prism.languages.elixir.string.forEach(function(o) { · 24 unmodified lines |
| 1256 | pattern: /^#\{|\}$/, | 1334 | pattern: /^#\{|\}$/, |
| 1257 | alias: 'punctuation' | 1335 | alias: 'punctuation' |
| 1258 | }, | 1336 | }, |
| 1259 | rest: Prism.util.clone(Prism.languages.elixir) | 1337 | rest: Prism.languages.elixir |
| 1260 | } | 1338 | } |
| 1261 | } | 1339 | } |
| 1262 | }; | 1340 | }; |
| 1263 | }); | 1341 | }); |
| 1264 | | 1342 | |
| 1265 | | 1343 | |
| | 1344 | Prism.languages['markup-templating'] = {}; |
| | 1345 | |
| | 1346 | Object.defineProperties(Prism.languages['markup-templating'], { |
| | 1347 | buildPlaceholders: { |
| | 1348 | // Tokenize all inline templating expressions matching placeholderPattern |
| | 1349 | // If the replaceFilter function is provided, it will be called with every match. |
| | 1350 | // If it returns false, the match will not be replaced. |
| | 1351 | value: function (env, language, placeholderPattern, replaceFilter) { |
| | 1352 | if (env.language !== language) { |
| | 1353 | return; |
| | 1354 | } |
| | 1355 | |
| | 1356 | env.tokenStack = []; |
| | 1357 | |
| | 1358 | env.code = env.code.replace(placeholderPattern, function(match) { |
| | 1359 | if (typeof replaceFilter === 'function' && !replaceFilter(match)) { |
| | 1360 | return match; |
| | 1361 | } |
| | 1362 | var i = env.tokenStack.length; |
| | 1363 | // Check for existing strings |
| | 1364 | while (env.code.indexOf('___' + language.toUpperCase() + i + '___') !== -1) |
| | 1365 | ++i; |
| | 1366 | |
| | 1367 | // Create a sparse array |
| | 1368 | env.tokenStack[i] = match; |
| | 1369 | |
| | 1370 | return '___' + language.toUpperCase() + i + '___'; |
| | 1371 | }); |
| | 1372 | |
| | 1373 | // Switch the grammar to markup |
| | 1374 | env.grammar = Prism.languages.markup; |
| | 1375 | } |
| | 1376 | }, |
| | 1377 | tokenizePlaceholders: { |
| | 1378 | // Replace placeholders with proper tokens after tokenizing |
| | 1379 | value: function (env, language) { |
| | 1380 | if (env.language !== language || !env.tokenStack) { |
| | 1381 | return; |
| | 1382 | } |
| | 1383 | |
| | 1384 | // Switch the grammar back |
| | 1385 | env.grammar = Prism.languages[language]; |
| | 1386 | |
| | 1387 | var j = 0; |
| | 1388 | var keys = Object.keys(env.tokenStack); |
| | 1389 | var walkTokens = function (tokens) { |
| | 1390 | if (j >= keys.length) { |
| | 1391 | return; |
| | 1392 | } |
| | 1393 | for (var i = 0; i < tokens.length; i++) { |
| | 1394 | var token = tokens[i]; |
| | 1395 | if (typeof token === 'string' || (token.content && typeof token.content === 'string')) { |
| | 1396 | var k = keys[j]; |
| | 1397 | var t = env.tokenStack[k]; |
| | 1398 | var s = typeof token === 'string' ? token : token.content; |
| | 1399 | |
| | 1400 | var index = s.indexOf('___' + language.toUpperCase() + k + '___'); |
| | 1401 | if (index > -1) { |
| | 1402 | ++j; |
| | 1403 | var before = s.substring(0, index); |
| | 1404 | var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar, language), 'language-' + language, t); |
| | 1405 | var after = s.substring(index + ('___' + language.toUpperCase() + k + '___').length); |
| | 1406 | var replacement; |
| | 1407 | if (before || after) { |
| | 1408 | replacement = [before, middle, after].filter(function (v) { return !!v; }); |
| | 1409 | walkTokens(replacement); |
| | 1410 | } else { |
| | 1411 | replacement = middle; |
| | 1412 | } |
| | 1413 | if (typeof token === 'string') { |
| | 1414 | Array.prototype.splice.apply(tokens, [i, 1].concat(replacement)); |
| | 1415 | } else { |
| | 1416 | token.content = replacement; |
| | 1417 | } |
| | 1418 | |
| | 1419 | if (j >= keys.length) { |
| | 1420 | break; |
| | 1421 | } |
| | 1422 | } |
| | 1423 | } else if (token.content && typeof token.content !== 'string') { |
| | 1424 | walkTokens(token.content); |
| | 1425 | } |
| | 1426 | } |
| | 1427 | }; |
| | 1428 | |
| | 1429 | walkTokens(env.tokens); |
| | 1430 | } |
| | 1431 | } |
| | 1432 | }); |
| 1266 | Prism.languages.erlang = { | 1433 | Prism.languages.erlang = { |
| 1267 | 'comment': /%.+/, | 1434 | 'comment': /%.+/, |
| 1268 | 'string': { | 1435 | 'string': { |
| @@ -1282,7 +1449,7 @@ Prism.languages.erlang = { · 13 unmodified lines |
| 1282 | 'number': [ | 1449 | 'number': [ |
| 1283 | /\$\\?./, | 1450 | /\$\\?./, |
| 1284 | /\d+#[a-z0-9]+/i, | 1451 | /\d+#[a-z0-9]+/i, |
| 1285 | /(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/ | 1452 | /(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i |
| 1286 | ], | 1453 | ], |
| 1287 | 'function': /\b[a-z][\w@]*(?=\()/, | 1454 | 'function': /\b[a-z][\w@]*(?=\()/, |
| 1288 | 'variable': { | 1455 | 'variable': { |
| @@ -1312,7 +1479,7 @@ Prism.languages.go = Prism.languages.extend('clike', { · 23 unmodified lines |
| 1312 | '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/, | 1479 | '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/, |
| 1313 | 'boolean': /\b(?:_|iota|nil|true|false)\b/, | 1480 | 'boolean': /\b(?:_|iota|nil|true|false)\b/, |
| 1314 | 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./, | 1481 | 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./, |
| 1315 | 'number': /\b(-?(0x[a-f\d]+|(\d+\.?\d*|\.\d+)(e[-+]?\d+)?)i?)\b/i, | 1482 | 'number': /(?:\b0x[a-f\d]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[-+]?\d+)?)i?/i, |
| 1316 | 'string': { | 1483 | 'string': { |
| 1317 | pattern: /(["'`])(\\[\s\S]|(?!\1)[^\\])*\1/, | 1484 | pattern: /(["'`])(\\[\s\S]|(?!\1)[^\\])*\1/, |
| 1318 | greedy: true | 1485 | greedy: true |
| @@ -1322,7 +1489,7 @@ delete Prism.languages.go['class-name']; · 3 unmodified lines |
| 1322 | | 1489 | |
| 1323 | Prism.languages.java = Prism.languages.extend('clike', { | 1490 | Prism.languages.java = Prism.languages.extend('clike', { |
| 1324 | 'keyword': /\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)\b/, | 1491 | 'keyword': /\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)\b/, |
| 1325 | 'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i, | 1492 | 'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp-]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?[df]?/i, |
| 1326 | 'operator': { | 1493 | 'operator': { |
| 1327 | pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m, | 1494 | pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m, |
| 1328 | lookbehind: true | 1495 | lookbehind: true |
| @@ -1337,14 +1504,25 @@ Prism.languages.insertBefore('java','function', { · 8 unmodified lines |
| 1337 | } | 1504 | } |
| 1338 | }); | 1505 | }); |
| 1339 | | 1506 | |
| | 1507 | Prism.languages.insertBefore('java', 'class-name', { |
| | 1508 | 'generics': { |
| | 1509 | pattern: /<\s*\w+(?:\.\w+)?(?:\s*,\s*\w+(?:\.\w+)?)*>/i, |
| | 1510 | alias: 'function', |
| | 1511 | inside: { |
| | 1512 | keyword: Prism.languages.java.keyword, |
| | 1513 | punctuation: /[<>(),.:]/ |
| | 1514 | } |
| | 1515 | } |
| | 1516 | }); |
| | 1517 | |
| 1340 | Prism.languages.json = { | 1518 | Prism.languages.json = { |
| 1341 | 'property': /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i, | 1519 | 'property': /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i, |
| 1342 | 'string': { | 1520 | 'string': { |
| 1343 | pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/, | 1521 | pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/, |
| 1344 | greedy: true | 1522 | greedy: true |
| 1345 | }, | 1523 | }, |
| 1346 | 'number': /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee][+-]?\d+)?)\b/, | 1524 | 'number': /-?\d+\.?\d*([Ee][+-]?\d+)?/, |
| 1347 | 'punctuation': /[{}[\]);,]/, | 1525 | 'punctuation': /[{}[\],]/, |
| 1348 | 'operator': /:/g, | 1526 | 'operator': /:/g, |
| 1349 | 'boolean': /\b(?:true|false)\b/i, | 1527 | 'boolean': /\b(?:true|false)\b/i, |
| 1350 | 'null': /\bnull\b/i | 1528 | 'null': /\bnull\b/i |
| @@ -1356,7 +1534,7 @@ Prism.languages.jsonp = Prism.languages.json; · 5 unmodified lines |
| 1356 | Prism.languages.kotlin = Prism.languages.extend('clike', { | 1534 | Prism.languages.kotlin = Prism.languages.extend('clike', { |
| 1357 | 'keyword': { | 1535 | 'keyword': { |
| 1358 | // The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get | 1536 | // The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get |
| 1359 | pattern: /(^|[^.])\b(?:abstract|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|else|enum|final|finally|for|fun|get|if|import|in|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|out|override|package|private|protected|public|reified|return|sealed|set|super|tailrec|this|throw|to|try|val|var|when|where|while)\b/, | 1537 | 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/, |
| 1360 | lookbehind: true | 1538 | lookbehind: true |
| 1361 | }, | 1539 | }, |
| 1362 | 'function': [ | 1540 | 'function': [ |
| @@ -1366,7 +1544,7 @@ Prism.languages.jsonp = Prism.languages.json; · 3 unmodified lines |
| 1366 | lookbehind: true | 1544 | lookbehind: true |
| 1367 | } | 1545 | } |
| 1368 | ], | 1546 | ], |
| 1369 | 'number': /\b(?:0[bx][\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?[fFL]?)\b/, | 1547 | 'number': /\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/, |
| 1370 | 'operator': /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/ | 1548 | 'operator': /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/ |
| 1371 | }); | 1549 | }); |
| 1372 | | 1550 | |
| @@ -1400,7 +1578,7 @@ Prism.languages.jsonp = Prism.languages.json; · 27 unmodified lines |
| 1400 | pattern: /^\$\{|\}$/, | 1578 | pattern: /^\$\{|\}$/, |
| 1401 | alias: 'variable' | 1579 | alias: 'variable' |
| 1402 | }, | 1580 | }, |
| 1403 | rest: Prism.util.clone(Prism.languages.kotlin) | 1581 | rest: Prism.languages.kotlin |
| 1404 | } | 1582 | } |
| 1405 | }, | 1583 | }, |
| 1406 | { | 1584 | { |
| @@ -1414,6 +1592,7 @@ Prism.languages.jsonp = Prism.languages.json; · 7 unmodified lines |
| 1414 | }; | 1592 | }; |
| 1415 | | 1593 | |
| 1416 | }(Prism)); | 1594 | }(Prism)); |
| | 1595 | |
| 1417 | Prism.languages.lua = { | 1596 | Prism.languages.lua = { |
| 1418 | 'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m, | 1597 | 'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m, |
| 1419 | // \z may be used to skip the following space | 1598 | // \z may be used to skip the following space |
| @@ -1434,16 +1613,68 @@ Prism.languages.lua = { · 14 unmodified lines |
| 1434 | ], | 1613 | ], |
| 1435 | 'punctuation': /[\[\](){},;]|\.+|:+/ | 1614 | 'punctuation': /[\[\](){},;]|\.+|:+/ |
| 1436 | }; | 1615 | }; |
| | 1616 | (function(Prism) { |
| | 1617 | Prism.languages.crystal = Prism.languages.extend('ruby', { |
| | 1618 | keyword: [ |
| | 1619 | /\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/, |
| | 1620 | { |
| | 1621 | pattern: /(\.\s*)(?:is_a|responds_to)\?/, |
| | 1622 | lookbehind: true |
| | 1623 | } |
| | 1624 | ], |
| | 1625 | |
| | 1626 | 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/ |
| | 1627 | }); |
| | 1628 | |
| | 1629 | Prism.languages.insertBefore('crystal', 'string', { |
| | 1630 | attribute: { |
| | 1631 | pattern: /@\[.+?\]/, |
| | 1632 | alias: 'attr-name', |
| | 1633 | inside: { |
| | 1634 | delimiter: { |
| | 1635 | pattern: /^@\[|\]$/, |
| | 1636 | alias: 'tag' |
| | 1637 | }, |
| | 1638 | rest: Prism.languages.crystal |
| | 1639 | } |
| | 1640 | }, |
| | 1641 | |
| | 1642 | expansion: [ |
| | 1643 | { |
| | 1644 | pattern: /\{\{.+?\}\}/, |
| | 1645 | inside: { |
| | 1646 | delimiter: { |
| | 1647 | pattern: /^\{\{|\}\}$/, |
| | 1648 | alias: 'tag' |
| | 1649 | }, |
| | 1650 | rest: Prism.languages.crystal |
| | 1651 | } |
| | 1652 | }, |
| | 1653 | { |
| | 1654 | pattern: /\{%.+?%\}/, |
| | 1655 | inside: { |
| | 1656 | delimiter: { |
| | 1657 | pattern: /^\{%|%\}$/, |
| | 1658 | alias: 'tag' |
| | 1659 | }, |
| | 1660 | rest: Prism.languages.crystal |
| | 1661 | } |
| | 1662 | } |
| | 1663 | ] |
| | 1664 | }); |
| | 1665 | |
| | 1666 | }(Prism)); |
| | 1667 | |
| 1437 | Prism.languages.nginx = Prism.languages.extend('clike', { | 1668 | Prism.languages.nginx = Prism.languages.extend('clike', { |
| 1438 | 'comment': { | 1669 | 'comment': { |
| 1439 | pattern: /(^|[^"{\\])#.*/, | 1670 | pattern: /(^|[^"{\\])#.*/, |
| 1440 | lookbehind: true | 1671 | lookbehind: true |
| 1441 | }, | 1672 | }, |
| 1442 | '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)\b/i | 1673 | '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)\b/i |
| 1443 | }); | 1674 | }); |
| 1444 | | 1675 | |
| 1445 | Prism.languages.insertBefore('nginx', 'keyword', { | 1676 | Prism.languages.insertBefore('nginx', 'keyword', { |
| 1446 | 'variable': /\$[a-z_]+/i | 1677 | 'variable': /\$[a-z_]+/i |
| 1447 | }); | 1678 | }); |
| 1448 | Prism.languages.nim = { | 1679 | Prism.languages.nim = { |
| 1449 | 'comment': /#.*/, | 1680 | 'comment': /#.*/, |
| @@ -1497,31 +1728,31 @@ Prism.languages.perl = { · 47 unmodified lines |
| 1497 | pattern: /\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/, | 1728 | pattern: /\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/, |
| 1498 | greedy: true | 1729 | greedy: true |
| 1499 | }, | 1730 | }, |
| 1500 | | 1731 | |
| 1501 | // q a...a | 1732 | // q a...a |
| 1502 | { | 1733 | { |
| 1503 | pattern: /\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1/, | 1734 | pattern: /\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1/, |
| 1504 | greedy: true | 1735 | greedy: true |
| 1505 | }, | 1736 | }, |
| 1506 | | 1737 | |
| 1507 | // q(...) | 1738 | // q(...) |
| 1508 | { | 1739 | { |
| 1509 | pattern: /\b(?:q|qq|qx|qw)\s*\((?:[^()\\]|\\[\s\S])*\)/, | 1740 | pattern: /\b(?:q|qq|qx|qw)\s*\((?:[^()\\]|\\[\s\S])*\)/, |
| 1510 | greedy: true | 1741 | greedy: true |
| 1511 | }, | 1742 | }, |
| 1512 | | 1743 | |
| 1513 | // q{...} | 1744 | // q{...} |
| 1514 | { | 1745 | { |
| 1515 | pattern: /\b(?:q|qq|qx|qw)\s*\{(?:[^{}\\]|\\[\s\S])*\}/, | 1746 | pattern: /\b(?:q|qq|qx|qw)\s*\{(?:[^{}\\]|\\[\s\S])*\}/, |
| 1516 | greedy: true | 1747 | greedy: true |
| 1517 | }, | 1748 | }, |
| 1518 | | 1749 | |
| 1519 | // q[...] | 1750 | // q[...] |
| 1520 | { | 1751 | { |
| 1521 | pattern: /\b(?:q|qq|qx|qw)\s*\[(?:[^[\]\\]|\\[\s\S])*\]/, | 1752 | pattern: /\b(?:q|qq|qx|qw)\s*\[(?:[^[\]\\]|\\[\s\S])*\]/, |
| 1522 | greedy: true | 1753 | greedy: true |
| 1523 | }, | 1754 | }, |
| 1524 | | 1755 | |
| 1525 | // q<...> | 1756 | // q<...> |
| 1526 | { | 1757 | { |
| 1527 | pattern: /\b(?:q|qq|qx|qw)\s*<(?:[^<>\\]|\\[\s\S])*>/, | 1758 | pattern: /\b(?:q|qq|qx|qw)\s*<(?:[^<>\\]|\\[\s\S])*>/, |
| @@ -1547,31 +1778,31 @@ Prism.languages.perl = { · 19 unmodified lines |
| 1547 | pattern: /\b(?:m|qr)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/, | 1778 | pattern: /\b(?:m|qr)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/, |
| 1548 | greedy: true | 1779 | greedy: true |
| 1549 | }, | 1780 | }, |
| 1550 | | 1781 | |
| 1551 | // m a...a | 1782 | // m a...a |
| 1552 | { | 1783 | { |
| 1553 | pattern: /\b(?:m|qr)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/, | 1784 | pattern: /\b(?:m|qr)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/, |
| 1554 | greedy: true | 1785 | greedy: true |
| 1555 | }, | 1786 | }, |
| 1556 | | 1787 | |
| 1557 | // m(...) | 1788 | // m(...) |
| 1558 | { | 1789 | { |
| 1559 | pattern: /\b(?:m|qr)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngc]*/, | 1790 | pattern: /\b(?:m|qr)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngc]*/, |
| 1560 | greedy: true | 1791 | greedy: true |
| 1561 | }, | 1792 | }, |
| 1562 | | 1793 | |
| 1563 | // m{...} | 1794 | // m{...} |
| 1564 | { | 1795 | { |
| 1565 | pattern: /\b(?:m|qr)\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngc]*/, | 1796 | pattern: /\b(?:m|qr)\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngc]*/, |
| 1566 | greedy: true | 1797 | greedy: true |
| 1567 | }, | 1798 | }, |
| 1568 | | 1799 | |
| 1569 | // m[...] | 1800 | // m[...] |
| 1570 | { | 1801 | { |
| 1571 | pattern: /\b(?:m|qr)\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngc]*/, | 1802 | pattern: /\b(?:m|qr)\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngc]*/, |
| 1572 | greedy: true | 1803 | greedy: true |
| 1573 | }, | 1804 | }, |
| 1574 | | 1805 | |
| 1575 | // m<...> | 1806 | // m<...> |
| 1576 | { | 1807 | { |
| 1577 | pattern: /\b(?:m|qr)\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngc]*/, | 1808 | pattern: /\b(?:m|qr)\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngc]*/, |
| @@ -1586,42 +1817,42 @@ Prism.languages.perl = { · 8 unmodified lines |
| 1586 | lookbehind: true, | 1817 | lookbehind: true, |
| 1587 | greedy: true | 1818 | greedy: true |
| 1588 | }, | 1819 | }, |
| 1589 | | 1820 | |
| 1590 | // s a...a...a | 1821 | // s a...a...a |
| 1591 | { | 1822 | { |
| 1592 | pattern: /(^|[^-]\b)(?:s|tr|y)\s+([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2[msixpodualngcer]*/, | 1823 | pattern: /(^|[^-]\b)(?:s|tr|y)\s+([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2[msixpodualngcer]*/, |
| 1593 | lookbehind: true, | 1824 | lookbehind: true, |
| 1594 | greedy: true | 1825 | greedy: true |
| 1595 | }, | 1826 | }, |
| 1596 | | 1827 | |
| 1597 | // s(...)(...) | 1828 | // s(...)(...) |
| 1598 | { | 1829 | { |
| 1599 | pattern: /(^|[^-]\b)(?:s|tr|y)\s*\((?:[^()\\]|\\[\s\S])*\)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngcer]*/, | 1830 | pattern: /(^|[^-]\b)(?:s|tr|y)\s*\((?:[^()\\]|\\[\s\S])*\)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngcer]*/, |
| 1600 | lookbehind: true, | 1831 | lookbehind: true, |
| 1601 | greedy: true | 1832 | greedy: true |
| 1602 | }, | 1833 | }, |
| 1603 | | 1834 | |
| 1604 | // s{...}{...} | 1835 | // s{...}{...} |
| 1605 | { | 1836 | { |
| 1606 | pattern: /(^|[^-]\b)(?:s|tr|y)\s*\{(?:[^{}\\]|\\[\s\S])*\}\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngcer]*/, | 1837 | pattern: /(^|[^-]\b)(?:s|tr|y)\s*\{(?:[^{}\\]|\\[\s\S])*\}\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngcer]*/, |
| 1607 | lookbehind: true, | 1838 | lookbehind: true, |
| 1608 | greedy: true | 1839 | greedy: true |
| 1609 | }, | 1840 | }, |
| 1610 | | 1841 | |
| 1611 | // s[...][...] | 1842 | // s[...][...] |
| 1612 | { | 1843 | { |
| 1613 | pattern: /(^|[^-]\b)(?:s|tr|y)\s*\[(?:[^[\]\\]|\\[\s\S])*\]\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngcer]*/, | 1844 | pattern: /(^|[^-]\b)(?:s|tr|y)\s*\[(?:[^[\]\\]|\\[\s\S])*\]\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngcer]*/, |
| 1614 | lookbehind: true, | 1845 | lookbehind: true, |
| 1615 | greedy: true | 1846 | greedy: true |
| 1616 | }, | 1847 | }, |
| 1617 | | 1848 | |
| 1618 | // s<...><...> | 1849 | // s<...><...> |
| 1619 | { | 1850 | { |
| 1620 | pattern: /(^|[^-]\b)(?:s|tr|y)\s*<(?:[^<>\\]|\\[\s\S])*>\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngcer]*/, | 1851 | pattern: /(^|[^-]\b)(?:s|tr|y)\s*<(?:[^<>\\]|\\[\s\S])*>\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngcer]*/, |
| 1621 | lookbehind: true, | 1852 | lookbehind: true, |
| 1622 | greedy: true | 1853 | greedy: true |
| 1623 | }, | 1854 | }, |
| 1624 | | 1855 | |
| 1625 | // /.../ | 1856 | // /.../ |
| 1626 | // The look-ahead tries to prevent two divisions on | 1857 | // The look-ahead tries to prevent two divisions on |
| 1627 | // the same line from being highlighted as regex. | 1858 | // the same line from being highlighted as regex. |
| @@ -1665,7 +1896,7 @@ Prism.languages.perl = { · 37 unmodified lines |
| 1665 | } | 1896 | } |
| 1666 | }, | 1897 | }, |
| 1667 | '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|say|state|sub|switch|undef|unless|until|use|when|while)\b/, | 1898 | '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|say|state|sub|switch|undef|unless|until|use|when|while)\b/, |
| 1668 | 'number': /\b-?(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:\d(?:_?\d)*)?\.?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/, | 1899 | 'number': /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:\d(?:_?\d)*)?\.?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/, |
| 1669 | 'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:lt|gt|le|ge|eq|ne|cmp|not|and|or|xor)\b/, | 1900 | 'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:lt|gt|le|ge|eq|ne|cmp|not|and|or|xor)\b/, |
| 1670 | 'punctuation': /[{}[\];(),:]/ | 1901 | 'punctuation': /[{}[\];(),:]/ |
| 1671 | }; | 1902 | }; |
| @@ -1682,110 +1913,211 @@ Prism.languages.perl = { · 10 unmodified lines |
| 1682 | * Adds the following new token classes: | 1913 | * Adds the following new token classes: |
| 1683 | * constant, delimiter, variable, function, package | 1914 | * constant, delimiter, variable, function, package |
| 1684 | */ | 1915 | */ |
| | 1916 | (function (Prism) { |
| | 1917 | Prism.languages.php = Prism.languages.extend('clike', { |
| | 1918 | 'keyword': /\b(?:and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i, |
| | 1919 | 'constant': /\b[A-Z0-9_]{2,}\b/, |
| | 1920 | 'comment': { |
| | 1921 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, |
| | 1922 | lookbehind: true |
| | 1923 | } |
| | 1924 | }); |
| 1685 | | 1925 | |
| 1686 | Prism.languages.php = Prism.languages.extend('clike', { | 1926 | Prism.languages.insertBefore('php', 'string', { |
| 1687 | 'keyword': /\b(?:and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i, | 1927 | 'shell-comment': { |
| 1688 | 'constant': /\b[A-Z0-9_]{2,}\b/, | 1928 | pattern: /(^|[^\\])#.*/, |
| 1689 | 'comment': { | 1929 | lookbehind: true, |
| 1690 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, | 1930 | alias: 'comment' |
| 1691 | lookbehind: true | 1931 | } |
| 1692 | } | 1932 | }); |
| 1693 | }); | | |
| 1694 | | 1933 | |
| 1695 | // Shell-like comments are matched after strings, because they are less | 1934 | Prism.languages.insertBefore('php', 'keyword', { |
| 1696 | // common than strings containing hashes... | 1935 | 'delimiter': { |
| 1697 | Prism.languages.insertBefore('php', 'class-name', { | 1936 | pattern: /\?>|<\?(?:php|=)?/i, |
| 1698 | 'shell-comment': { | 1937 | alias: 'important' |
| 1699 | pattern: /(^|[^\\])#.*/, | 1938 | }, |
| 1700 | lookbehind: true, | 1939 | 'variable': /\$+(?:\w+\b|(?={))/i, |
| 1701 | alias: 'comment' | 1940 | 'package': { |
| 1702 | } | 1941 | pattern: /(\\|namespace\s+|use\s+)[\w\\]+/, |
| 1703 | }); | 1942 | lookbehind: true, |
| | 1943 | inside: { |
| | 1944 | punctuation: /\\/ |
| | 1945 | } |
| | 1946 | } |
| | 1947 | }); |
| 1704 | | 1948 | |
| 1705 | Prism.languages.insertBefore('php', 'keyword', { | 1949 | // Must be defined after the function pattern |
| 1706 | 'delimiter': { | 1950 | Prism.languages.insertBefore('php', 'operator', { |
| 1707 | pattern: /\?>|<\?(?:php|=)?/i, | 1951 | 'property': { |
| 1708 | alias: 'important' | 1952 | pattern: /(->)[\w]+/, |
| 1709 | }, | 1953 | lookbehind: true |
| 1710 | 'variable': /\$\w+\b/i, | | |
| 1711 | 'package': { | | |
| 1712 | pattern: /(\\|namespace\s+|use\s+)[\w\\]+/, | | |
| 1713 | lookbehind: true, | | |
| 1714 | inside: { | | |
| 1715 | punctuation: /\\/ | | |
| 1716 | } | 1954 | } |
| 1717 | } | 1955 | }); |
| 1718 | }); | | |
| 1719 | | 1956 | |
| 1720 | // Must be defined after the function pattern | 1957 | Prism.languages.insertBefore('php', 'string', { |
| 1721 | Prism.languages.insertBefore('php', 'operator', { | 1958 | 'nowdoc-string': { |
| 1722 | 'property': { | 1959 | pattern: /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/, |
| 1723 | pattern: /(->)[\w]+/, | 1960 | greedy: true, |
| 1724 | lookbehind: true | 1961 | alias: 'string', |
| 1725 | } | 1962 | inside: { |
| 1726 | }); | 1963 | 'delimiter': { |
| | 1964 | pattern: /^<<<'[^']+'|[a-z_]\w*;$/i, |
| | 1965 | alias: 'symbol', |
| | 1966 | inside: { |
| | 1967 | 'punctuation': /^<<<'?|[';]$/ |
| | 1968 | } |
| | 1969 | } |
| | 1970 | } |
| | 1971 | }, |
| | 1972 | 'heredoc-string': { |
| | 1973 | pattern: /<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i, |
| | 1974 | greedy: true, |
| | 1975 | alias: 'string', |
| | 1976 | inside: { |
| | 1977 | 'delimiter': { |
| | 1978 | pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i, |
| | 1979 | alias: 'symbol', |
| | 1980 | inside: { |
| | 1981 | 'punctuation': /^<<<"?|[";]$/ |
| | 1982 | } |
| | 1983 | }, |
| | 1984 | 'interpolation': null // See below |
| | 1985 | } |
| | 1986 | }, |
| | 1987 | 'single-quoted-string': { |
| | 1988 | pattern: /'(?:\\[\s\S]|[^\\'])*'/, |
| | 1989 | greedy: true, |
| | 1990 | alias: 'string' |
| | 1991 | }, |
| | 1992 | 'double-quoted-string': { |
| | 1993 | pattern: /"(?:\\[\s\S]|[^\\"])*"/, |
| | 1994 | greedy: true, |
| | 1995 | alias: 'string', |
| | 1996 | inside: { |
| | 1997 | 'interpolation': null // See below |
| | 1998 | } |
| | 1999 | } |
| | 2000 | }); |
| | 2001 | // The different types of PHP strings "replace" the C-like standard string |
| | 2002 | delete Prism.languages.php['string']; |
| 1727 | | 2003 | |
| 1728 | // Add HTML support if the markup language exists | 2004 | var string_interpolation = { |
| 1729 | if (Prism.languages.markup) { | 2005 | pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/, |
| | 2006 | lookbehind: true, |
| | 2007 | inside: { |
| | 2008 | rest: Prism.languages.php |
| | 2009 | } |
| | 2010 | }; |
| | 2011 | Prism.languages.php['heredoc-string'].inside['interpolation'] = string_interpolation; |
| | 2012 | Prism.languages.php['double-quoted-string'].inside['interpolation'] = string_interpolation; |
| 1730 | | 2013 | |
| 1731 | // Tokenize all inline PHP blocks that are wrapped in <?php ?> | 2014 | Prism.hooks.add('before-tokenize', function(env) { |
| 1732 | // This allows for easy PHP + markup highlighting | 2015 | if (!/(?:<\?php|<\?)/ig.test(env.code)) { |
| 1733 | Prism.hooks.add('before-highlight', function(env) { | | |
| 1734 | if (env.language !== 'php' || !/(?:<\?php|<\?)/ig.test(env.code)) { | | |
| 1735 | return; | 2016 | return; |
| 1736 | } | 2017 | } |
| 1737 | | 2018 | |
| 1738 | env.tokenStack = []; | 2019 | var phpPattern = /(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/ig; |
| 1739 | | 2020 | Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern); |
| 1740 | env.backupCode = env.code; | 2021 | }); |
| 1741 | env.code = env.code.replace(/(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/ig, function(match) { | | |
| 1742 | var i = env.tokenStack.length; | | |
| 1743 | // Check for existing strings | | |
| 1744 | while (env.backupCode.indexOf('___PHP' + i + '___') !== -1) | | |
| 1745 | ++i; | | |
| 1746 | | | |
| 1747 | // Create a sparse array | | |
| 1748 | env.tokenStack[i] = match; | | |
| 1749 | | | |
| 1750 | return '___PHP' + i + '___'; | | |
| 1751 | }); | | |
| 1752 | | 2022 | |
| 1753 | // Switch the grammar to markup | 2023 | Prism.hooks.add('after-tokenize', function(env) { |
| 1754 | env.grammar = Prism.languages.markup; | 2024 | Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php'); |
| 1755 | }); | 2025 | }); |
| 1756 | | 2026 | |
| 1757 | // Restore env.code for other plugins (e.g. line-numbers) | 2027 | }(Prism)); |
| 1758 | Prism.hooks.add('before-insert', function(env) { | 2028 | Prism.languages.sql= { |
| 1759 | if (env.language === 'php' && env.backupCode) { | 2029 | 'comment': { |
| 1760 | env.code = env.backupCode; | 2030 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/, |
| 1761 | delete env.backupCode; | 2031 | lookbehind: true |
| | 2032 | }, |
| | 2033 | 'string' : { |
| | 2034 | pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\])*\2/, |
| | 2035 | greedy: true, |
| | 2036 | lookbehind: true |
| | 2037 | }, |
| | 2038 | 'variable': /@[\w.$]+|@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/, |
| | 2039 | '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? |
| | 2040 | '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, |
| | 2041 | 'boolean': /\b(?:TRUE|FALSE|NULL)\b/i, |
| | 2042 | 'number': /\b0x[\da-f]+\b|\b\d+\.?\d*|\B\.\d+\b/i, |
| | 2043 | 'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i, |
| | 2044 | 'punctuation': /[;[\]()`,.]/ |
| | 2045 | }; |
| | 2046 | Prism.languages.scss = Prism.languages.extend('css', { |
| | 2047 | 'comment': { |
| | 2048 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, |
| | 2049 | lookbehind: true |
| | 2050 | }, |
| | 2051 | 'atrule': { |
| | 2052 | pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/, |
| | 2053 | inside: { |
| | 2054 | 'rule': /@[\w-]+/ |
| | 2055 | // See rest below |
| 1762 | } | 2056 | } |
| 1763 | }); | 2057 | }, |
| | 2058 | // url, compassified |
| | 2059 | 'url': /(?:[-a-z]+-)*url(?=\()/i, |
| | 2060 | // CSS selector regex is not appropriate for Sass |
| | 2061 | // since there can be lot more things (var, @ directive, nesting..) |
| | 2062 | // a selector must start at the end of a property or after a brace (end of other rules or nesting) |
| | 2063 | // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable |
| | 2064 | // 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 |
| | 2065 | // can "pass" as a selector- e.g: proper#{$erty}) |
| | 2066 | // this one was hard to do, so please be careful if you edit this one :) |
| | 2067 | 'selector': { |
| | 2068 | // Initial look-ahead is used to prevent matching of blank selectors |
| | 2069 | pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()]|&|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}]+[:{][^}]+))/m, |
| | 2070 | inside: { |
| | 2071 | 'parent': { |
| | 2072 | pattern: /&/, |
| | 2073 | alias: 'important' |
| | 2074 | }, |
| | 2075 | 'placeholder': /%[-\w]+/, |
| | 2076 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ |
| | 2077 | } |
| | 2078 | } |
| | 2079 | }); |
| 1764 | | 2080 | |
| 1765 | // Re-insert the tokens after highlighting | 2081 | Prism.languages.insertBefore('scss', 'atrule', { |
| 1766 | Prism.hooks.add('after-highlight', function(env) { | 2082 | 'keyword': [ |
| 1767 | if (env.language !== 'php' || !env.tokenStack) { | 2083 | /@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)/i, |
| 1768 | return; | 2084 | { |
| | 2085 | pattern: /( +)(?:from|through)(?= )/, |
| | 2086 | lookbehind: true |
| 1769 | } | 2087 | } |
| | 2088 | ] |
| | 2089 | }); |
| 1770 | | 2090 | |
| 1771 | // Switch the grammar back | 2091 | Prism.languages.scss.property = { |
| 1772 | env.grammar = Prism.languages.php; | 2092 | pattern: /(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/i, |
| | 2093 | inside: { |
| | 2094 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ |
| | 2095 | } |
| | 2096 | }; |
| 1773 | | 2097 | |
| 1774 | for (var i = 0, keys = Object.keys(env.tokenStack); i < keys.length; ++i) { | 2098 | Prism.languages.insertBefore('scss', 'important', { |
| 1775 | var k = keys[i]; | 2099 | // var and interpolated vars |
| 1776 | var t = env.tokenStack[k]; | 2100 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ |
| | 2101 | }); |
| 1777 | | 2102 | |
| 1778 | // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns | 2103 | Prism.languages.insertBefore('scss', 'function', { |
| 1779 | env.highlightedCode = env.highlightedCode.replace('___PHP' + k + '___', | 2104 | 'placeholder': { |
| 1780 | "<span class=\"token php language-php\">" + | 2105 | pattern: /%[-\w]+/, |
| 1781 | Prism.highlight(t, env.grammar, 'php').replace(/\$/g, '$$$$') + | 2106 | alias: 'selector' |
| 1782 | "</span>"); | 2107 | }, |
| 1783 | } | 2108 | 'statement': { |
| | 2109 | pattern: /\B!(?:default|optional)\b/i, |
| | 2110 | alias: 'keyword' |
| | 2111 | }, |
| | 2112 | 'boolean': /\b(?:true|false)\b/, |
| | 2113 | 'null': /\bnull\b/, |
| | 2114 | 'operator': { |
| | 2115 | pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/, |
| | 2116 | lookbehind: true |
| | 2117 | } |
| | 2118 | }); |
| 1784 | | 2119 | |
| 1785 | env.element.innerHTML = env.highlightedCode; | 2120 | Prism.languages.scss['atrule'].inside.rest = Prism.languages.scss; |
| 1786 | }); | | |
| 1787 | } | | |
| 1788 | ; | | |
| 1789 | Prism.languages.python = { | 2121 | Prism.languages.python = { |
| 1790 | 'comment': { | 2122 | 'comment': { |
| 1791 | pattern: /(^|[^\\])#.*/, | 2123 | pattern: /(^|[^\\])#.*/, |
| @@ -1811,7 +2143,7 @@ Prism.languages.python = { · 19 unmodified lines |
| 1811 | 'keyword': /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|pass|print|raise|return|try|while|with|yield)\b/, | 2143 | 'keyword': /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|pass|print|raise|return|try|while|with|yield)\b/, |
| 1812 | '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/, | 2144 | '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/, |
| 1813 | 'boolean': /\b(?:True|False|None)\b/, | 2145 | 'boolean': /\b(?:True|False|None)\b/, |
| 1814 | 'number': /\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i, | 2146 | 'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i, |
| 1815 | 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/, | 2147 | 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/, |
| 1816 | 'punctuation': /[{}[\];(),.:]/ | 2148 | 'punctuation': /[{}[\];(),.:]/ |
| 1817 | }; | 2149 | }; |
| @@ -1821,93 +2153,134 @@ Prism.languages.python = { · 3 unmodified lines |
| 1821 | var javascript = Prism.util.clone(Prism.languages.javascript); | 2153 | var javascript = Prism.util.clone(Prism.languages.javascript); |
| 1822 | | 2154 | |
| 1823 | Prism.languages.jsx = Prism.languages.extend('markup', javascript); | 2155 | Prism.languages.jsx = Prism.languages.extend('markup', javascript); |
| 1824 | Prism.languages.jsx.tag.pattern= /<\/?[\w.:-]+\s*(?:\s+(?:[\w\.:-]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+|(?:\{[^}]*\})))?|\{\.{3}\w+\}))*\s*\/?>/i; | 2156 | Prism.languages.jsx.tag.pattern= /<\/?(?:[\w.:-]+\s*(?:\s+(?:[\w.:-]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s{'">=]+|\{(?:\{(?:\{[^}]*\}|[^{}])*\}|[^{}])+\}))?|\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}))*\s*\/?)?>/i; |
| 1825 | | 2157 | |
| | 2158 | Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/i; |
| 1826 | Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">]+)/i; | 2159 | Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">]+)/i; |
| 1827 | | 2160 | |
| 1828 | Prism.languages.insertBefore('inside', 'attr-name', { | 2161 | Prism.languages.insertBefore('inside', 'attr-name', { |
| 1829 | 'spread': { | 2162 | 'spread': { |
| 1830 | pattern: /\{\.{3}\w+\}/, | 2163 | pattern: /\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}/, |
| 1831 | inside: { | 2164 | inside: { |
| 1832 | 'punctuation': /[{}]|\.{3}/, | 2165 | 'punctuation': /\.{3}|[{}.]/, |
| 1833 | 'attr-value': /\w+/ | 2166 | 'attr-value': /\w+/ |
| 1834 | } | 2167 | } |
| 1835 | } | 2168 | } |
| 1836 | }, Prism.languages.jsx.tag); | 2169 | }, Prism.languages.jsx.tag); |
| 1837 | | 2170 | |
| 1838 | var jsxExpression = Prism.util.clone(Prism.languages.jsx); | | |
| 1839 | | | |
| 1840 | delete jsxExpression.punctuation; | | |
| 1841 | | | |
| 1842 | jsxExpression = Prism.languages.insertBefore('jsx', 'operator', { | | |
| 1843 | 'punctuation': /=(?={)|[{}[\];(),.:]/ | | |
| 1844 | }, { jsx: jsxExpression }); | | |
| 1845 | | | |
| 1846 | Prism.languages.insertBefore('inside', 'attr-value',{ | 2171 | Prism.languages.insertBefore('inside', 'attr-value',{ |
| 1847 | 'script': { | 2172 | 'script': { |
| 1848 | // Allow for one level of nesting | 2173 | // Allow for two levels of nesting |
| 1849 | pattern: /=(\{(?:\{[^}]*\}|[^}])+\})/i, | 2174 | pattern: /=(\{(?:\{(?:\{[^}]*\}|[^}])*\}|[^}])+\})/i, |
| 1850 | inside: jsxExpression, | 2175 | inside: { |
| | 2176 | 'script-punctuation': { |
| | 2177 | pattern: /^=(?={)/, |
| | 2178 | alias: 'punctuation' |
| | 2179 | }, |
| | 2180 | rest: Prism.languages.jsx |
| | 2181 | }, |
| 1851 | 'alias': 'language-javascript' | 2182 | 'alias': 'language-javascript' |
| 1852 | } | 2183 | } |
| 1853 | }, Prism.languages.jsx.tag); | 2184 | }, Prism.languages.jsx.tag); |
| 1854 | | 2185 | |
| 1855 | }(Prism)); | 2186 | // The following will handle plain text inside tags |
| | 2187 | var stringifyToken = function (token) { |
| | 2188 | if (!token) { |
| | 2189 | return ''; |
| | 2190 | } |
| | 2191 | if (typeof token === 'string') { |
| | 2192 | return token; |
| | 2193 | } |
| | 2194 | if (typeof token.content === 'string') { |
| | 2195 | return token.content; |
| | 2196 | } |
| | 2197 | return token.content.map(stringifyToken).join(''); |
| | 2198 | }; |
| 1856 | | 2199 | |
| 1857 | (function(Prism) { | 2200 | var walkTokens = function (tokens) { |
| 1858 | Prism.languages.crystal = Prism.languages.extend('ruby', { | 2201 | var openedTags = []; |
| 1859 | keyword: [ | 2202 | for (var i = 0; i < tokens.length; i++) { |
| 1860 | /\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/, | 2203 | var token = tokens[i]; |
| 1861 | { | 2204 | var notTagNorBrace = false; |
| 1862 | pattern: /(\.\s*)(?:is_a|responds_to)\?/, | 2205 | |
| 1863 | lookbehind: true | 2206 | if (typeof token !== 'string') { |
| 1864 | } | 2207 | if (token.type === 'tag' && token.content[0] && token.content[0].type === 'tag') { |
| 1865 | ], | 2208 | // We found a tag, now find its kind |
| | 2209 | |
| | 2210 | if (token.content[0].content[0].content === '</') { |
| | 2211 | // Closing tag |
| | 2212 | if (openedTags.length > 0 && openedTags[openedTags.length - 1].tagName === stringifyToken(token.content[0].content[1])) { |
| | 2213 | // Pop matching opening tag |
| | 2214 | openedTags.pop(); |
| | 2215 | } |
| | 2216 | } else { |
| | 2217 | if (token.content[token.content.length - 1].content === '/>') { |
| | 2218 | // Autoclosed tag, ignore |
| | 2219 | } else { |
| | 2220 | // Opening tag |
| | 2221 | openedTags.push({ |
| | 2222 | tagName: stringifyToken(token.content[0].content[1]), |
| | 2223 | openedBraces: 0 |
| | 2224 | }); |
| | 2225 | } |
| | 2226 | } |
| | 2227 | } else if (openedTags.length > 0 && token.type === 'punctuation' && token.content === '{') { |
| 1866 | | 2228 | |
| 1867 | number: /\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[0-9a-fA-F_]*[0-9a-fA-F]|(?:\d(?:[0-9_]*\d)?)(?:\.[0-9_]*\d)?(?:[eE][+-]?[0-9_]*\d)?)(?:_(?:[uif](?:8|16|32|64))?)?\b/ | 2229 | // Here we might have entered a JSX context inside a tag |
| 1868 | }); | 2230 | openedTags[openedTags.length - 1].openedBraces++; |
| 1869 | | 2231 | |
| 1870 | var rest = Prism.util.clone(Prism.languages.crystal); | 2232 | } else if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces > 0 && token.type === 'punctuation' && token.content === '}') { |
| 1871 | | 2233 | |
| 1872 | Prism.languages.insertBefore('crystal', 'string', { | 2234 | // Here we might have left a JSX context inside a tag |
| 1873 | attribute: { | 2235 | openedTags[openedTags.length - 1].openedBraces--; |
| 1874 | pattern: /@\[.+?\]/, | | |
| 1875 | alias: 'attr-name', | | |
| 1876 | inside: { | | |
| 1877 | delimiter: { | | |
| 1878 | pattern: /^@\[|\]$/, | | |
| 1879 | alias: 'tag' | | |
| 1880 | }, | | |
| 1881 | rest: rest | | |
| 1882 | } | | |
| 1883 | }, | | |
| 1884 | | 2236 | |
| 1885 | expansion: [ | 2237 | } else { |
| 1886 | { | 2238 | notTagNorBrace = true |
| 1887 | pattern: /\{\{.+?\}\}/, | | |
| 1888 | inside: { | | |
| 1889 | delimiter: { | | |
| 1890 | pattern: /^\{\{|\}\}$/, | | |
| 1891 | alias: 'tag' | | |
| 1892 | }, | | |
| 1893 | rest: rest | | |
| 1894 | } | 2239 | } |
| 1895 | }, | 2240 | } |
| 1896 | { | 2241 | if (notTagNorBrace || typeof token === 'string') { |
| 1897 | pattern: /\{%.+?%\}/, | 2242 | if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces === 0) { |
| 1898 | inside: { | 2243 | // Here we are inside a tag, and not inside a JSX context. |
| 1899 | delimiter: { | 2244 | // That's plain text: drop any tokens matched. |
| 1900 | pattern: /^\{%|%\}$/, | 2245 | var plainText = stringifyToken(token); |
| 1901 | alias: 'tag' | 2246 | |
| 1902 | }, | 2247 | // And merge text with adjacent text |
| 1903 | rest: rest | 2248 | if (i < tokens.length - 1 && (typeof tokens[i + 1] === 'string' || tokens[i + 1].type === 'plain-text')) { |
| | 2249 | plainText += stringifyToken(tokens[i + 1]); |
| | 2250 | tokens.splice(i + 1, 1); |
| | 2251 | } |
| | 2252 | if (i > 0 && (typeof tokens[i - 1] === 'string' || tokens[i - 1].type === 'plain-text')) { |
| | 2253 | plainText = stringifyToken(tokens[i - 1]) + plainText; |
| | 2254 | tokens.splice(i - 1, 1); |
| | 2255 | i--; |
| | 2256 | } |
| | 2257 | |
| | 2258 | tokens[i] = new Prism.Token('plain-text', plainText, null, plainText); |
| 1904 | } | 2259 | } |
| 1905 | } | 2260 | } |
| 1906 | ] | 2261 | |
| 1907 | }); | 2262 | if (token.content && typeof token.content !== 'string') { |
| | 2263 | walkTokens(token.content); |
| | 2264 | } |
| | 2265 | } |
| | 2266 | }; |
| | 2267 | |
| | 2268 | Prism.hooks.add('after-tokenize', function (env) { |
| | 2269 | if (env.language !== 'jsx' && env.language !== 'tsx') { |
| | 2270 | return; |
| | 2271 | } |
| | 2272 | walkTokens(env.tokens); |
| | 2273 | }); |
| 1908 | | 2274 | |
| 1909 | }(Prism)); | 2275 | }(Prism)); |
| 1910 | | 2276 | |
| | 2277 | Prism.languages.typescript = Prism.languages.extend('javascript', { |
| | 2278 | // From JavaScript Prism keyword list and TypeScript language spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#221-reserved-words |
| | 2279 | 'keyword': /\b(?: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|var|void|while|with|yield|module|declare|constructor|namespace|abstract|require|type)\b/, |
| | 2280 | 'builtin': /\b(?:string|Function|any|number|boolean|Array|symbol|console)\b/, |
| | 2281 | }); |
| | 2282 | |
| | 2283 | Prism.languages.ts = Prism.languages.typescript; |
| 1911 | /* TODO | 2284 | /* TODO |
| 1912 | Add support for Markdown notation inside doc comments | 2285 | Add support for Markdown notation inside doc comments |
| 1913 | Add support for nested block comments... | 2286 | Add support for nested block comments... |
| @@ -1932,10 +2305,18 @@ Prism.languages.rust = { · 18 unmodified lines |
| 1932 | greedy: true | 2305 | greedy: true |
| 1933 | }, | 2306 | }, |
| 1934 | { | 2307 | { |
| 1935 | pattern: /b?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, | 2308 | pattern: /b?"(?:\\.|[^\\\r\n"])*"/, |
| 1936 | greedy: true | 2309 | greedy: true |
| 1937 | } | 2310 | } |
| 1938 | ], | 2311 | ], |
| | 2312 | 'char': { |
| | 2313 | pattern: /b?'(?:\\(?:x[0-7][\da-fA-F]|u{(?:[\da-fA-F]_*){1,6}|.)|[^\\\r\n\t'])'/, |
| | 2314 | alias: 'string' |
| | 2315 | }, |
| | 2316 | 'lifetime-annotation': { |
| | 2317 | pattern: /'[^\s>']+/, |
| | 2318 | alias: 'symbol' |
| | 2319 | }, |
| 1939 | 'keyword': /\b(?:abstract|alignof|as|be|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|match|mod|move|mut|offsetof|once|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/, | 2320 | 'keyword': /\b(?:abstract|alignof|as|be|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|match|mod|move|mut|offsetof|once|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/, |
| 1940 | | 2321 | |
| 1941 | 'attribute': { | 2322 | 'attribute': { |
| @@ -1955,7 +2336,7 @@ Prism.languages.rust = { · 13 unmodified lines |
| 1955 | }, | 2336 | }, |
| 1956 | | 2337 | |
| 1957 | // Hex, oct, bin, dec numbers with visual separators and type suffix | 2338 | // Hex, oct, bin, dec numbers with visual separators and type suffix |
| 1958 | 'number': /\b-?(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(\d(?:_?\d)*)?\.?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:[iu](?:8|16|32|64)?|f32|f64))?\b/, | 2339 | 'number': /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(\d(?:_?\d)*)?\.?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:[iu](?:8|16|32|64)?|f32|f64))?\b/, |
| 1959 | | 2340 | |
| 1960 | // Closure params should not be confused with bitwise OR | | 2341 | // Closure params should not be confused with bitwise OR | |
| 1961 | 'closure-params': { | 2342 | 'closure-params': { |
| @@ -1966,107 +2347,8 @@ Prism.languages.rust = { · 4 unmodified lines |
| 1966 | } | 2347 | } |
| 1967 | }, | 2348 | }, |
| 1968 | 'punctuation': /[{}[\];(),:]|\.+|->/, | 2349 | 'punctuation': /[{}[\];(),:]|\.+|->/, |
| 1969 | 'operator': /[-+*\/%!^=]=?|@|&[&=]?|\|[|=]?|<<?=?|>>?=?/ | 2350 | 'operator': /[-+*\/%!^]=?|=[=>]?|@|&[&=]?|\|[|=]?|<<?=?|>>?=?/ |
| 1970 | }; | 2351 | }; |
| 1971 | Prism.languages.scss = Prism.languages.extend('css', { | | |
| 1972 | 'comment': { | | |
| 1973 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, | | |
| 1974 | lookbehind: true | | |
| 1975 | }, | | |
| 1976 | 'atrule': { | | |
| 1977 | pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/, | | |
| 1978 | inside: { | | |
| 1979 | 'rule': /@[\w-]+/ | | |
| 1980 | // See rest below | | |
| 1981 | } | | |
| 1982 | }, | | |
| 1983 | // url, compassified | | |
| 1984 | 'url': /(?:[-a-z]+-)*url(?=\()/i, | | |
| 1985 | // CSS selector regex is not appropriate for Sass | | |
| 1986 | // since there can be lot more things (var, @ directive, nesting..) | | |
| 1987 | // a selector must start at the end of a property or after a brace (end of other rules or nesting) | | |
| 1988 | // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable | | |
| 1989 | // 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 | | |
| 1990 | // can "pass" as a selector- e.g: proper#{$erty}) | | |
| 1991 | // this one was hard to do, so please be careful if you edit this one :) | | |
| 1992 | 'selector': { | | |
| 1993 | // Initial look-ahead is used to prevent matching of blank selectors | | |
| 1994 | pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()]|&|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}]+[:{][^}]+))/m, | | |
| 1995 | inside: { | | |
| 1996 | 'parent': { | | |
| 1997 | pattern: /&/, | | |
| 1998 | alias: 'important' | | |
| 1999 | }, | | |
| 2000 | 'placeholder': /%[-\w]+/, | | |
| 2001 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ | | |
| 2002 | } | | |
| 2003 | } | | |
| 2004 | }); | | |
| 2005 | | | |
| 2006 | Prism.languages.insertBefore('scss', 'atrule', { | | |
| 2007 | 'keyword': [ | | |
| 2008 | /@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)/i, | | |
| 2009 | { | | |
| 2010 | pattern: /( +)(?:from|through)(?= )/, | | |
| 2011 | lookbehind: true | | |
| 2012 | } | | |
| 2013 | ] | | |
| 2014 | }); | | |
| 2015 | | | |
| 2016 | Prism.languages.scss.property = { | | |
| 2017 | pattern: /(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/i, | | |
| 2018 | inside: { | | |
| 2019 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ | | |
| 2020 | } | | |
| 2021 | }; | | |
| 2022 | | | |
| 2023 | Prism.languages.insertBefore('scss', 'important', { | | |
| 2024 | // var and interpolated vars | | |
| 2025 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ | | |
| 2026 | }); | | |
| 2027 | | | |
| 2028 | Prism.languages.insertBefore('scss', 'function', { | | |
| 2029 | 'placeholder': { | | |
| 2030 | pattern: /%[-\w]+/, | | |
| 2031 | alias: 'selector' | | |
| 2032 | }, | | |
| 2033 | 'statement': { | | |
| 2034 | pattern: /\B!(?:default|optional)\b/i, | | |
| 2035 | alias: 'keyword' | | |
| 2036 | }, | | |
| 2037 | 'boolean': /\b(?:true|false)\b/, | | |
| 2038 | 'null': /\bnull\b/, | | |
| 2039 | 'operator': { | | |
| 2040 | pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/, | | |
| 2041 | lookbehind: true | | |
| 2042 | } | | |
| 2043 | }); | | |
| 2044 | | | |
| 2045 | Prism.languages.scss['atrule'].inside.rest = Prism.util.clone(Prism.languages.scss); | | |
| 2046 | Prism.languages.sql= { | | |
| 2047 | 'comment': { | | |
| 2048 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/, | | |
| 2049 | lookbehind: true | | |
| 2050 | }, | | |
| 2051 | 'string' : { | | |
| 2052 | pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\])*\2/, | | |
| 2053 | greedy: true, | | |
| 2054 | lookbehind: true | | |
| 2055 | }, | | |
| 2056 | 'variable': /@[\w.$]+|@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/, | | |
| 2057 | 'function': /\b(?:COUNT|SUM|AVG|MIN|MAX|FIRST|LAST|UCASE|LCASE|MID|LEN|ROUND|NOW|FORMAT)(?=\s*\()/i, // Should we highlight user defined functions too? | | |
| 2058 | '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 VARYING|CHARACTER (?:SET|VARYING)|CHARSET|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|DATA(?:BASES?)?|DATE(?:TIME)?|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITER(?:S)?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE(?: PRECISION)?|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE KEY|ELSE|ENABLE|ENCLOSED BY|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPE(?:D BY)?|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|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTO|INVOKER|ISOLATION LEVEL|JOIN|KEYS?|KILL|LANGUAGE SQL|LAST|LEFT|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MODIFIES SQL DATA|MODIFY|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL(?: CHAR VARYING| CHARACTER(?: VARYING)?| VARCHAR)?|NATURAL|NCHAR(?: VARCHAR)?|NEXT|NO(?: SQL|CHECK|CYCLE)?|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|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READ(?:S SQL DATA|TEXT)?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEATABLE|REPLICATION|REQUIRE|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE MODE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|START(?:ING BY)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED BY|TEXT(?:SIZE)?|THEN|TIMESTAMP|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNPIVOT|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?)\b/i, | | |
| 2059 | 'boolean': /\b(?:TRUE|FALSE|NULL)\b/i, | | |
| 2060 | 'number': /\b-?(?:0x)?\d*\.?[\da-f]+\b/, | | |
| 2061 | 'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i, | | |
| 2062 | 'punctuation': /[;[\]()`,.]/ | | |
| 2063 | }; | | |
| 2064 | Prism.languages.typescript = Prism.languages.extend('javascript', { | | |
| 2065 | // From JavaScript Prism keyword list and TypeScript language spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#221-reserved-words | | |
| 2066 | 'keyword': /\b(?: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|var|void|while|with|yield|false|true|module|declare|constructor|string|Function|any|number|boolean|Array|symbol|namespace|abstract|require|type)\b/ | | |
| 2067 | }); | | |
| 2068 | | | |
| 2069 | Prism.languages.ts = Prism.languages.typescript; | | |
| 2070 | Prism.languages.yaml = { | 2352 | Prism.languages.yaml = { |
| 2071 | 'scalar': { | 2353 | 'scalar': { |
| 2072 | pattern: /([\-:]\s*(?:![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\2[^\r\n]+)*)/, | 2354 | pattern: /([\-:]\s*(?:![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\2[^\r\n]+)*)/, |
| @@ -2105,11 +2387,10 @@ Prism.languages.yaml = { · 32 unmodified lines |
| 2105 | greedy: true | 2387 | greedy: true |
| 2106 | }, | 2388 | }, |
| 2107 | 'number': { | 2389 | 'number': { |
| 2108 | pattern: /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)[+\-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+\.?\d*|\.?\d+)(?:e[+-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im, | 2390 | pattern: /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+\.?\d*|\.?\d+)(?:e[+-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im, |
| 2109 | lookbehind: true | 2391 | lookbehind: true |
| 2110 | }, | 2392 | }, |
| 2111 | 'tag': /![^\s]+/, | 2393 | 'tag': /![^\s]+/, |
| 2112 | 'important': /[&*][\w]+/, | 2394 | 'important': /[&*][\w]+/, |
| 2113 | 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./ | 2395 | 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./ |
| 2114 | }; | 2396 | }; |
| 2115 | | | |