The field value to be parsed, possibly missing
An immutable list of the elements of value, trimmed of the whitespace surrounding them, in the order
they are stated; empty if value is missing or states no non-empty element
Elements are read by mapping a parser over them: parseItem where a field states parameters on each element,
as Accept and TE do, or one of your own where this package doesn't cover the grammar. Pass a lambda rather than
the parser itself, which map would also feed the element index.
parseList(headers.get("accept-encoding")).map(element => parseItem(element));
Parses a list field value.
The comma is all a list states: what sits between commas is the field's own business, so elements are handed over as stated, quotes and all, for whoever knows the field to read. Every comma-separated field shares this one list, whatever its elements turn out to hold.
A comma inside a quoted string doesn't split the element carrying it, so elements with quoted values survive intact; a comma stated anywhere else does split the element, as happens inside the angle brackets
Linkwraps its target reference in. Empty elements are dropped, a sender being required to state none and a recipient to ignore the ones a careless merge leaves behind.Elements are never rejected: nothing is checked against the field grammar. A quote left unclosed protects nothing, so the commas following it split elements as any other would, and a value the sender left malformed yields malformed elements rather than an error.