()
| 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){ |