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

Function parseBareItem

bareitem.go:87–115  ·  view source on GitHub ↗

parseBareItem parses as defined in https://httpwg.org/specs/rfc9651.html#parse-bare-item.

(s *scanner)

Source from the content-addressed store, hash-verified

85// parseBareItem parses as defined in
86// https://httpwg.org/specs/rfc9651.html#parse-bare-item.
87func parseBareItem(s *scanner) (interface{}, error) {
88 if s.eof() {
89 return nil, &UnmarshalError{s.off, ErrUnexpectedEndOfString}
90 }
91
92 c := s.data[s.off]
93 switch c {
94 case '"':
95 return parseString(s)
96 case '?':
97 return parseBoolean(s)
98 case '*':
99 return parseToken(s)
100 case ':':
101 return parseBinary(s)
102 case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
103 return parseNumber(s)
104 case '@':
105 return parseDate(s)
106 case '%':
107 return parseDisplayString(s)
108 default:
109 if isAlpha(c) {
110 return parseToken(s)
111 }
112
113 return nil, &UnmarshalError{s.off, ErrUnrecognizedCharacter}
114 }
115}

Callers 3

parseParamsFunction · 0.85
parseItemFunction · 0.85
TestParseBareItemFunction · 0.85

Calls 9

parseStringFunction · 0.85
parseBooleanFunction · 0.85
parseTokenFunction · 0.85
parseBinaryFunction · 0.85
parseNumberFunction · 0.85
parseDateFunction · 0.85
parseDisplayStringFunction · 0.85
isAlphaFunction · 0.85
eofMethod · 0.80

Tested by 1

TestParseBareItemFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…