MCPcopy Create free account
hub / github.com/WICG/webpackage / parseListOfLists

Method parseListOfLists

go/signedexchange/structuredheader/parser.go:120–143  ·  view source on GitHub ↗

https://tools.ietf.org/html/draft-ietf-httpbis-header-structure-09#section-4.2.4

()

Source from the content-addressed store, hash-verified

118}
119// https://tools.ietf.org/html/draft-ietf-httpbis-header-structure-09#section-4.2.4
120func (p *parser) parseListOfLists() (ListOfLists, error) {
121 var topList ListOfLists
122 var innerList []Item
123 for !p.isEmpty() {
124 item, err := p.parseItem()
125 if err != nil {
126 return nil, err
127 }
128 innerList = append(innerList, item)
129 p.discardLeadingOWS()
130 if p.isEmpty() {
131 topList = append(topList, innerList)
132 return topList, nil
133 }
134 if p.consumeChar(',') {
135 topList = append(topList, innerList)
136 innerList = nil
137 } else if !p.consumeChar(';') {
138 return nil, fmt.Errorf("structuredheader: ',' or ';' expected, got '%c'", p.input[0])
139 }
140 p.discardLeadingOWS()
141 }
142 return nil, errors.New("structuredheader: unexpected end of input; List of Lists expected")
143}
144
145// https://tools.ietf.org/html/draft-ietf-httpbis-header-structure-09#section-4.2.5
146func (p *parser) parseParameterisedList() (ParameterisedList, error) {

Callers 1

ParseListOfListsFunction · 0.95

Calls 4

isEmptyMethod · 0.95
parseItemMethod · 0.95
discardLeadingOWSMethod · 0.95
consumeCharMethod · 0.95

Tested by

no test coverage detected