()
| 552 | } |
| 553 | } |
| 554 | toJSON() { |
| 555 | const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())]; |
| 556 | if (this.isStart() && !this.type) |
| 557 | ret.unshift([]); |
| 558 | if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) { |
| 559 | ret.push({}); |
| 560 | } |
| 561 | return ret; |
| 562 | } |
| 563 | isStart() { |
| 564 | if (this.#root === this) |
| 565 | return true; |