MCPcopy Create free account
hub / github.com/denoland/std / #parseArray

Method #parseArray

jsonc/parse.ts:263–294  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

261 }
262
263 #parseArray(): JsonValue[] {
264 const target: JsonValue[] = [];
265 // ┌─token1
266 // [ ]
267 // ┌─────────────token1
268 // │ ┌─────────token2
269 // [ value ]
270 // ┌───────token1
271 // │ ┌───token2
272 // │ │ ┌─token1
273 // [ value , ]
274 // ┌─────────────token1
275 // │ ┌─────────token2
276 // │ │ ┌─────token1
277 // │ │ │ ┌─token2
278 // [ value , value ]
279 while (true) {
280 const token1 = this.#getNext();
281 if (token1.type === "EndArray") {
282 return target;
283 }
284 target.push(this.#parseJsonValue(token1));
285
286 const token2 = this.#getNext();
287 if (token2.type === "EndArray") {
288 return target;
289 }
290 if (token2.type !== "ValueSeparator") {
291 throw new SyntaxError(buildErrorMessage(token2));
292 }
293 }
294 }
295
296 #parseString(value: {
297 type: "String";

Callers 1

#parseJsonValueMethod · 0.95

Calls 4

#getNextMethod · 0.95
#parseJsonValueMethod · 0.95
buildErrorMessageFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected