(s, { plugins: o })
| 20533 | : 1 |
| 20534 | } |
| 20535 | function compileLanguage(s, { plugins: o }) { |
| 20536 | function langRe(o, i) { |
| 20537 | return new RegExp(source(o), 'm' + (s.case_insensitive ? 'i' : '') + (i ? 'g' : '')) |
| 20538 | } |
| 20539 | class MultiRegex { |
| 20540 | constructor() { |
| 20541 | ;((this.matchIndexes = {}), |
| 20542 | (this.regexes = []), |
| 20543 | (this.matchAt = 1), |
| 20544 | (this.position = 0)) |
| 20545 | } |
| 20546 | addRule(s, o) { |
| 20547 | ;((o.position = this.position++), |
| 20548 | (this.matchIndexes[this.matchAt] = o), |
| 20549 | this.regexes.push([o, s]), |
| 20550 | (this.matchAt += |
| 20551 | (function countMatchGroups(s) { |
| 20552 | return new RegExp(s.toString() + '|').exec('').length - 1 |
| 20553 | })(s) + 1)) |
| 20554 | } |
| 20555 | compile() { |
| 20556 | 0 === this.regexes.length && (this.exec = () => null) |
| 20557 | const s = this.regexes.map((s) => s[1]) |
| 20558 | ;((this.matcherRe = langRe( |
| 20559 | (function join(s, o = '|') { |
| 20560 | let i = 0 |
| 20561 | return s |
| 20562 | .map((s) => { |
| 20563 | i += 1 |
| 20564 | const o = i |
| 20565 | let u = source(s), |
| 20566 | _ = '' |
| 20567 | for (; u.length > 0; ) { |
| 20568 | const s = a.exec(u) |
| 20569 | if (!s) { |
| 20570 | _ += u |
| 20571 | break |
| 20572 | } |
| 20573 | ;((_ += u.substring(0, s.index)), |
| 20574 | (u = u.substring(s.index + s[0].length)), |
| 20575 | '\\' === s[0][0] && s[1] |
| 20576 | ? (_ += '\\' + String(Number(s[1]) + o)) |
| 20577 | : ((_ += s[0]), '(' === s[0] && i++)) |
| 20578 | } |
| 20579 | return _ |
| 20580 | }) |
| 20581 | .map((s) => `(${s})`) |
| 20582 | .join(o) |
| 20583 | })(s), |
| 20584 | !0 |
| 20585 | )), |
| 20586 | (this.lastIndex = 0)) |
| 20587 | } |
| 20588 | exec(s) { |
| 20589 | this.matcherRe.lastIndex = this.lastIndex |
| 20590 | const o = this.matcherRe.exec(s) |
| 20591 | if (!o) return null |
| 20592 | const i = o.findIndex((s, o) => o > 0 && void 0 !== s), |
no test coverage detected