()
| 191 | } |
| 192 | |
| 193 | private parseArray(): unknown[] { |
| 194 | this.consume("["); |
| 195 | this.skipWhitespace(); |
| 196 | |
| 197 | const value: unknown[] = []; |
| 198 | |
| 199 | if (this.peek() === "]") { |
| 200 | this.consume("]"); |
| 201 | return value; |
| 202 | } |
| 203 | |
| 204 | while (!this.isAtEnd()) { |
| 205 | value.push(this.parseValue()); |
| 206 | this.skipWhitespace(); |
| 207 | |
| 208 | if (this.peek() === ",") { |
| 209 | this.consume(","); |
| 210 | this.skipWhitespace(); |
| 211 | |
| 212 | if (this.peek() === "]") { |
| 213 | this.consume("]"); |
| 214 | return value; |
| 215 | } |
| 216 | |
| 217 | continue; |
| 218 | } |
| 219 | |
| 220 | if (this.peek() === "]") { |
| 221 | this.consume("]"); |
| 222 | return value; |
| 223 | } |
| 224 | |
| 225 | throw new JSONishSyntaxError('Expected "," or "]" in array literal.'); |
| 226 | } |
| 227 | |
| 228 | throw new JSONishSyntaxError("Unterminated array literal."); |
| 229 | } |
| 230 | |
| 231 | private parseObjectKey(): string { |
| 232 | this.skipWhitespace(); |
no test coverage detected