| 382 | |
| 383 | // Starts capturing the value that begins at `i`. |
| 384 | begin(mode: number, text: string, i: number, out: Array<unknown>): number { |
| 385 | const c = text.charCodeAt(i) |
| 386 | this.capture = mode |
| 387 | this.start = this.base + i |
| 388 | this.inString = c === QUOTE |
| 389 | this.escape = false |
| 390 | this.depth = c === LBRACKET || c === LBRACE ? 1 : 0 |
| 391 | this.scalar = !this.inString && this.depth === 0 |
| 392 | if (this.depth > this.config.maxDepth) this.failDepth() |
| 393 | return this.scan(text, i + 1, out) |
| 394 | } |
| 395 | |
| 396 | // Continues the captured value from `i`, completing it if it ends in this |
| 397 | // chunk. Returns the index after the value, or the chunk length. |