@ryusei/light
Version:
<div align="center"> <a href="https://light.ryuseijs.com"> <img alt="RyuseiLight" src="https://light.ryuseijs.com/images/svg/logo.svg" width="70"> </a>
2 lines (1 loc) • 1.56 kB
JavaScript
!function(e,i){if("function"==typeof define&&define.amd)define([],i);else if("undefined"!=typeof exports)i();else{i(),e.unknown={}}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(){var e=/[+-]?(\d+\.?\d*|\d*\.?\d+)([eE][+-]?\d+)?/,i=/\b(?:true|false)\b/,t=/[[\]{}()]/,n=/[ \t]+/,a=/'(?:\\'|.)*?'/,s=/"(?:\\"|.)*?"/,r=/\/\*[\s\S]*?(\*\/|$)/,o=/\/\/.*/,c=/\b(?:break|catch|class|continue|do|else|extends|finally|for|function|if|implements|in|instanceof|interface|new|null|return|throw|try|while)\b/,d="keyword",f="comment",u="string",l="operator",b="delimiter";"undefined"!=typeof window&&window.RyuseiLight&&window.RyuseiLight.register({id:"javascript",name:"JavaScript",alias:["js"],source:{func:/[_$a-z\xA0-\uFFFF][_$a-z0-9\xA0-\uFFFF]*/},grammar:{main:[[u,a],[u,s],["#backtick",/`/,"@rest"],[f,r],[f,o],["regexp",/\/(\[.*?]|\\\/|.)+?\/[gimsuy]*/],[d,c],[d,/\b(?:as|async|await|case|catch|const|debugger|default|delete|enum|export|from|import|let|package|private|protected|public|super|switch|static|this|typeof|undefined|var|void|with|yield)\b/],[d,/\b((get|set)(?=\s+%func))/i],["class",/\b[A-Z][\w$]*\b/],["function",/%func(?=\s*\()/i],["boolean",i],["decorator",/@[^\s(@]+/],["identifier",/\b[a-z_$][\w$]*\b/],["number",e],[l,/=>/],[l,/\+[+=]?|-[-=]?|\*\*?=?|[/%^]=?|&&?=?|\|\|?=?|\?\??=?|<<?=?|>>>=?|>>?=?|[!=]=?=?|[~:^]/],["bracket",t],[b,/[;.,]+/],["space",n]],backtick:[[u,/^`/],[u,/(\$[^{]|\\[$`]|[^`$])+/],["#expression",/\${/,"@rest"],[u,/`/,"@break"]],expression:[[b,/^\${/],[b,/}/,"@break"],["#main"]]}})}));