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

Function parseInnerList

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

Source from the content-addressed store, hash-verified

722}
723
724function parseInnerList(state: ParserState): InnerList {
725 if (consume(state) !== "(") {
726 throw new SyntaxError(
727 `Invalid structured field: expected '(' at position ${state.pos - 1}`,
728 );
729 }
730
731 const items: Item[] = [];
732
733 while (!isEof(state)) {
734 skipSP(state);
735 if (peek(state) === ")") {
736 consume(state);
737 const parameters = parseParameters(state);
738 return { items, parameters };
739 }
740 const item = parseItemInternal(state);
741 items.push(item);
742
743 const c = peek(state);
744 if (c !== " " && c !== ")") {
745 throw new SyntaxError(
746 `Invalid structured field: expected SP or ')' at position ${state.pos}`,
747 );
748 }
749 }
750
751 throw new SyntaxError(
752 "Invalid structured field: unterminated inner list",
753 );
754}
755
756function parseItemInternal(state: ParserState): Item {
757 const value = parseBareItem(state);

Callers 1

parseItemOrInnerListFunction · 0.85

Calls 7

consumeFunction · 0.85
isEofFunction · 0.85
skipSPFunction · 0.85
peekFunction · 0.85
parseParametersFunction · 0.85
parseItemInternalFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected