(state: ParserState)
| 990 | } |
| 991 | |
| 992 | function parseBoolean(state: ParserState): BareItem { |
| 993 | if (consume(state) !== "?") { |
| 994 | throw new SyntaxError( |
| 995 | `Invalid structured field: expected '?' at position ${state.pos - 1}`, |
| 996 | ); |
| 997 | } |
| 998 | |
| 999 | const c = consume(state); |
| 1000 | if (c === "1") { |
| 1001 | return { type: "boolean", value: true }; |
| 1002 | } |
| 1003 | if (c === "0") { |
| 1004 | return { type: "boolean", value: false }; |
| 1005 | } |
| 1006 | |
| 1007 | throw new SyntaxError( |
| 1008 | `Invalid structured field: expected '0' or '1' at position ${ |
| 1009 | state.pos - 1 |
| 1010 | }`, |
| 1011 | ); |
| 1012 | } |
| 1013 | |
| 1014 | function parseDate(state: ParserState): BareItem { |
| 1015 | if (consume(state) !== "@") { |
no test coverage detected