parseInnerList parses as defined in https://httpwg.org/specs/rfc9651.html#parse-item-or-list.
(s *scanner)
| 48 | // parseInnerList parses as defined in |
| 49 | // https://httpwg.org/specs/rfc9651.html#parse-item-or-list. |
| 50 | func parseInnerList(s *scanner) (InnerList, error) { |
| 51 | if s.eof() || s.data[s.off] != '(' { |
| 52 | return InnerList{}, &UnmarshalError{s.off, ErrInvalidInnerListFormat} |
| 53 | } |
| 54 | s.off++ |
| 55 | |
| 56 | il := InnerList{nil, nil} |
| 57 | |
| 58 | for !s.eof() { |
| 59 | s.scanWhileSp() |
| 60 | |
| 61 | if s.eof() { |
| 62 | return InnerList{}, &UnmarshalError{s.off, ErrInvalidInnerListFormat} |
| 63 | } |
| 64 | |
| 65 | if s.data[s.off] == ')' { |
| 66 | s.off++ |
| 67 | |
| 68 | p, err := parseParams(s) |
| 69 | if err != nil { |
| 70 | return InnerList{}, err |
| 71 | } |
| 72 | |
| 73 | il.Params = p |
| 74 | |
| 75 | return il, nil |
| 76 | } |
| 77 | |
| 78 | i, err := parseItem(s) |
| 79 | if err != nil { |
| 80 | return InnerList{}, err |
| 81 | } |
| 82 | |
| 83 | if s.eof() || (s.data[s.off] != ')' && s.data[s.off] != ' ') { |
| 84 | return InnerList{}, &UnmarshalError{s.off, ErrInvalidInnerListFormat} |
| 85 | } |
| 86 | |
| 87 | il.Items = append(il.Items, i) |
| 88 | } |
| 89 | |
| 90 | return InnerList{}, &UnmarshalError{s.off, ErrInvalidInnerListFormat} |
| 91 | } |
no test coverage detected
searching dependent graphs…