(nested = false)
| 81 | } |
| 82 | |
| 83 | parse(nested = false): ArrayResult<T> { |
| 84 | let character, parser, quote; |
| 85 | this.consumeDimensions(); |
| 86 | while (!this.isEof()) { |
| 87 | character = this.nextCharacter(); |
| 88 | if (character.value === "{" && !quote) { |
| 89 | this.dimension++; |
| 90 | if (this.dimension > 1) { |
| 91 | parser = new ArrayParser( |
| 92 | this.source.substring(this.position - 1), |
| 93 | this.transform, |
| 94 | this.separator, |
| 95 | ); |
| 96 | this.entries.push(parser.parse(true)); |
| 97 | this.position += parser.position - 2; |
| 98 | } |
| 99 | } else if (character.value === "}" && !quote) { |
| 100 | this.dimension--; |
| 101 | if (!this.dimension) { |
| 102 | this.newEntry(); |
| 103 | if (nested) return this.entries; |
| 104 | } |
| 105 | } else if (character.value === '"' && !character.escaped) { |
| 106 | if (quote) this.newEntry(true); |
| 107 | quote = !quote; |
| 108 | } else if (character.value === this.separator && !quote) { |
| 109 | this.newEntry(); |
| 110 | } else { |
| 111 | this.record(character.value); |
| 112 | } |
| 113 | } |
| 114 | if (this.dimension !== 0) { |
| 115 | throw new Error("array dimension not balanced"); |
| 116 | } |
| 117 | return this.entries; |
| 118 | } |
| 119 | } |
no test coverage detected