Showing the changes to assets/javascripts (1 of 1 file). Show all
Unified · Split
| @@ -1,5 +1,5 @@ | |||
| 1 | /* PrismJS 1.15.0 | 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 | 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+groovy+java+json+kotlin+lua+crystal+nginx+nim+perl+php+sql+scss+python+jsx+typescript+rust+yaml */ |
| 3 | var _self = (typeof window !== 'undefined') | 3 | var _self = (typeof window !== 'undefined') |
| 4 | ? window // if in browser | 4 | ? window // if in browser |
| 5 | : ( | 5 | : ( |
| @@ -35,7 +35,7 @@ var _ = _self.Prism = { · 29 unmodified lines | |||
| 35 | }, | 35 | }, |
| 36 | 36 | ||
| 37 | type: function (o) { | 37 | type: function (o) { |
| 38 | return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1]; | 38 | return Object.prototype.toString.call(o).slice(8, -1); |
| 39 | }, | 39 | }, |
| 40 | 40 | ||
| 41 | objId: function (obj) { | 41 | objId: function (obj) { |
| @@ -98,56 +98,46 @@ var _ = _self.Prism = { · 56 unmodified lines | |||
| 98 | /** | 98 | /** |
| 99 | * Insert a token before another token in a language literal | 99 | * Insert a token before another token in a language literal |
| 100 | * As this needs to recreate the object (we cannot actually insert before keys in object literals), | 100 | * As this needs to recreate the object (we cannot actually insert before keys in object literals), |
| 101 | * we cannot just provide an object, we need anobject and a key. | 101 | * we cannot just provide an object, we need an object and a key. |
| 102 | * @param inside The key (or language id) of the parent | 102 | * @param inside The key (or language id) of the parent |
| 103 | * @param before The key to insert before. If not provided, the function appends instead. | 103 | * @param before The key to insert before. |
| 104 | * @param insert Object with the key/value pairs to insert | 104 | * @param insert Object with the key/value pairs to insert |
| 105 | * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted. | 105 | * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted. |
| 106 | */ | 106 | */ |
| 107 | insertBefore: function (inside, before, insert, root) { | 107 | insertBefore: function (inside, before, insert, root) { |
| 108 | root = root || _.languages; | 108 | root = root || _.languages; |
| 109 | var grammar = root[inside]; | 109 | var grammar = root[inside]; |
| 110 | |||
| 111 | if (arguments.length == 2) { | ||
| 112 | insert = arguments[1]; | ||
| 113 | |||
| 114 | for (var newToken in insert) { | ||
| 115 | if (insert.hasOwnProperty(newToken)) { | ||
| 116 | grammar[newToken] = insert[newToken]; | ||
| 117 | } | ||
| 118 | } | ||
| 119 | |||
| 120 | return grammar; | ||
| 121 | } | ||
| 122 | |||
| 123 | var ret = {}; | 110 | var ret = {}; |
| 124 | 111 | ||
| 125 | for (var token in grammar) { | 112 | for (var token in grammar) { |
| 126 | |||
| 127 | if (grammar.hasOwnProperty(token)) { | 113 | if (grammar.hasOwnProperty(token)) { |
| 128 | 114 | ||
| 129 | if (token == before) { | 115 | if (token == before) { |
| 130 | |||
| 131 | for (var newToken in insert) { | 116 | for (var newToken in insert) { |
| 132 | |||
| 133 | if (insert.hasOwnProperty(newToken)) { | 117 | if (insert.hasOwnProperty(newToken)) { |
| 134 | ret[newToken] = insert[newToken]; | 118 | ret[newToken] = insert[newToken]; |
| 135 | } | 119 | } |
| 136 | } | 120 | } |
| 137 | } | 121 | } |
| 138 | 122 | ||
| 139 | ret[token] = grammar[token]; | 123 | // Do not insert token which also occur in insert. See #1525 |
| 124 | if (!insert.hasOwnProperty(token)) { | ||
| 125 | ret[token] = grammar[token]; | ||
| 126 | } | ||
| 140 | } | 127 | } |
| 141 | } | 128 | } |
| 142 | 129 | ||
| 130 | var old = root[inside]; | ||
| 131 | root[inside] = ret; | ||
| 132 | |||
| 143 | // Update references in other language definitions | 133 | // Update references in other language definitions |
| 144 | _.languages.DFS(_.languages, function(key, value) { | 134 | _.languages.DFS(_.languages, function(key, value) { |
| 145 | if (value === root[inside] && key != inside) { | 135 | if (value === old && key != inside) { |
| 146 | this[key] = ret; | 136 | this[key] = ret; |
| 147 | } | 137 | } |
| 148 | }); | 138 | }); |
| 149 | 139 | ||
| 150 | return root[inside] = ret; | 140 | return ret; |
| 151 | }, | 141 | }, |
| 152 | 142 | ||
| 153 | // Traverse a language definition with Depth First Search | 143 | // Traverse a language definition with Depth First Search |
| @@ -224,53 +214,48 @@ var _ = _self.Prism = { · 70 unmodified lines | |||
| 224 | code: code | 214 | code: code |
| 225 | }; | 215 | }; |
| 226 | 216 | ||
| 217 | var insertHighlightedCode = function (highlightedCode) { | ||
| 218 | env.highlightedCode = highlightedCode; | ||
| 219 | |||
| 220 | _.hooks.run('before-insert', env); | ||
| 221 | |||
| 222 | env.element.innerHTML = env.highlightedCode; | ||
| 223 | |||
| 224 | _.hooks.run('after-highlight', env); | ||
| 225 | _.hooks.run('complete', env); | ||
| 226 | callback && callback.call(env.element); | ||
| 227 | } | ||
| 228 | |||
| 227 | _.hooks.run('before-sanity-check', env); | 229 | _.hooks.run('before-sanity-check', env); |
| 228 | 230 | ||
| 229 | if (!env.code || !env.grammar) { | 231 | if (!env.code) { |
| 230 | if (env.code) { | ||
| 231 | _.hooks.run('before-highlight', env); | ||
| 232 | env.element.textContent = env.code; | ||
| 233 | _.hooks.run('after-highlight', env); | ||
| 234 | } | ||
| 235 | _.hooks.run('complete', env); | 232 | _.hooks.run('complete', env); |
| 236 | return; | 233 | return; |
| 237 | } | 234 | } |
| 238 | 235 | ||
| 239 | _.hooks.run('before-highlight', env); | 236 | _.hooks.run('before-highlight', env); |
| 240 | 237 | ||
| 241 | // if (async && _self.Worker) { | 238 | if (!env.grammar) { |
| 242 | // var worker = new Worker(_.filename); | 239 | insertHighlightedCode(_.util.encode(env.code)); |
| 243 | 240 | return; | |
| 244 | // worker.onmessage = function(evt) { | 241 | } |
| 245 | // env.highlightedCode = evt.data; | ||
| 246 | |||
| 247 | // _.hooks.run('before-insert', env); | ||
| 248 | |||
| 249 | // env.element.innerHTML = env.highlightedCode; | ||
| 250 | |||
| 251 | // callback && callback.call(env.element); | ||
| 252 | // _.hooks.run('after-highlight', env); | ||
| 253 | // _.hooks.run('complete', env); | ||
| 254 | // }; | ||
| 255 | |||
| 256 | // worker.postMessage(JSON.stringify({ | ||
| 257 | // language: env.language, | ||
| 258 | // code: env.code, | ||
| 259 | // immediateClose: true | ||
| 260 | // })); | ||
| 261 | // } | ||
| 262 | // else { | ||
| 263 | env.highlightedCode = _.highlight(env.code, env.grammar, env.language); | ||
| 264 | |||
| 265 | _.hooks.run('before-insert', env); | ||
| 266 | 242 | ||
| 267 | env.element.innerHTML = env.highlightedCode; | 243 | if (async && _self.Worker) { |
| 244 | var worker = new Worker(_.filename); | ||
| 268 | 245 | ||
| 269 | callback && callback.call(element); | 246 | worker.onmessage = function(evt) { |
| 247 | insertHighlightedCode(evt.data); | ||
| 248 | }; | ||
| 270 | 249 | ||
| 271 | _.hooks.run('after-highlight', env); | 250 | worker.postMessage(JSON.stringify({ |
| 272 | _.hooks.run('complete', env); | 251 | language: env.language, |
| 273 | // } | 252 | code: env.code, |
| 253 | immediateClose: true | ||
| 254 | })); | ||
| 255 | } | ||
| 256 | else { | ||
| 257 | insertHighlightedCode(_.highlight(env.code, env.grammar, env.language)); | ||
| 258 | } | ||
| 274 | }, | 259 | }, |
| 275 | 260 | ||
| 276 | highlight: function (text, grammar, language) { | 261 | highlight: function (text, grammar, language) { |
| @@ -413,7 +398,7 @@ var _ = _self.Prism = { · 136 unmodified lines | |||
| 413 | } | 398 | } |
| 414 | }, | 399 | }, |
| 415 | 400 | ||
| 416 | tokenize: function(text, grammar, language) { | 401 | tokenize: function(text, grammar) { |
| 417 | var strarr = [text]; | 402 | var strarr = [text]; |
| 418 | 403 | ||
| 419 | var rest = grammar.rest; | 404 | var rest = grammar.rest; |
| @@ -501,49 +486,49 @@ Token.stringify = function(o, language, parent) { · 81 unmodified lines | |||
| 501 | 486 | ||
| 502 | }; | 487 | }; |
| 503 | 488 | ||
| 504 | // if (!_self.document) { | 489 | if (!_self.document) { |
| 505 | // if (!_self.addEventListener) { | 490 | if (!_self.addEventListener) { |
| 506 | // // in Node.js | 491 | // in Node.js |
| 507 | // return _self.Prism; | 492 | return _self.Prism; |
| 508 | // } | 493 | } |
| 509 | 494 | ||
| 510 | // if (!_.disableWorkerMessageHandler) { | 495 | if (!_.disableWorkerMessageHandler) { |
| 511 | // // In worker | 496 | // In worker |
| 512 | // _self.addEventListener('message', function (evt) { | 497 | _self.addEventListener('message', function (evt) { |
| 513 | // var message = JSON.parse(evt.data), | 498 | var message = JSON.parse(evt.data), |
| 514 | // lang = message.language, | 499 | lang = message.language, |
| 515 | // code = message.code, | 500 | code = message.code, |
| 516 | // immediateClose = message.immediateClose; | 501 | immediateClose = message.immediateClose; |
| 517 | 502 | ||
| 518 | // _self.postMessage(_.highlight(code, _.languages[lang], lang)); | 503 | _self.postMessage(_.highlight(code, _.languages[lang], lang)); |
| 519 | // if (immediateClose) { | 504 | if (immediateClose) { |
| 520 | // _self.close(); | 505 | _self.close(); |
| 521 | // } | 506 | } |
| 522 | // }, false); | 507 | }, false); |
| 523 | // } | 508 | } |
| 524 | 509 | ||
| 525 | // return _self.Prism; | 510 | return _self.Prism; |
| 526 | // } | 511 | } |
| 527 | 512 | ||
| 528 | // //Get current script and highlight | 513 | //Get current script and highlight |
| 529 | // var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop(); | 514 | var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop(); |
| 530 | 515 | ||
| 531 | // if (script) { | 516 | if (script) { |
| 532 | // _.filename = script.src; | 517 | _.filename = script.src; |
| 533 | 518 | ||
| 534 | // if (!_.manual && !script.hasAttribute('data-manual')) { | 519 | if (!_.manual && !script.hasAttribute('data-manual')) { |
| 535 | // if(document.readyState !== "loading") { | 520 | if(document.readyState !== "loading") { |
| 536 | // if (window.requestAnimationFrame) { | 521 | if (window.requestAnimationFrame) { |
| 537 | // window.requestAnimationFrame(_.highlightAll); | 522 | window.requestAnimationFrame(_.highlightAll); |
| 538 | // } else { | 523 | } else { |
| 539 | // window.setTimeout(_.highlightAll, 16); | 524 | window.setTimeout(_.highlightAll, 16); |
| 540 | // } | 525 | } |
| 541 | // } | 526 | } |
| 542 | // else { | 527 | else { |
| 543 | // document.addEventListener('DOMContentLoaded', _.highlightAll); | 528 | document.addEventListener('DOMContentLoaded', _.highlightAll); |
| 544 | // } | 529 | } |
| 545 | // } | 530 | } |
| 546 | // } | 531 | } |
| 547 | 532 | ||
| 548 | return _self.Prism; | 533 | return _self.Prism; |
| 549 | 534 | ||
| @@ -610,7 +595,7 @@ Prism.hooks.add('wrap', function(env) { · 60 unmodified lines | |||
| 610 | } | 595 | } |
| 611 | }); | 596 | }); |
| 612 | 597 | ||
| 613 | Prism.languages.xml = Prism.languages.markup; | 598 | Prism.languages.xml = Prism.languages.extend('markup', {}); |
| 614 | Prism.languages.html = Prism.languages.markup; | 599 | Prism.languages.html = Prism.languages.markup; |
| 615 | Prism.languages.mathml = Prism.languages.markup; | 600 | Prism.languages.mathml = Prism.languages.markup; |
| 616 | Prism.languages.svg = Prism.languages.markup; | 601 | Prism.languages.svg = Prism.languages.markup; |
| @@ -618,7 +603,7 @@ Prism.languages.svg = Prism.languages.markup; · 1 unmodified line | |||
| 618 | Prism.languages.css = { | 603 | Prism.languages.css = { |
| 619 | 'comment': /\/\*[\s\S]*?\*\//, | 604 | 'comment': /\/\*[\s\S]*?\*\//, |
| 620 | 'atrule': { | 605 | 'atrule': { |
| 621 | pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i, | 606 | pattern: /@[\w-]+?[\s\S]*?(?:;|(?=\s*\{))/i, |
| 622 | inside: { | 607 | inside: { |
| 623 | 'rule': /@[\w-]+/ | 608 | 'rule': /@[\w-]+/ |
| 624 | // See rest below | 609 | // See rest below |
| @@ -631,9 +616,9 @@ Prism.languages.css = { · 6 unmodified lines | |||
| 631 | greedy: true | 616 | greedy: true |
| 632 | }, | 617 | }, |
| 633 | 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i, | 618 | 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i, |
| 634 | 'important': /\B!important\b/i, | 619 | 'important': /!important\b/i, |
| 635 | 'function': /[-a-z0-9]+(?=\()/i, | 620 | 'function': /[-a-z0-9]+(?=\()/i, |
| 636 | 'punctuation': /[(){};:]/ | 621 | 'punctuation': /[(){};:,]/ |
| 637 | }; | 622 | }; |
| 638 | 623 | ||
| 639 | Prism.languages.css['atrule'].inside.rest = Prism.languages.css; | 624 | Prism.languages.css['atrule'].inside.rest = Prism.languages.css; |
| @@ -666,7 +651,8 @@ if (Prism.languages.markup) { · 26 unmodified lines | |||
| 666 | alias: 'language-css' | 651 | alias: 'language-css' |
| 667 | } | 652 | } |
| 668 | }, Prism.languages.markup.tag); | 653 | }, Prism.languages.markup.tag); |
| 669 | }; | 654 | } |
| 655 | ; | ||
| 670 | Prism.languages.clike = { | 656 | Prism.languages.clike = { |
| 671 | 'comment': [ | 657 | 'comment': [ |
| 672 | { | 658 | { |
| @@ -692,31 +678,67 @@ Prism.languages.clike = { · 19 unmodified lines | |||
| 692 | }, | 678 | }, |
| 693 | 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, | 679 | 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, |
| 694 | 'boolean': /\b(?:true|false)\b/, | 680 | 'boolean': /\b(?:true|false)\b/, |
| 695 | 'function': /[a-z0-9_]+(?=\()/i, | 681 | 'function': /\w+(?=\()/, |
| 696 | 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, | 682 | 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, |
| 697 | 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, | 683 | 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, |
| 698 | 'punctuation': /[{}[\];(),.:]/ | 684 | 'punctuation': /[{}[\];(),.:]/ |
| 699 | }; | 685 | }; |
| 700 | 686 | ||
| 701 | Prism.languages.javascript = Prism.languages.extend('clike', { | 687 | Prism.languages.javascript = Prism.languages.extend('clike', { |
| 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/, | 688 | 'class-name': [ |
| 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+)?/, | 689 | Prism.languages.clike['class-name'], |
| 690 | { | ||
| 691 | pattern: /(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/, | ||
| 692 | lookbehind: true | ||
| 693 | } | ||
| 694 | ], | ||
| 695 | 'keyword': [ | ||
| 696 | { | ||
| 697 | pattern: /((?:^|})\s*)(?:catch|finally)\b/, | ||
| 698 | lookbehind: true | ||
| 699 | }, | ||
| 700 | /\b(?:as|async|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/ | ||
| 701 | ], | ||
| 702 | 'number': /\b(?:(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+)n?|\d+n|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/, | ||
| 704 | // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) | 703 | // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) |
| 705 | 'function': /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i, | 704 | 'function': /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\(|\.(?:apply|bind|call)\()/, |
| 706 | 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ | 705 | 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ |
| 707 | }); | 706 | }); |
| 708 | 707 | ||
| 708 | Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/ | ||
| 709 | |||
| 709 | Prism.languages.insertBefore('javascript', 'keyword', { | 710 | Prism.languages.insertBefore('javascript', 'keyword', { |
| 710 | 'regex': { | 711 | 'regex': { |
| 711 | pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/, | 712 | pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/, |
| 712 | lookbehind: true, | 713 | lookbehind: true, |
| 713 | greedy: true | 714 | greedy: true |
| 714 | }, | 715 | }, |
| 715 | // This must be declared before keyword because we use "function" inside the look-forward | 716 | // This must be declared before keyword because we use "function" inside the look-forward |
| 716 | 'function-variable': { | 717 | 'function-variable': { |
| 717 | pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i, | 718 | pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i, |
| 718 | alias: 'function' | 719 | alias: 'function' |
| 719 | }, | 720 | }, |
| 721 | 'parameter': [ | ||
| 722 | { | ||
| 723 | pattern: /(function(?:\s+[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)[^\s()][^()]*?(?=\s*\))/, | ||
| 724 | lookbehind: true, | ||
| 725 | inside: Prism.languages.javascript | ||
| 726 | }, | ||
| 727 | { | ||
| 728 | pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/, | ||
| 729 | inside: Prism.languages.javascript | ||
| 730 | }, | ||
| 731 | { | ||
| 732 | pattern: /(\(\s*)[^\s()][^()]*?(?=\s*\)\s*=>)/, | ||
| 733 | lookbehind: true, | ||
| 734 | inside: Prism.languages.javascript | ||
| 735 | }, | ||
| 736 | { | ||
| 737 | pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)[^\s()][^()]*?(?=\s*\)\s*\{)/, | ||
| 738 | lookbehind: true, | ||
| 739 | inside: Prism.languages.javascript | ||
| 740 | } | ||
| 741 | ], | ||
| 720 | 'constant': /\b[A-Z][A-Z\d_]*\b/ | 742 | 'constant': /\b[A-Z][A-Z\d_]*\b/ |
| 721 | }); | 743 | }); |
| 722 | 744 | ||
| @@ -732,14 +754,13 @@ Prism.languages.insertBefore('javascript', 'string', { · 9 unmodified lines | |||
| 732 | pattern: /^\${|}$/, | 754 | pattern: /^\${|}$/, |
| 733 | alias: 'punctuation' | 755 | alias: 'punctuation' |
| 734 | }, | 756 | }, |
| 735 | rest: null // See below | 757 | rest: Prism.languages.javascript |
| 736 | } | 758 | } |
| 737 | }, | 759 | }, |
| 738 | 'string': /[\s\S]+/ | 760 | 'string': /[\s\S]+/ |
| 739 | } | 761 | } |
| 740 | } | 762 | } |
| 741 | }); | 763 | }); |
| 742 | Prism.languages.javascript['template-string'].inside['interpolation'].inside.rest = Prism.languages.javascript; | ||
| 743 | 764 | ||
| 744 | if (Prism.languages.markup) { | 765 | if (Prism.languages.markup) { |
| 745 | Prism.languages.insertBefore('markup', 'tag', { | 766 | Prism.languages.insertBefore('markup', 'tag', { |
| @@ -756,9 +777,13 @@ if (Prism.languages.markup) { · 10 unmodified lines | |||
| 756 | Prism.languages.js = Prism.languages.javascript; | 777 | Prism.languages.js = Prism.languages.javascript; |
| 757 | 778 | ||
| 758 | Prism.languages.c = Prism.languages.extend('clike', { | 779 | Prism.languages.c = Prism.languages.extend('clike', { |
| 780 | 'class-name': { | ||
| 781 | pattern: /(\b(?:enum|struct)\s+)\w+/, | ||
| 782 | lookbehind: true | ||
| 783 | }, | ||
| 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/, | 784 | '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/, |
| 760 | 'operator': /-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/]/, | 785 | 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/, |
| 761 | 'number': /(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i | 786 | 'number': /(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i |
| 762 | }); | 787 | }); |
| 763 | 788 | ||
| 764 | Prism.languages.insertBefore('c', 'string', { | 789 | Prism.languages.insertBefore('c', 'string', { |
| @@ -786,7 +811,6 @@ Prism.languages.insertBefore('c', 'string', { · 21 unmodified lines | |||
| 786 | 'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/ | 811 | 'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/ |
| 787 | }); | 812 | }); |
| 788 | 813 | ||
| 789 | delete Prism.languages.c['class-name']; | ||
| 790 | delete Prism.languages.c['boolean']; | 814 | delete Prism.languages.c['boolean']; |
| 791 | 815 | ||
| 792 | (function(Prism) { | 816 | (function(Prism) { |
| @@ -848,7 +872,7 @@ delete Prism.languages.c['boolean']; · 55 unmodified lines | |||
| 848 | 'variable': insideString.variable, | 872 | 'variable': insideString.variable, |
| 849 | // Originally based on http://ss64.com/bash/ | 873 | // Originally based on http://ss64.com/bash/ |
| 850 | 'function': { | 874 | 'function': { |
| 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;|&])/, | 875 | pattern: /(^|[\s;|&])(?:alias|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|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|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|hash|head|help|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logout|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tail|tar|tee|test|time|timeout|times|top|touch|tr|traceroute|trap|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip|zypper)(?=$|[\s;|&])/, |
| 852 | lookbehind: true | 876 | lookbehind: true |
| 853 | }, | 877 | }, |
| 854 | 'keyword': { | 878 | 'keyword': { |
| @@ -875,16 +899,13 @@ delete Prism.languages.c['boolean']; · 20 unmodified lines | |||
| 875 | })(Prism); | 899 | })(Prism); |
| 876 | 900 | ||
| 877 | Prism.languages.cpp = Prism.languages.extend('c', { | 901 | Prism.languages.cpp = Prism.languages.extend('c', { |
| 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/, | ||
| 879 | 'boolean': /\b(?:true|false)\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/ | ||
| 881 | }); | ||
| 882 | |||
| 883 | Prism.languages.insertBefore('cpp', 'keyword', { | ||
| 884 | 'class-name': { | 902 | 'class-name': { |
| 885 | pattern: /(class\s+)\w+/i, | 903 | pattern: /(\b(?:class|enum|struct)\s+)\w+/, |
| 886 | lookbehind: true | 904 | lookbehind: true |
| 887 | } | 905 | }, |
| 906 | '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/, | ||
| 907 | 'boolean': /\b(?:true|false)\b/, | ||
| 908 | 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/ | ||
| 888 | }); | 909 | }); |
| 889 | 910 | ||
| 890 | Prism.languages.insertBefore('cpp', 'string', { | 911 | Prism.languages.insertBefore('cpp', 'string', { |
| @@ -985,6 +1006,7 @@ Prism.languages.insertBefore('coffeescript', 'keyword', { · 94 unmodified lines | |||
| 985 | 1006 | ||
| 986 | delete Prism.languages.coffeescript['template-string']; | 1007 | delete Prism.languages.coffeescript['template-string']; |
| 987 | 1008 | ||
| 1009 | Prism.languages.coffee = Prism.languages.coffeescript; | ||
| 988 | }(Prism)); | 1010 | }(Prism)); |
| 989 | /** | 1011 | /** |
| 990 | * Original by Samuel Flores | 1012 | * Original by Samuel Flores |
| @@ -1015,6 +1037,8 @@ delete Prism.languages.coffeescript['template-string']; · 24 unmodified lines | |||
| 1015 | } | 1037 | } |
| 1016 | }; | 1038 | }; |
| 1017 | 1039 | ||
| 1040 | delete Prism.languages.ruby.function; | ||
| 1041 | |||
| 1018 | Prism.languages.insertBefore('ruby', 'keyword', { | 1042 | Prism.languages.insertBefore('ruby', 'keyword', { |
| 1019 | 'regex': [ | 1043 | 'regex': [ |
| 1020 | { | 1044 | { |
| @@ -1063,6 +1087,14 @@ delete Prism.languages.coffeescript['template-string']; · 42 unmodified lines | |||
| 1063 | 'symbol': { | 1087 | 'symbol': { |
| 1064 | pattern: /(^|[^:]):[a-zA-Z_]\w*(?:[?!]|\b)/, | 1088 | pattern: /(^|[^:]):[a-zA-Z_]\w*(?:[?!]|\b)/, |
| 1065 | lookbehind: true | 1089 | lookbehind: true |
| 1090 | }, | ||
| 1091 | 'method-definition': { | ||
| 1092 | pattern: /(\bdef\s+)[\w.]+/, | ||
| 1093 | lookbehind: true, | ||
| 1094 | inside: { | ||
| 1095 | 'function': /\w+$/, | ||
| 1096 | rest: Prism.languages.ruby | ||
| 1097 | } | ||
| 1066 | } | 1098 | } |
| 1067 | }); | 1099 | }); |
| 1068 | 1100 | ||
| @@ -1116,7 +1148,10 @@ delete Prism.languages.coffeescript['template-string']; · 47 unmodified lines | |||
| 1116 | } | 1148 | } |
| 1117 | } | 1149 | } |
| 1118 | ]; | 1150 | ]; |
| 1151 | |||
| 1152 | Prism.languages.rb = Prism.languages.ruby; | ||
| 1119 | }(Prism)); | 1153 | }(Prism)); |
| 1154 | |||
| 1120 | Prism.languages.d = Prism.languages.extend('clike', { | 1155 | Prism.languages.d = Prism.languages.extend('clike', { |
| 1121 | 'string': [ | 1156 | 'string': [ |
| 1122 | // r"", x"" | 1157 | // r"", x"" |
| @@ -1487,16 +1522,38 @@ Prism.languages.go = Prism.languages.extend('clike', { · 364 unmodified lines | |||
| 1487 | }); | 1522 | }); |
| 1488 | delete Prism.languages.go['class-name']; | 1523 | delete Prism.languages.go['class-name']; |
| 1489 | 1524 | ||
| 1490 | Prism.languages.java = Prism.languages.extend('clike', { | 1525 | Prism.languages.groovy = Prism.languages.extend('clike', { |
| 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/, | 1526 | 'keyword': /\b(?:as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/, |
| 1492 | 'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp-]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?[df]?/i, | 1527 | 'string': [ |
| 1528 | { | ||
| 1529 | pattern: /("""|''')[\s\S]*?\1|(?:\$\/)(?:\$\/\$|[\s\S])*?\/\$/, | ||
| 1530 | greedy: true | ||
| 1531 | }, | ||
| 1532 | { | ||
| 1533 | pattern: /(["'\/])(?:\\.|(?!\1)[^\\\r\n])*\1/, | ||
| 1534 | greedy: true | ||
| 1535 | } | ||
| 1536 | ], | ||
| 1537 | 'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?[\d]+)?)[glidf]?\b/i, | ||
| 1493 | 'operator': { | 1538 | 'operator': { |
| 1494 | pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m, | 1539 | pattern: /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.{1,2}(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/, |
| 1495 | lookbehind: true | 1540 | lookbehind: true |
| 1541 | }, | ||
| 1542 | 'punctuation': /\.+|[{}[\];(),:$]/ | ||
| 1543 | }); | ||
| 1544 | |||
| 1545 | Prism.languages.insertBefore('groovy', 'string', { | ||
| 1546 | 'shebang': { | ||
| 1547 | pattern: /#!.+/, | ||
| 1548 | alias: 'comment' | ||
| 1496 | } | 1549 | } |
| 1497 | }); | 1550 | }); |
| 1498 | 1551 | ||
| 1499 | Prism.languages.insertBefore('java','function', { | 1552 | Prism.languages.insertBefore('groovy', 'punctuation', { |
| 1553 | 'spock-block': /\b(?:setup|given|when|then|and|cleanup|expect|where):/ | ||
| 1554 | }); | ||
| 1555 | |||
| 1556 | Prism.languages.insertBefore('groovy', 'function', { | ||
| 1500 | 'annotation': { | 1557 | 'annotation': { |
| 1501 | alias: 'punctuation', | 1558 | alias: 'punctuation', |
| 1502 | pattern: /(^|[^.])@\w+/, | 1559 | pattern: /(^|[^.])@\w+/, |
| @@ -1504,28 +1561,103 @@ Prism.languages.insertBefore('java','function', { · 1 unmodified line | |||
| 1504 | } | 1561 | } |
| 1505 | }); | 1562 | }); |
| 1506 | 1563 | ||
| 1507 | Prism.languages.insertBefore('java', 'class-name', { | 1564 | // Handle string interpolation |
| 1508 | 'generics': { | 1565 | Prism.hooks.add('wrap', function(env) { |
| 1509 | pattern: /<\s*\w+(?:\.\w+)?(?:\s*,\s*\w+(?:\.\w+)?)*>/i, | 1566 | if (env.language === 'groovy' && env.type === 'string') { |
| 1510 | alias: 'function', | 1567 | var delimiter = env.content[0]; |
| 1511 | inside: { | 1568 | |
| 1512 | keyword: Prism.languages.java.keyword, | 1569 | if (delimiter != "'") { |
| 1513 | punctuation: /[<>(),.:]/ | 1570 | var pattern = /([^\\])(?:\$(?:\{.*?\}|[\w.]+))/; |
| 1571 | if (delimiter === '$') { | ||
| 1572 | pattern = /([^\$])(?:\$(?:\{.*?\}|[\w.]+))/; | ||
| 1573 | } | ||
| 1574 | |||
| 1575 | // To prevent double HTML-encoding we have to decode env.content first | ||
| 1576 | env.content = env.content.replace(/</g, '<').replace(/&/g, '&'); | ||
| 1577 | |||
| 1578 | env.content = Prism.highlight(env.content, { | ||
| 1579 | 'expression': { | ||
| 1580 | pattern: pattern, | ||
| 1581 | lookbehind: true, | ||
| 1582 | inside: Prism.languages.groovy | ||
| 1583 | } | ||
| 1584 | }); | ||
| 1585 | |||
| 1586 | env.classes.push(delimiter === '/' ? 'regex' : 'gstring'); | ||
| 1514 | } | 1587 | } |
| 1515 | } | 1588 | } |
| 1516 | }); | 1589 | }); |
| 1517 | 1590 | ||
| 1591 | (function (Prism) { | ||
| 1592 | |||
| 1593 | var keywords = /\b(?:abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while|var|null|exports|module|open|opens|provides|requires|to|transitive|uses|with)\b/; | ||
| 1594 | |||
| 1595 | // based on the java naming conventions | ||
| 1596 | var className = /\b[A-Z](?:\w*[a-z]\w*)?\b/; | ||
| 1597 | |||
| 1598 | Prism.languages.java = Prism.languages.extend('clike', { | ||
| 1599 | 'class-name': [ | ||
| 1600 | className, | ||
| 1601 | |||
| 1602 | // variables and parameters | ||
| 1603 | // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods) | ||
| 1604 | /\b[A-Z]\w*(?=\s+\w+\s*[;,=())])/ | ||
| 1605 | ], | ||
| 1606 | 'keyword': keywords, | ||
| 1607 | 'function': [ | ||
| 1608 | Prism.languages.clike.function, | ||
| 1609 | { | ||
| 1610 | pattern: /(\:\:)[a-z_]\w*/, | ||
| 1611 | lookbehind: true | ||
| 1612 | } | ||
| 1613 | ], | ||
| 1614 | 'number': /\b0b[01][01_]*L?\b|\b0x[\da-f_]*\.?[\da-f_p+-]+\b|(?:\b\d[\d_]*\.?[\d_]*|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i, | ||
| 1615 | 'operator': { | ||
| 1616 | pattern: /(^|[^.])(?:<<=?|>>>?=?|->|([-+&|])\2|[?:~]|[-+*/%&|^!=<>]=?)/m, | ||
| 1617 | lookbehind: true | ||
| 1618 | } | ||
| 1619 | }); | ||
| 1620 | |||
| 1621 | Prism.languages.insertBefore('java', 'class-name', { | ||
| 1622 | 'annotation': { | ||
| 1623 | alias: 'punctuation', | ||
| 1624 | pattern: /(^|[^.])@\w+/, | ||
| 1625 | lookbehind: true | ||
| 1626 | }, | ||
| 1627 | 'namespace': { | ||
| 1628 | pattern: /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)[a-z]\w*(\.[a-z]\w*)+/, | ||
| 1629 | lookbehind: true, | ||
| 1630 | inside: { | ||
| 1631 | 'punctuation': /\./, | ||
| 1632 | } | ||
| 1633 | }, | ||
| 1634 | 'generics': { | ||
| 1635 | pattern: /<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/, | ||
| 1636 | inside: { | ||
| 1637 | 'class-name': className, | ||
| 1638 | 'keyword': keywords, | ||
| 1639 | 'punctuation': /[<>(),.:]/, | ||
| 1640 | 'operator': /[?&|]/ | ||
| 1641 | } | ||
| 1642 | } | ||
| 1643 | }); | ||
| 1644 | }(Prism)); | ||
| 1645 | |||
| 1518 | Prism.languages.json = { | 1646 | Prism.languages.json = { |
| 1519 | 'property': /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i, | 1647 | 'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/, |
| 1648 | 'property': { | ||
| 1649 | pattern: /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/, | ||
| 1650 | greedy: true | ||
| 1651 | }, | ||
| 1520 | 'string': { | 1652 | 'string': { |
| 1521 | pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/, | 1653 | pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/, |
| 1522 | greedy: true | 1654 | greedy: true |
| 1523 | }, | 1655 | }, |
| 1524 | 'number': /-?\d+\.?\d*([Ee][+-]?\d+)?/, | 1656 | 'number': /-?\d+\.?\d*(e[+-]?\d+)?/i, |
| 1525 | 'punctuation': /[{}[\],]/, | 1657 | 'punctuation': /[{}[\],]/, |
| 1526 | 'operator': /:/g, | 1658 | 'operator': /:/, |
| 1527 | 'boolean': /\b(?:true|false)\b/i, | 1659 | 'boolean': /\b(?:true|false)\b/, |
| 1528 | 'null': /\bnull\b/i | 1660 | 'null': /\bnull\b/ |
| 1529 | }; | 1661 | }; |
| 1530 | 1662 | ||
| 1531 | Prism.languages.jsonp = Prism.languages.json; | 1663 | Prism.languages.jsonp = Prism.languages.json; |
| @@ -1670,12 +1802,13 @@ Prism.languages.nginx = Prism.languages.extend('clike', { · 138 unmodified lines | |||
| 1670 | pattern: /(^|[^"{\\])#.*/, | 1802 | pattern: /(^|[^"{\\])#.*/, |
| 1671 | lookbehind: true | 1803 | lookbehind: true |
| 1672 | }, | 1804 | }, |
| 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 | 1805 | 'keyword': /\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|events|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types|ssl_session_tickets|ssl_stapling|ssl_stapling_verify|ssl_ecdh_curve|ssl_trusted_certificate|more_set_headers|ssl_early_data)\b/i |
| 1674 | }); | 1806 | }); |
| 1675 | 1807 | ||
| 1676 | Prism.languages.insertBefore('nginx', 'keyword', { | 1808 | Prism.languages.insertBefore('nginx', 'keyword', { |
| 1677 | 'variable': /\$[a-z_]+/i | 1809 | 'variable': /\$[a-z_]+/i |
| 1678 | }); | 1810 | }); |
| 1811 | |||
| 1679 | Prism.languages.nim = { | 1812 | Prism.languages.nim = { |
| 1680 | 'comment': /#.*/, | 1813 | 'comment': /#.*/, |
| 1681 | // Double-quoted strings can be prefixed by an identifier (Generalized raw string literals) | 1814 | // Double-quoted strings can be prefixed by an identifier (Generalized raw string literals) |
| @@ -1915,8 +2048,15 @@ Prism.languages.perl = { · 233 unmodified lines | |||
| 1915 | */ | 2048 | */ |
| 1916 | (function (Prism) { | 2049 | (function (Prism) { |
| 1917 | Prism.languages.php = Prism.languages.extend('clike', { | 2050 | 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, | 2051 | 'keyword': /\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|new|or|parent|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i, |
| 1919 | 'constant': /\b[A-Z0-9_]{2,}\b/, | 2052 | 'boolean': { |
| 2053 | pattern: /\b(?:false|true)\b/i, | ||
| 2054 | alias: 'constant' | ||
| 2055 | }, | ||
| 2056 | 'constant': [ | ||
| 2057 | /\b[A-Z_][A-Z0-9_]*\b/, | ||
| 2058 | /\b(?:null)\b/i, | ||
| 2059 | ], | ||
| 1920 | 'comment': { | 2060 | 'comment': { |
| 1921 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, | 2061 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, |
| 1922 | lookbehind: true | 2062 | lookbehind: true |
| @@ -1954,6 +2094,14 @@ Prism.languages.perl = { · 31 unmodified lines | |||
| 1954 | } | 2094 | } |
| 1955 | }); | 2095 | }); |
| 1956 | 2096 | ||
| 2097 | var string_interpolation = { | ||
| 2098 | pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/, | ||
| 2099 | lookbehind: true, | ||
| 2100 | inside: { | ||
| 2101 | rest: Prism.languages.php | ||
| 2102 | } | ||
| 2103 | }; | ||
| 2104 | |||
| 1957 | Prism.languages.insertBefore('php', 'string', { | 2105 | Prism.languages.insertBefore('php', 'string', { |
| 1958 | 'nowdoc-string': { | 2106 | 'nowdoc-string': { |
| 1959 | pattern: /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/, | 2107 | pattern: /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/, |
| @@ -1981,7 +2129,7 @@ Prism.languages.perl = { · 21 unmodified lines | |||
| 1981 | 'punctuation': /^<<<"?|[";]$/ | 2129 | 'punctuation': /^<<<"?|[";]$/ |
| 1982 | } | 2130 | } |
| 1983 | }, | 2131 | }, |
| 1984 | 'interpolation': null // See below | 2132 | 'interpolation': string_interpolation // See below |
| 1985 | } | 2133 | } |
| 1986 | }, | 2134 | }, |
| 1987 | 'single-quoted-string': { | 2135 | 'single-quoted-string': { |
| @@ -1994,23 +2142,13 @@ Prism.languages.perl = { · 6 unmodified lines | |||
| 1994 | greedy: true, | 2142 | greedy: true, |
| 1995 | alias: 'string', | 2143 | alias: 'string', |
| 1996 | inside: { | 2144 | inside: { |
| 1997 | 'interpolation': null // See below | 2145 | 'interpolation': string_interpolation // See below |
| 1998 | } | 2146 | } |
| 1999 | } | 2147 | } |
| 2000 | }); | 2148 | }); |
| 2001 | // The different types of PHP strings "replace" the C-like standard string | 2149 | // The different types of PHP strings "replace" the C-like standard string |
| 2002 | delete Prism.languages.php['string']; | 2150 | delete Prism.languages.php['string']; |
| 2003 | 2151 | ||
| 2004 | var string_interpolation = { | ||
| 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; | ||
| 2013 | |||
| 2014 | Prism.hooks.add('before-tokenize', function(env) { | 2152 | Prism.hooks.add('before-tokenize', function(env) { |
| 2015 | if (!/(?:<\?php|<\?)/ig.test(env.code)) { | 2153 | if (!/(?:<\?php|<\?)/ig.test(env.code)) { |
| 2016 | return; | 2154 | return; |
| @@ -2025,17 +2163,23 @@ Prism.languages.perl = { · 8 unmodified lines | |||
| 2025 | }); | 2163 | }); |
| 2026 | 2164 | ||
| 2027 | }(Prism)); | 2165 | }(Prism)); |
| 2028 | Prism.languages.sql= { | 2166 | Prism.languages.sql = { |
| 2029 | 'comment': { | 2167 | 'comment': { |
| 2030 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/, | 2168 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/, |
| 2031 | lookbehind: true | 2169 | lookbehind: true |
| 2032 | }, | 2170 | }, |
| 2033 | 'string' : { | 2171 | 'variable': [ |
| 2034 | pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\])*\2/, | 2172 | { |
| 2173 | pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/, | ||
| 2174 | greedy: true | ||
| 2175 | }, | ||
| 2176 | /@[\w.$]+/ | ||
| 2177 | ], | ||
| 2178 | 'string': { | ||
| 2179 | pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/, | ||
| 2035 | greedy: true, | 2180 | greedy: true, |
| 2036 | lookbehind: true | 2181 | lookbehind: true |
| 2037 | }, | 2182 | }, |
| 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? | 2183 | '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, | 2184 | '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, | 2185 | 'boolean': /\b(?:TRUE|FALSE|NULL)\b/i, |
| @@ -2043,6 +2187,7 @@ Prism.languages.sql= { · 1 unmodified line | |||
| 2043 | 'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i, | 2187 | 'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i, |
| 2044 | 'punctuation': /[;[\]()`,.]/ | 2188 | 'punctuation': /[;[\]()`,.]/ |
| 2045 | }; | 2189 | }; |
| 2190 | |||
| 2046 | Prism.languages.scss = Prism.languages.extend('css', { | 2191 | Prism.languages.scss = Prism.languages.extend('css', { |
| 2047 | 'comment': { | 2192 | 'comment': { |
| 2048 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, | 2193 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, |
| @@ -2066,7 +2211,7 @@ Prism.languages.scss = Prism.languages.extend('css', { · 17 unmodified lines | |||
| 2066 | // this one was hard to do, so please be careful if you edit this one :) | 2211 | // this one was hard to do, so please be careful if you edit this one :) |
| 2067 | 'selector': { | 2212 | 'selector': { |
| 2068 | // Initial look-ahead is used to prevent matching of blank selectors | 2213 | // Initial look-ahead is used to prevent matching of blank selectors |
| 2069 | pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()]|&|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}]+[:{][^}]+))/m, | 2214 | pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()]|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}]+[:{][^}]+))/m, |
| 2070 | inside: { | 2215 | inside: { |
| 2071 | 'parent': { | 2216 | 'parent': { |
| 2072 | pattern: /&/, | 2217 | pattern: /&/, |
| @@ -2075,6 +2220,12 @@ Prism.languages.scss = Prism.languages.extend('css', { · 2 unmodified lines | |||
| 2075 | 'placeholder': /%[-\w]+/, | 2220 | 'placeholder': /%[-\w]+/, |
| 2076 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ | 2221 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ |
| 2077 | } | 2222 | } |
| 2223 | }, | ||
| 2224 | 'property': { | ||
| 2225 | pattern: /(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/, | ||
| 2226 | inside: { | ||
| 2227 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ | ||
| 2228 | } | ||
| 2078 | } | 2229 | } |
| 2079 | }); | 2230 | }); |
| 2080 | 2231 | ||
| @@ -2088,13 +2239,6 @@ Prism.languages.insertBefore('scss', 'atrule', { · 7 unmodified lines | |||
| 2088 | ] | 2239 | ] |
| 2089 | }); | 2240 | }); |
| 2090 | 2241 | ||
| 2091 | Prism.languages.scss.property = { | ||
| 2092 | pattern: /(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/i, | ||
| 2093 | inside: { | ||
| 2094 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ | ||
| 2095 | } | ||
| 2096 | }; | ||
| 2097 | |||
| 2098 | Prism.languages.insertBefore('scss', 'important', { | 2242 | Prism.languages.insertBefore('scss', 'important', { |
| 2099 | // var and interpolated vars | 2243 | // var and interpolated vars |
| 2100 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ | 2244 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/ |
| @@ -2118,18 +2262,42 @@ Prism.languages.insertBefore('scss', 'function', { · 17 unmodified lines | |||
| 2118 | }); | 2262 | }); |
| 2119 | 2263 | ||
| 2120 | Prism.languages.scss['atrule'].inside.rest = Prism.languages.scss; | 2264 | Prism.languages.scss['atrule'].inside.rest = Prism.languages.scss; |
| 2265 | |||
| 2121 | Prism.languages.python = { | 2266 | Prism.languages.python = { |
| 2122 | 'comment': { | 2267 | 'comment': { |
| 2123 | pattern: /(^|[^\\])#.*/, | 2268 | pattern: /(^|[^\\])#.*/, |
| 2124 | lookbehind: true | 2269 | lookbehind: true |
| 2125 | }, | 2270 | }, |
| 2271 | 'string-interpolation': { | ||
| 2272 | pattern: /(?:f|rf|fr)(?:("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i, | ||
| 2273 | greedy: true, | ||
| 2274 | inside: { | ||
| 2275 | 'interpolation': { | ||
| 2276 | // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}" | ||
| 2277 | pattern: /((?:^|[^{])(?:{{)*){(?!{)(?:[^{}]|{(?!{)(?:[^{}]|{(?!{)(?:[^{}])+})+})+}/, | ||
| 2278 | lookbehind: true, | ||
| 2279 | inside: { | ||
| 2280 | 'format-spec': { | ||
| 2281 | pattern: /(:)[^:(){}]+(?=}$)/, | ||
| 2282 | lookbehind: true | ||
| 2283 | }, | ||
| 2284 | 'conversion-option': { | ||
| 2285 | pattern: //, | ||
| 2286 | alias: 'punctuation' | ||
| 2287 | }, | ||
| 2288 | rest: null | ||
| 2289 | } | ||
| 2290 | }, | ||
| 2291 | 'string': /[\s\S]+/ | ||
| 2292 | } | ||
| 2293 | }, | ||
| 2126 | 'triple-quoted-string': { | 2294 | 'triple-quoted-string': { |
| 2127 | pattern: /("""|''')[\s\S]+?\1/, | 2295 | pattern: /(?:[rub]|rb|br)?("""|''')[\s\S]+?\1/i, |
| 2128 | greedy: true, | 2296 | greedy: true, |
| 2129 | alias: 'string' | 2297 | alias: 'string' |
| 2130 | }, | 2298 | }, |
| 2131 | 'string': { | 2299 | 'string': { |
| 2132 | pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, | 2300 | pattern: /(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i, |
| 2133 | greedy: true | 2301 | greedy: true |
| 2134 | }, | 2302 | }, |
| 2135 | 'function': { | 2303 | 'function': { |
| @@ -2140,14 +2308,25 @@ Prism.languages.python = { · 4 unmodified lines | |||
| 2140 | pattern: /(\bclass\s+)\w+/i, | 2308 | pattern: /(\bclass\s+)\w+/i, |
| 2141 | lookbehind: true | 2309 | lookbehind: true |
| 2142 | }, | 2310 | }, |
| 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/, | 2311 | 'decorator': { |
| 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/, | 2312 | pattern: /(^\s*)@\w+(?:\.\w+)*/i, |
| 2313 | lookbehind: true, | ||
| 2314 | alias: ['annotation', 'punctuation'], | ||
| 2315 | inside: { | ||
| 2316 | 'punctuation': /\./ | ||
| 2317 | } | ||
| 2318 | }, | ||
| 2319 | 'keyword': /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/, | ||
| 2320 | '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/, | ||
| 2145 | 'boolean': /\b(?:True|False|None)\b/, | 2321 | 'boolean': /\b(?:True|False|None)\b/, |
| 2146 | 'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i, | 2322 | 'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i, |
| 2147 | 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/, | 2323 | 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/, |
| 2148 | 'punctuation': /[{}[\];(),.:]/ | 2324 | 'punctuation': /[{}[\];(),.:]/ |
| 2149 | }; | 2325 | }; |
| 2150 | 2326 | ||
| 2327 | Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python; | ||
| 2328 | |||
| 2329 | Prism.languages.py = Prism.languages.python; | ||
| 2151 | (function(Prism) { | 2330 | (function(Prism) { |
| 2152 | 2331 | ||
| 2153 | var javascript = Prism.util.clone(Prism.languages.javascript); | 2332 | var javascript = Prism.util.clone(Prism.languages.javascript); |
| @@ -2157,6 +2336,7 @@ Prism.languages.jsx.tag.pattern= /<\/?(?:[\w.:-]+\s*(?:\s+(?:[\w.:-]+(?:=(?:("|' · 3 unmodified lines | |||
| 2157 | 2336 | ||
| 2158 | Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/i; | 2337 | Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/i; |
| 2159 | Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">]+)/i; | 2338 | Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">]+)/i; |
| 2339 | Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*$/; | ||
| 2160 | 2340 | ||
| 2161 | Prism.languages.insertBefore('inside', 'attr-name', { | 2341 | Prism.languages.insertBefore('inside', 'attr-name', { |
| 2162 | 'spread': { | 2342 | 'spread': { |
| @@ -2276,11 +2456,12 @@ Prism.hooks.add('after-tokenize', function (env) { · 113 unmodified lines | |||
| 2276 | 2456 | ||
| 2277 | Prism.languages.typescript = Prism.languages.extend('javascript', { | 2457 | 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 | 2458 | // 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/, | 2459 | 'keyword': /\b(?:abstract|as|async|await|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|is|keyof|let|module|namespace|new|null|of|package|private|protected|public|readonly|return|require|set|static|super|switch|this|throw|try|type|typeof|var|void|while|with|yield)\b/, |
| 2280 | 'builtin': /\b(?:string|Function|any|number|boolean|Array|symbol|console)\b/, | 2460 | 'builtin': /\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/, |
| 2281 | }); | 2461 | }); |
| 2282 | 2462 | ||
| 2283 | Prism.languages.ts = Prism.languages.typescript; | 2463 | Prism.languages.ts = Prism.languages.typescript; |
| 2464 | |||
| 2284 | /* TODO | 2465 | /* TODO |
| 2285 | Add support for Markdown notation inside doc comments | 2466 | Add support for Markdown notation inside doc comments |
| 2286 | Add support for nested block comments... | 2467 | Add support for nested block comments... |
| @@ -2317,7 +2498,7 @@ Prism.languages.rust = { · 30 unmodified lines | |||
| 2317 | pattern: /'[^\s>']+/, | 2498 | pattern: /'[^\s>']+/, |
| 2318 | alias: 'symbol' | 2499 | alias: 'symbol' |
| 2319 | }, | 2500 | }, |
| 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/, | 2501 | 'keyword': /\b(?:abstract|alignof|as|be|box|break|const|continue|crate|do|dyn|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|Self|struct|super|true|trait|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/, |
| 2321 | 2502 | ||
| 2322 | 'attribute': { | 2503 | 'attribute': { |
| 2323 | pattern: /#!?\[.+?\]/, | 2504 | pattern: /#!?\[.+?\]/, |
| @@ -2382,7 +2563,7 @@ Prism.languages.yaml = { · 58 unmodified lines | |||
| 2382 | alias: 'important' | 2563 | alias: 'important' |
| 2383 | }, | 2564 | }, |
| 2384 | 'string': { | 2565 | 'string': { |
| 2385 | pattern: /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)("|')(?:(?!\2)[^\\\r\n]|\\.)*\2(?=[ \t]*(?:$|,|]|}))/m, | 2566 | pattern: /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)("|')(?:(?!\2)[^\\\r\n]|\\.)*\2(?=[ \t]*(?:$|,|]|}|\s*#))/m, |
| 2386 | lookbehind: true, | 2567 | lookbehind: true, |
| 2387 | greedy: true | 2568 | greedy: true |
| 2388 | }, | 2569 | }, |
| @@ -2394,3 +2575,5 @@ Prism.languages.yaml = { · 5 unmodified lines | |||
| 2394 | 'important': /[&*][\w]+/, | 2575 | 'important': /[&*][\w]+/, |
| 2395 | 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./ | 2576 | 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./ |
| 2396 | }; | 2577 | }; |
| 2578 | |||
| 2579 | Prism.languages.yml = Prism.languages.yaml; | ||