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

Function parseListInternal

http/unstable_structured_fields.ts:583–608  ·  view source on GitHub ↗
(state: ParserState)

Source from the content-addressed store, hash-verified

581}
582
583function parseListInternal(state: ParserState): List {
584 const members: List = [];
585
586 while (!isEof(state)) {
587 const member = parseItemOrInnerList(state);
588 members.push(member);
589 skipOWS(state);
590 if (isEof(state)) {
591 return members;
592 }
593 if (peek(state) !== ",") {
594 throw new SyntaxError(
595 `Invalid structured field: expected ',' at position ${state.pos}`,
596 );
597 }
598 consume(state); // consume ','
599 skipOWS(state);
600 if (isEof(state)) {
601 throw new SyntaxError(
602 "Invalid structured field: trailing comma in list",
603 );
604 }
605 }
606
607 return members;
608}
609
610/**
611 * Parses a Dictionary Structured Field value.

Callers 1

parseListFunction · 0.85

Calls 6

isEofFunction · 0.85
parseItemOrInnerListFunction · 0.85
skipOWSFunction · 0.85
peekFunction · 0.85
consumeFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected