| 25 | closeNode(e){i(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){ |
| 26 | this.buffer+=`<span class="${e}">`}}const s=(e={})=>{const n={children:[]} |
| 27 | ;return Object.assign(n,e),n};class o{constructor(){ |
| 28 | this.rootNode=s(),this.stack=[this.rootNode]}get top(){ |
| 29 | return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){ |
| 30 | this.top.children.push(e)}openNode(e){const n=s({scope:e}) |
| 31 | ;this.add(n),this.stack.push(n)}closeNode(){ |
| 32 | if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){ |
| 33 | for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)} |
| 34 | walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){ |
| 35 | return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n), |
| 36 | n.children.forEach((n=>this._walk(e,n))),e.closeNode(n)),e}static _collapse(e){ |
| 37 | "string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{ |
| 38 | o._collapse(e)})))}}class l extends o{constructor(e){super(),this.options=e} |
| 39 | addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){ |
| 40 | this.closeNode()}__addSublanguage(e,n){const t=e.root |
| 41 | ;n&&(t.scope="language:"+n),this.add(t)}toHTML(){ |
nothing calls this directly
no outgoing calls
no test coverage detected