MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / V

Function V

pages/viewScriptSource/libs/highlight.min.js:123–170  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

121G
122;if("object"!=typeof e.endScope||null===e.endScope)throw K("endScope must be object"),
123G;Z(e,e.end,{key:"endScope"}),e.end=E(e.end,{joinWith:""})}})(e)}function V(e){
124function t(t,n){
125return RegExp(g(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))
126}class n{constructor(){
127this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}
128addRule(e,t){
129t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),
130this.matchAt+=b(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null)
131;const e=this.regexes.map((e=>e[1]));this.matcherRe=t(E(e,{joinWith:"|"
132}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex
133;const t=this.matcherRe.exec(e);if(!t)return null
134;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),i=this.matchIndexes[n]
135;return t.splice(0,n),Object.assign(t,i)}}class i{constructor(){
136this.rules=[],this.multiRegexes=[],
137this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){
138if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n
139;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))),
140t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){
141return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){
142this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){
143const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex
144;let n=t.exec(e)
145;if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{
146const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}
147return n&&(this.regexIndex+=n.position+1,
148this.regexIndex===this.count&&this.considerAll()),n}}
149if(e.compilerExtensions||(e.compilerExtensions=[]),
150e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.")
151;return e.classNameAliases=r(e.classNameAliases||{}),function n(s,o){const a=s
152;if(s.isCompiled)return a
153;[T,D,F,P].forEach((e=>e(s,o))),e.compilerExtensions.forEach((e=>e(s,o))),
154s.__beforeBegin=null,[L,B,H].forEach((e=>e(s,o))),s.isCompiled=!0;let c=null
155;return"object"==typeof s.keywords&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),
156c=s.keywords.$pattern,
157delete s.keywords.$pattern),c=c||/\w+/,s.keywords&&(s.keywords=$(s.keywords,e.case_insensitive)),
158a.keywordPatternRe=t(c,!0),
159o&&(s.begin||(s.begin=/\B|\b/),a.beginRe=t(a.begin),s.end||s.endsWithParent||(s.end=/\B|\b/),
160s.end&&(a.endRe=t(a.end)),
161a.terminatorEnd=g(a.end)||"",s.endsWithParent&&o.terminatorEnd&&(a.terminatorEnd+=(s.end?"|":"")+o.terminatorEnd)),
162s.illegal&&(a.illegalRe=t(s.illegal)),
163s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>r(e,{
164variants:null},t)))),e.cachedVariants?e.cachedVariants:q(e)?r(e,{
165starts:e.starts?r(e.starts):null
166}):Object.isFrozen(e)?r(e):e))("self"===e?s:e)))),s.contains.forEach((e=>{n(e,a)
167})),s.starts&&n(s.starts,o),a.matcher=(e=>{const t=new i
168;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin"
169}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"
170}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(a),a}(e)}function q(e){
171return!!e&&(e.endsWithParent||q(e.starts))}class J extends Error{
172constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}
173const Y=i,Q=r,ee=Symbol("nomatch");var te=(t=>{

Callers 1

EFunction · 0.70

Calls 9

addRuleMethod · 0.95
concatMethod · 0.80
rFunction · 0.70
$Function · 0.70
tFunction · 0.70
gFunction · 0.70
qFunction · 0.70
nClass · 0.70
eFunction · 0.50

Tested by

no test coverage detected