(state: ParserState)
| 722 | } |
| 723 | |
| 724 | function 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 | |
| 756 | function parseItemInternal(state: ParserState): Item { |
| 757 | const value = parseBareItem(state); |
no test coverage detected