MCPcopy Create free account
hub / github.com/denoland/std / arrayValue

Function arrayValue

toml/_parser.ts:725–748  ·  view source on GitHub ↗
(scanner: Scanner)

Source from the content-addressed store, hash-verified

723}
724
725export function arrayValue(scanner: Scanner): ParseResult<unknown[]> {
726 scanner.skipWhitespaces();
727
728 if (scanner.char() !== "[") return failure();
729 scanner.next();
730
731 const array: unknown[] = [];
732 while (!scanner.eof()) {
733 scanner.nextUntilChar();
734 const result = value(scanner);
735 if (!result.ok) break;
736 array.push(result.body);
737 scanner.skipWhitespaces();
738 // may have a next item, but trailing comma is allowed at array
739 if (scanner.char() !== ",") break;
740 scanner.next();
741 }
742 scanner.nextUntilChar();
743
744 if (scanner.char() !== "]") throw new SyntaxError("Array is not closed");
745 scanner.next();
746
747 return success(array);
748}
749
750export function inlineTable(
751 scanner: Scanner,

Callers

nothing calls this directly

Calls 8

failureFunction · 0.85
successFunction · 0.85
charMethod · 0.80
nextUntilCharMethod · 0.80
skipWhitespacesMethod · 0.45
nextMethod · 0.45
eofMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected