MCPcopy Index your code
hub / github.com/segmentio/encoding / parseUnicode

Method parseUnicode

json/parse.go:388–403  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

386}
387
388func (d decoder) parseUnicode(b []byte) (rune, int, error) {
389 if len(b) < 4 {
390 return 0, len(b), syntaxError(b, "unicode code point must have at least 4 characters")
391 }
392
393 u, r, err := d.parseUintHex(b[:4])
394 if err != nil {
395 return 0, 4, syntaxError(b, "parsing unicode code point: %s", err)
396 }
397
398 if len(r) != 0 {
399 return 0, 4, syntaxError(b, "invalid unicode code point")
400 }
401
402 return rune(u), 4, nil
403}
404
405func (d decoder) parseString(b []byte) ([]byte, []byte, Kind, error) {
406 if len(b) < 2 {

Callers 2

parseStringMethod · 0.95
parseStringUnquoteMethod · 0.95

Calls 2

parseUintHexMethod · 0.95
syntaxErrorFunction · 0.85

Tested by

no test coverage detected