Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

gleam / compiler-core / templates / docs-js / highlightjs-javascript.min.js
6.4 kB 80 lines
1// SPDX-License-Identifier: Apache-2.0 2// SPDX-FileCopyrightText: 2022 The Gleam contributors 3 4/*! `javascript` grammar compiled for Highlight.js 11.6.0 */ 5(()=>{var e=(()=>{"use strict" 6;const e="[A-Za-z$_][0-9A-Za-z$_]*",n=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],a=["true","false","null","undefined","NaN","Infinity"],t=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],s=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],r=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],c=["arguments","this","super","console","window","document","localStorage","module","global"],i=[].concat(r,t,s) 7;return o=>{const l=o.regex,b=e,d={begin:/<[A-Za-z0-9\\._:-]+/, 8end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{ 9const a=e[0].length+e.index,t=e.input[a] 10;if("<"===t||","===t)return void n.ignoreMatch();let s 11;">"===t&&(((e,{after:n})=>{const a="</"+e[0].slice(1) 12;return-1!==e.input.indexOf(a,n)})(e,{after:a 13})||n.ignoreMatch()),(s=e.input.substring(a).match(/^\s+extends\s+/))&&0===s.index&&n.ignoreMatch() 14}},g={$pattern:e,keyword:n,literal:a,built_in:i,"variable.language":c 15},u="\\.([0-9](_?[0-9])*)",m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",E={ 16className:"number",variants:[{ 17begin:`(\\b(${m})((${u})|\\.)?|(${u}))[eE][+-]?([0-9](_?[0-9])*)\\b`},{ 18begin:`\\b(${m})\\b((${u})\\b|\\.)?|(${u})\\b`},{ 19begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{ 20begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{ 21begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{ 22begin:"\\b0[0-7]+n?\\b"}],relevance:0},A={className:"subst",begin:"\\$\\{", 23end:"\\}",keywords:g,contains:[]},y={begin:"html`",end:"",starts:{end:"`", 24returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,A],subLanguage:"xml"}},N={ 25begin:"css`",end:"",starts:{end:"`",returnEnd:!1, 26contains:[o.BACKSLASH_ESCAPE,A],subLanguage:"css"}},_={className:"string", 27begin:"`",end:"`",contains:[o.BACKSLASH_ESCAPE,A]},f={className:"comment", 28variants:[o.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{ 29begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag", 30begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0, 31excludeBegin:!0,relevance:0},{className:"variable",begin:b+"(?=\\s*(-)|$)", 32endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}] 33}),o.C_BLOCK_COMMENT_MODE,o.C_LINE_COMMENT_MODE] 34},h=[o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,y,N,_,E];A.contains=h.concat({ 35begin:/\{/,end:/\}/,keywords:g,contains:["self"].concat(h)}) 36;const v=[].concat(f,A.contains),p=v.concat([{begin:/\(/,end:/\)/,keywords:g, 37contains:["self"].concat(v)}]),S={className:"params",begin:/\(/,end:/\)/, 38excludeBegin:!0,excludeEnd:!0,keywords:g,contains:p},w={variants:[{ 39match:[/class/,/\s+/,b,/\s+/,/extends/,/\s+/,l.concat(b,"(",l.concat(/\./,b),")*")], 40scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{ 41match:[/class/,/\s+/,b],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0, 42match:l.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/), 43className:"title.class",keywords:{_:[...t,...s]}},O={variants:[{ 44match:[/function/,/\s+/,b,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}], 45className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S], 46illegal:/%/},k={ 47match:l.concat(/\b/,(I=[...r,"super"],l.concat("(?!",I.join("|"),")")),b,l.lookahead(/\(/)), 48className:"title.function",relevance:0};var I;const x={ 49begin:l.concat(/\./,l.lookahead(l.concat(b,/(?![0-9A-Za-z$_(])/))),end:b, 50excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},T={ 51match:[/get|set/,/\s+/,b,/(?=\()/],className:{1:"keyword",3:"title.function"}, 52contains:[{begin:/\(\)/},S] 53},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+o.UNDERSCORE_IDENT_RE+")\\s*=>",M={ 54match:[/const|var|let/,/\s+/,b,/\s*/,/=\s*/,/(async\s*)?/,l.lookahead(C)], 55keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]} 56;return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:g,exports:{ 57PARAMS_CONTAINS:p,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/, 58contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),{ 59label:"use_strict",className:"meta",relevance:10, 60begin:/^\s*['"]use (strict|asm)['"]/ 61},o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,y,N,_,f,E,R,{className:"attr", 62begin:b+l.lookahead(":"),relevance:0},M,{ 63begin:"("+o.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*", 64keywords:"return throw case",relevance:0,contains:[f,o.REGEXP_MODE,{ 65className:"function",begin:C,returnBegin:!0,end:"\\s*=>",contains:[{ 66className:"params",variants:[{begin:o.UNDERSCORE_IDENT_RE,relevance:0},{ 67className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0, 68excludeEnd:!0,keywords:g,contains:p}]}]},{begin:/,/,relevance:0},{match:/\s+/, 69relevance:0},{variants:[{begin:"<>",end:"</>"},{ 70match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:d.begin, 71"on:begin":d.isTrulyOpeningTag,end:d.end}],subLanguage:"xml",contains:[{ 72begin:d.begin,end:d.end,skip:!0,contains:["self"]}]}]},O,{ 73beginKeywords:"while if switch catch for"},{ 74begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", 75returnBegin:!0,label:"func.def",contains:[S,o.inherit(o.TITLE_MODE,{begin:b, 76className:"title.function"})]},{match:/\.\.\./,relevance:0},x,{match:"\\$"+b, 77relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"}, 78contains:[S]},k,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/, 79className:"variable.constant"},w,T,{match:/\$[(.]/}]}}})() 80;hljs.registerLanguage("javascript",e)})();