MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / T

Function T

vulnerablecode/static/js/highlight-10.6.0.min.js:84–140  ·  view source on GitHub ↗
(e,{plugins:t})

Source from the content-addressed store, hash-verified

82;s[n[0]]=[e,I(n[0],n[1])]}))}}function I(e,t){
83return t?Number(t):(e=>L.includes(e.toLowerCase()))(e)?0:1}
84function T(e,{plugins:t}){function n(t,n){
85return RegExp(u(t),"m"+(e.case_insensitive?"i":"")+(n?"g":""))}class s{
86constructor(){
87this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}
88addRule(e,t){
89t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),
90this.matchAt+=(e=>RegExp(e.toString()+"|").exec("").length-1)(e)+1}compile(){
910===this.regexes.length&&(this.exec=()=>null)
92;const e=this.regexes.map((e=>e[1]));this.matcherRe=n(((e,t="|")=>{
93const n=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;let s=0,r=""
94;for(let a=0;a<e.length;a++){s+=1;const i=s;let o=u(e[a])
95;for(a>0&&(r+=t),r+="(";o.length>0;){const e=n.exec(o);if(null==e){r+=o;break}
96r+=o.substring(0,e.index),
97o=o.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?r+="\\"+(Number(e[1])+i):(r+=e[0],
98"("===e[0]&&s++)}r+=")"}return r})(e),!0),this.lastIndex=0}exec(e){
99this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e)
100;if(!t)return null
101;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),s=this.matchIndexes[n]
102;return t.splice(0,n),Object.assign(t,s)}}class r{constructor(){
103this.rules=[],this.multiRegexes=[],
104this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){
105if(this.multiRegexes[e])return this.multiRegexes[e];const t=new s
106;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))),
107t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){
108return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){
109this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){
110const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex
111;let n=t.exec(e)
112;if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{
113const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}
114return n&&(this.regexIndex+=n.position+1,
115this.regexIndex===this.count&&this.considerAll()),n}}
116if(e.compilerExtensions||(e.compilerExtensions=[]),
117e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.")
118;return e.classNameAliases=a(e.classNameAliases||{}),function t(s,i){const o=s
119;if(s.compiled)return o
120;[M].forEach((e=>e(s,i))),e.compilerExtensions.forEach((e=>e(s,i))),
121s.__beforeBegin=null,[k,O,A].forEach((e=>e(s,i))),s.compiled=!0;let l=null
122;if("object"==typeof s.keywords&&(l=s.keywords.$pattern,
123delete s.keywords.$pattern),
124s.keywords&&(s.keywords=B(s.keywords,e.case_insensitive)),
125s.lexemes&&l)throw Error("ERR: Prefer `keywords.$pattern` to `mode.lexemes`, BOTH are not allowed. (see mode reference) ")
126;return l=l||s.lexemes||/\w+/,
127o.keywordPatternRe=n(l,!0),i&&(s.begin||(s.begin=/\B|\b/),
128o.beginRe=n(s.begin),s.endSameAsBegin&&(s.end=s.begin),
129s.end||s.endsWithParent||(s.end=/\B|\b/),
130s.end&&(o.endRe=n(s.end)),o.terminatorEnd=u(s.end)||"",
131s.endsWithParent&&i.terminatorEnd&&(o.terminatorEnd+=(s.end?"|":"")+i.terminatorEnd)),
132s.illegal&&(o.illegalRe=n(s.illegal)),
133s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>a(e,{
134variants:null},t)))),e.cachedVariants?e.cachedVariants:j(e)?a(e,{
135starts:e.starts?a(e.starts):null
136}):Object.isFrozen(e)?a(e):e))("self"===e?s:e)))),s.contains.forEach((e=>{t(e,o)
137})),s.starts&&t(s.starts,i),o.matcher=(e=>{const t=new r
138;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin"
139}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"
140}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(o),o}(e)}function j(e){
141return!!e&&(e.endsWithParent||j(e.starts))}function S(e){const t={

Callers 2

fFunction · 0.85
PFunction · 0.85

Calls 8

addRuleMethod · 0.95
aFunction · 0.85
eFunction · 0.85
BFunction · 0.85
nFunction · 0.85
uFunction · 0.85
jFunction · 0.85
tFunction · 0.85

Tested by

no test coverage detected