| 221 | N.scope&&M.closeNode(),N.skip||N.subLanguage||(j+=N.relevance),N=N.parent |
| 222 | }while(N!==s.parent);return s.starts&&h(s.starts,e),o.returnEnd?0:t.length} |
| 223 | let w={};function y(i,o){const a=o&&o[0];if(R+=i,null==a)return g(),0 |
| 224 | ;if("begin"===w.type&&"end"===o.type&&w.index===o.index&&""===a){ |
| 225 | if(R+=n.slice(o.index,o.index+1),!r){const t=Error(`0 width match regex (${e})`) |
| 226 | ;throw t.languageName=e,t.badRule=w.rule,t}return 1} |
| 227 | if(w=o,"begin"===o.type)return(e=>{ |
| 228 | const n=e[0],i=e.rule,s=new t(i),o=[i.__beforeBegin,i["on:begin"]] |
| 229 | ;for(const t of o)if(t&&(t(e,s),s.isMatchIgnored))return b(n) |
| 230 | ;return i.skip?R+=n:(i.excludeBegin&&(R+=n), |
| 231 | g(),i.returnBegin||i.excludeBegin||(R=n)),h(i,e),i.returnBegin?0:n.length})(o) |
| 232 | ;if("illegal"===o.type&&!s){ |
| 233 | const e=Error('Illegal lexeme "'+a+'" for mode "'+(N.scope||"<unnamed>")+'"') |
| 234 | ;throw e.mode=N,e}if("end"===o.type){const e=m(o);if(e!==ee)return e} |
| 235 | if("illegal"===o.type&&""===a)return 1 |
| 236 | ;if(I>1e5&&I>3*o.index)throw Error("potential infinite loop, way more iterations than matches") |
| 237 | ;return R+=a,a.length}const _=O(e) |
| 238 | ;if(!_)throw W(a.replace("{}",e)),Error('Unknown language: "'+e+'"') |
| 239 | ;const v=V(_);let k="",N=o||v;const S={},M=new p.__emitter(p);(()=>{const e=[] |
| 240 | ;for(let t=N;t!==_;t=t.parent)t.scope&&e.unshift(t.scope) |