MCPcopy Index your code
hub / github.com/dunglas/httpsfv / parseInnerList

Function parseInnerList

innerlist.go:50–91  ·  view source on GitHub ↗

parseInnerList parses as defined in https://httpwg.org/specs/rfc9651.html#parse-item-or-list.

(s *scanner)

Source from the content-addressed store, hash-verified

48// parseInnerList parses as defined in
49// https://httpwg.org/specs/rfc9651.html#parse-item-or-list.
50func 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}

Callers 1

parseItemOrInnerListFunction · 0.85

Calls 4

parseParamsFunction · 0.85
parseItemFunction · 0.85
eofMethod · 0.80
scanWhileSpMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…