/usr/share/javascript/rainbow/rainbow-full.min.js is in libjs-rainbow 1.1.8+ds1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /**
* Copyright 2012 Craig Campbell
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Rainbow is a simple code syntax highlighter
*
* @preserve @version 1.1.8
* @url rainbowco.de
*/window.Rainbow=function(){function k(a,b,c,d){var e=a.getAttribute&&a.getAttribute(b)||0;if(!e){c=a.attributes;for(d=0;d<c.length;++d)if(c[d].nodeName===b)return c[d].nodeValue}return e}function l(a,b){a.className+=a.className?" "+b:b}function m(a,b){return(" "+a.className+" ").indexOf(" "+b+" ")>-1}function n(a){var b=k(a,"data-language")||k(a.parentNode,"data-language");if(!b){var c=/\blang(?:uage)?-(\w+)/,d=a.className.match(c)||a.parentNode.className.match(c);d&&(b=d[1])}return b}function o(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/&(?![\w\#]+;)/g,"&")}function p(a,b,c,d){return c>=a&&c<b?!0:d>a&&d<b}function q(a,b,c,d){return c==a&&d==b?!1:c<=a&&d>=b}function r(c,d){for(var f in b[e]){f=parseInt(f,10),q(f,b[e][f],c,d)&&(delete b[e][f],delete a[e][f]);if(p(f,b[e][f],c,d))return!0}return!1}function s(a,b){return'<span class="'+a.replace(/\./g," ")+(i?" "+i:"")+'">'+b+"</span>"}function t(a,b){var c=0,d;for(d=1;d<b;++d)a[d]&&(c+=a[d].length);return c}function u(c,d,f,h){var i=c.exec(f);if(!i)return h();++g,!d.name&&typeof d["matches"][0]=="string"&&(d.name=d.matches[0],delete d.matches[0]);var j=i[0],k=i.index,l=i[0].length+k,m=function(){var a=function(){u(c,d,f,h)};return g%100>0?a():setTimeout(a,0)};if(r(k,l))return m();var n=function(c){d.name&&(c=s(d.name,c)),a[e]||(a[e]={},b[e]={}),a[e][k]={replace:i[0],"with":c},b[e][k]=l,m()},o=y(d.matches),p=function(a,b,c){if(a>=b.length)return c(j);var e=function(){p(++a,b,c)},f=i[b[a]];if(!f)return e();var g=d.matches[b[a]],h=g.language,k=g.name&&g.matches?g.matches:g,l=function(c,d,f){j=x(t(i,b[a]),c,f?s(f,d):d,j),e()};if(h)return B(f,h,function(a){l(f,a)});if(typeof g=="string")return l(f,f,g);z(f,k.length?k:[k],function(a){l(f,a,g.matches?g.name:0)})};p(0,o,n)}function v(a){return d[a]}function w(a){var b=c[a]||[],d=c[f]||[];return v(a)?b:b.concat(d)}function x(a,b,c,d){var e=d.substr(a);return d.substr(0,a)+e.replace(b,c)}function y(a){var b=[],c,d;for(var e in a)a.hasOwnProperty(e)&&b.push(e);return b.sort(function(a,b){return b-a})}function z(c,d,f){function g(d,h){if(h<d.length)return u(d[h].pattern,d[h],c,function(){g(d,++h)});A(c,function(c){delete a[e],delete b[e],--e,f(c)})}++e,g(d,0)}function A(b,c){function d(b,c,f,g){if(f<c.length){++h;var i=c[f],j=a[e][i];b=x(i,j.replace,j["with"],b);var k=function(){d(b,c,++f,g)};return h%250>0?k():setTimeout(k,0)}g(b)}var f=y(a[e]);d(b,f,0,c)}function B(a,b,c){var d=w(b);z(o(a),d,c)}function C(c,d,e){if(d<c.length){var f=c[d],g=n(f);return!m(f,"rainbow")&&g?(g=g.toLowerCase(),l(f,"rainbow"),B(f.innerHTML,g,function(h){f.innerHTML=h,a={},b={},j&&j(f,g),setTimeout(function(){C(c,++d,e)},0)})):C(c,++d,e)}e&&e()}function D(a,b){a=a&&typeof a.getElementsByTagName=="function"?a:document;var c=a.getElementsByTagName("pre"),d=a.getElementsByTagName("code"),e,f=[];for(e=0;e<d.length;++e)f.push(d[e]);for(e=0;e<c.length;++e)c[e].getElementsByTagName("code").length||f.push(c[e]);C(f,0,b)}var a={},b={},c={},d={},e=0,f=0,g=0,h=0,i,j;return{extend:function(a,b,e){arguments.length==1&&(b=a,a=f),d[a]=e,c[a]=b.concat(c[a]||[])},onHighlight:function(a){j=a},addClass:function(a){i=a},color:function(){if(typeof arguments[0]=="string")return B(arguments[0],arguments[1],arguments[2]);if(typeof arguments[0]=="function")return D(0,arguments[0]);D(arguments[0],arguments[1])}}}(),function(){if(window.addEventListener)return window.addEventListener("load",Rainbow.color,!1);window.attachEvent("onload",Rainbow.color)}(),Rainbow.onHighlight=Rainbow.onHighlight,Rainbow.addClass=Rainbow.addClass,Rainbow.extend("c",[{matches:{2:[{matches:{1:"keyword.define",2:"entity.name"},pattern:/(\w+)\s(\w+)\b/g},{name:"keyword.define",pattern:/endif/g},{matches:{1:"keyword.include",2:"string"},pattern:/(include)\s(.*?)$/g}]},pattern:/(\#)([\S\s]*?)$/gm},{name:"keyword",pattern:/\b(do|goto|continue|break|switch|case|typedef)\b/g},{name:"entity.label",pattern:/\w+:/g},{matches:{1:"storage.type",3:"storage.type",4:"entity.name.function"},pattern:/\b((un)?signed|const)?\s?(void|char|short|int|long|float|double)\*?(\s(\w+)(?=\())?/g},{matches:{2:"entity.name.function"},pattern:/(\w|\*)(\s(\w+)(?=\())?/g},{name:"storage.modifier",pattern:/\b(static|extern|auto|register|volatile|inline)\b/g},{name:"support.type",pattern:/\b(struct|union|enum)\b/g},{name:"variable",pattern:/\b[A-Z0-9_]{2,}\b/g},{matches:{1:"support.function.call"},pattern:/(\w{4,})(?=\()/g}]),Rainbow.extend("css",[{name:"comment",pattern:/\/\*[\s\S]*?\*\//gm},{name:"constant.hex-color",pattern:/#([a-f0-9]{3}|[a-f0-9]{6})(?=;|\s)/gi},{matches:{1:"constant.numeric",2:"keyword.unit"},pattern:/(\d+)(px|cm|s|%)?/g},{name:"string",pattern:/('|")(.*?)\1/g},{name:"support.css-property",matches:{1:"support.vendor-prefix"},pattern:/(-o-|-moz-|-webkit-|-ms-)?[\w-]+(?=\s?:)(?!.*\{)/g},{matches:{1:[{name:"entity.name.sass",pattern:/&/g},{name:"direct-descendant",pattern:/>/g},{name:"entity.name.class",pattern:/\.[\w\-_]+/g},{name:"entity.name.id",pattern:/\#[\w\-_]+/g},{name:"entity.name.pseudo",pattern:/:[\w\-_]+/g},{name:"entity.name.tag",pattern:/\w+/g}]},pattern:/([\w\ ,:\.\#\&\;\-_]+)(?=.*\{)/g},{matches:{2:"support.vendor-prefix",3:"support.css-value"},pattern:/(:|,)\s?(-o-|-moz-|-webkit-|-ms-)?([a-zA-Z-]*)(?=\b)(?!.*\{)/g},{matches:{1:"support.tag.style",2:[{name:"string",pattern:/('|")(.*?)(\1)/g},{name:"entity.tag.style",pattern:/(\w+)/g}],3:"support.tag.style"},pattern:/(<\/?)(style.*?)(>)/g}],!0),Rainbow.extend([{matches:{1:{name:"keyword.operator",pattern:/\=/g},2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\('|"){1}/g}}},pattern:/(\(|\s|\[|\=)(('|")([^\\\1]|\\.)*?(\3))/gm},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/|\#)[\s\S]*?$/gm},{name:"constant.numeric",pattern:/\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi},{name:"constant",pattern:/\b[A-Z0-9_]{2,}\b/g},{matches:{1:"keyword"},pattern:/\b(and|array|as|bool(ean)?|c(atch|har|lass|onst)|d(ef|elete|ie|o(uble)?)|e(cho|lse(if)?|xit|xtends|xcept)|f(inally|loat|or(each)?|unction)|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|public|return|self|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while)(?=\(|\b)/gi},{name:"constant.language",pattern:/true|false|null/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\||\*|\=/g},{matches:{1:"function.call"},pattern:/(\w+?)(?=\()/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(function)\s(.*?)(?=\()/g}]),Rainbow.extend("html",[{name:"source.php.embedded",matches:{2:{language:"php"}},pattern:/<\?(php)?([\s\S]*?)(\?>)/gm},{name:"source.css.embedded",matches:{0:{language:"css"}},pattern:/<style(.*?)>([\s\S]*?)<\/style>/gm},{name:"source.js.embedded",matches:{0:{language:"javascript"}},pattern:/<script(?! src)(.*?)>([\s\S]*?)<\/script>/gm},{name:"comment.html",pattern:/<\!--[\S\s]*?-->/g},{matches:{1:"support.tag.open",2:"support.tag.close"},pattern:/(<)|(\/?>)/g},{name:"support.tag",matches:{1:"support.tag",2:"support.tag.special",3:"support.tag-name"},pattern:/(<)(\/|\!?)(\w+)/g},{matches:{1:"support.attribute"},pattern:/([a-z-]+)(?=\=)/g},{matches:{1:"support.operator",2:"string.quote",3:"string.value",4:"string.quote"},pattern:/(=)('|")(.*?)(\2)/g},{matches:{1:"support.operator",2:"support.value"},pattern:/(=)([a-zA-Z\-0-9]*)\b/g},{matches:{1:"support.attribute"},pattern:/\s(\w+)(?=\s|>)(?![\s\S]*<)/g}],!0),Rainbow.extend("javascript",[{name:"selector",pattern:/(\s|^)\$(?=\.|\()/g},{name:"support",pattern:/\b(window|document)\b/g},{matches:{1:"support.property"},pattern:/\.(length|node(Name|Value))\b/g},{matches:{1:"support.function"},pattern:/(setTimeout|setInterval)(?=\()/g},{matches:{1:"support.method"},pattern:/\.(getAttribute|push|getElementById|getElementsByClassName|log|setTimeout|setInterval)(?=\()/g},{matches:{1:"support.tag.script",2:[{name:"string",pattern:/('|")(.*?)(\1)/g},{name:"entity.tag.script",pattern:/(\w+)/g}],3:"support.tag.script"},pattern:/(<\/?)(script.*?)(>)/g},{name:"string.regexp",matches:{1:"string.regexp.open",2:{name:"constant.regexp.escape",pattern:/\\(.){1}/g},3:"string.regexp.close",4:"string.regexp.modifier"},pattern:/(\/)(?!\*)(.+)(\/)([igm]{0,3})/g},{matches:{1:"storage",3:"entity.function"},pattern:/(var)?(\s|^)(.*)(?=\s?=\s?function\()/g},{name:"entity.function",pattern:/(\w+)(?=:\s{0,}function)/g}]),Rainbow.extend("php",[{name:"support",pattern:/\becho\b/g},{matches:{1:"variable.dollar-sign",2:"variable"},pattern:/(\$)(\w+)\b/g},{name:"keyword.dot",pattern:/\./g},{name:"keyword",pattern:/\b(continue|break|end(for(each)?|switch|if)|case|require(_once)?|include(_once)?)(?=\(|\b)/g},{matches:{1:"keyword",2:{name:"support.class",pattern:/\w+/g}},pattern:/(instanceof)\s([^\$].*?)(\)|;)/g},{matches:{1:"support.function"},pattern:/\b(array(_key_exists|_merge|_keys|_shift)?|isset|count|empty|unset|printf|is_(array|string|numeric|object)|sprintf|each|date|time|substr|pos|str(len|pos|tolower|_replace|totime)?|ord|trim|in_array|implode|end|preg_match|explode|fmod|define|link|list|get_class|serialize|file|sort|mail|dir|idate|log|intval|header|chr|function_exists|dirname|preg_replace|file_exists)(?=\()/g},{name:"variable.language.php-tag",pattern:/(<\?(php)?|\?>)/g},{matches:{1:"keyword.namespace",2:{name:"support.namespace",pattern:/\w+/g}},pattern:/\b(namespace)\s(.*?);/g},{matches:{1:"storage.modifier",2:"storage.class",3:"entity.name.class",4:"storage.modifier.extends",5:"entity.other.inherited-class"},pattern:/\b(abstract|final)?\s?(class)\s(\w+)(\sextends\s)?([\w\\]*)?\s?\{?(\n|\})/g},{name:"keyword.static",pattern:/self::|static::/g},{matches:{1:"storage.function",2:"support.magic"},pattern:/(function)\s(__.*?)(?=\()/g},{matches:{1:"keyword.new",2:{name:"support.class",pattern:/\w+/g}},pattern:/\b(new)\s([^\$].*?)(?=\)|\(|;)/g},{matches:{1:{name:"support.class",pattern:/\w+/g},2:"keyword.static"},pattern:/([\w\\]*?)(::)(?=\b|\$)/g},{matches:{2:{name:"support.class",pattern:/\w+/g}},pattern:/(\(|,\s?)([\w\\]*?)(?=\s\$)/g}]),Rainbow.extend("python",[{name:"variable",pattern:/\b[A-Z0-9_]{2,}\b/g},{name:"variable.self",pattern:/self/g},{name:"constant.language",pattern:/None|True|False/g},{name:"support.object",pattern:/object/g},{name:"support.function.python",pattern:/\b(bs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|bin|file|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern)(?=\()/g},{matches:{1:"keyword"},pattern:/\b(pass|lambda|with|is|not|in|from|elif)(?=\(|\b)/g},{matches:{1:"storage.class",2:"entity.name.class",3:"entity.other.inherited-class"},pattern:/(class)\s+(\w+)\((\w+?)\)/g},{matches:{1:"storage.function",2:"support.magic"},pattern:/(def)\s+(__\w+)(?=\()/g},{name:"support.magic",pattern:/__(name)__/g},{matches:{1:"keyword.control",2:"support.exception.type"},pattern:/(except) (\w+):/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(def)\s+(\w+)(?=\()/g},{name:"entity.name.function.decorator",pattern:/@(\w+)/g},{name:"comment.docstring",pattern:/('{3}|"{3})[\s\S]*\1/gm}]),Rainbow.extend("ruby",[{name:"string",matches:{1:"string.open",2:{name:"string.keyword",pattern:/(\#\{.*?\})/g},3:"string.close"},pattern:/("|`)(.*?[^\\\1])?(\1)/g},{name:"string",pattern:/('|"|`)([^\\\1\n]|\\.)*\1/g},{name:"string",pattern:/%[qQ](?=(\(|\[|\{|<|.)(.*?)(?:'|\)|\]|\}|>|\1))(?:\(\2\)|\[\2\]|\{\2\}|\<\2>|\1\2\1)/g},{matches:{1:"string",2:"string",3:"string"},pattern:/(<<)(\w+).*?$([\s\S]*?^\2)/gm},{matches:{1:"string",2:"string",3:"string"},pattern:/(<<\-)(\w+).*?$([\s\S]*?\2)/gm},{name:"string.regexp",matches:{1:"string.regexp",2:{name:"string.regexp",pattern:/\\(.){1}/g},3:"string.regexp",4:"string.regexp"},pattern:/(\/)(.*?)(\/)([a-z]*)/g},{name:"string.regexp",matches:{1:"string.regexp",2:{name:"string.regexp",pattern:/\\(.){1}/g},3:"string.regexp",4:"string.regexp"},pattern:/%r(?=(\(|\[|\{|<|.)(.*?)('|\)|\]|\}|>|\1))(?:\(\2\)|\[\2\]|\{\2\}|\<\2>|\1\2\1)([a-z]*)/g},{name:"comment",pattern:/#.*$/gm},{name:"comment",pattern:/^\=begin[\s\S]*?\=end$/gm},{matches:{1:"constant"},pattern:/(\w+:)[^:]/g},{matches:{1:"constant.symbol"},pattern:/[^:](:(?:\w+|(?=['"](.*?)['"])(?:"\2"|'\2')))/g},{name:"constant.numeric",pattern:/\b(0x[\da-f]+|\d+)\b/g},{name:"support.class",pattern:/\b[A-Z]\w*(?=((\.|::)[A-Za-z]|\[))/g},{name:"constant",pattern:/\b[A-Z]\w*\b/g},{matches:{1:"storage.class",2:"entity.name.class",3:"entity.other.inherited-class"},pattern:/\s*(class)\s+((?:(?:::)?[A-Z]\w*)+)(?:\s+<\s+((?:(?:::)?[A-Z]\w*)+))?/g},{matches:{1:"storage.module",2:"entity.name.class"},pattern:/\s*(module)\s+((?:(?:::)?[A-Z]\w*)+)/g},{name:"variable.global",pattern:/\$([a-zA-Z_]\w*)\b/g},{name:"variable.class",pattern:/@@([a-zA-Z_]\w*)\b/g},{name:"variable.instance",pattern:/@([a-zA-Z_]\w*)\b/g},{matches:{1:"keyword.control"},pattern:/[^\.]\b(BEGIN|begin|case|class|do|else|elsif|END|end|ensure|for|if|in|module|rescue|then|unless|until|when|while)\b(?![?!])/g},{matches:{1:"keyword.control.pseudo-method"},pattern:/[^\.]\b(alias|alias_method|break|next|redo|retry|return|super|undef|yield)\b(?![?!])|\bdefined\?|\bblock_given\?/g},{matches:{1:"constant.language"},pattern:/\b(nil|true|false)\b(?![?!])/g},{matches:{1:"variable.language"},pattern:/\b(__(FILE|LINE)__|self)\b(?![?!])/g},{matches:{1:"keyword.special-method"},pattern:/\b(require|gem|initialize|new|loop|include|extend|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|module_function|public|protected)\b(?![?!])/g},{name:"keyword.operator",pattern:/\s\?\s|=|<<|<<=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<<|<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|%|&|\*\*|\*|\+|\-|\/|\||~|>>/g},{matches:{1:"keyword.operator.logical"},pattern:/[^\.]\b(and|not|or)\b/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(def)\s(.*?)(?=(\s|\())/g}],!0),Rainbow.extend("shell",[{name:"shell",matches:{1:{language:"shell"}},pattern:/\$\(([\s\S]*?)\)/gm},{matches:{2:"string"},pattern:/(\(|\s|\[|\=)(('|")[\s\S]*?(\3))/gm},{name:"keyword.operator",pattern:/<|>|&/g},{name:"comment",pattern:/\#[\s\S]*?$/gm},{name:"storage.function",pattern:/(.+?)(?=\(\)\s{0,}\{)/g},{name:"support.command",pattern:/\b(echo|rm|ls|(mk|rm)dir|cd|find|cp|exit|pwd|exec|trap|source|shift|unset)/g},{matches:{1:"keyword"},pattern:/\b(break|case|continue|do|done|elif|else|esac|eval|export|fi|for|function|if|in|local|return|set|then|unset|until|while)(?=\(|\b)/g}],!0);
|