MCPcopy Create free account
hub / github.com/francoispqt/gojay / decodeStringNull

Method decodeStringNull

decode_string.go:53–92  ·  view source on GitHub ↗
(v **string)

Source from the content-addressed store, hash-verified

51}
52
53func (dec *Decoder) decodeStringNull(v **string) error {
54 for ; dec.cursor < dec.length || dec.read(); dec.cursor++ {
55 switch dec.data[dec.cursor] {
56 case ' ', '\n', '\t', '\r', ',':
57 // is string
58 continue
59 case '"':
60 dec.cursor++
61 start, end, err := dec.getString()
62
63 if err != nil {
64 return err
65 }
66 if *v == nil {
67 *v = new(string)
68 }
69 // we do minus one to remove the last quote
70 d := dec.data[start : end-1]
71 **v = *(*string)(unsafe.Pointer(&d))
72 dec.cursor = end
73 return nil
74 // is nil
75 case 'n':
76 dec.cursor++
77 err := dec.assertNull()
78 if err != nil {
79 return err
80 }
81 return nil
82 default:
83 dec.err = dec.makeInvalidUnmarshalErr(v)
84 err := dec.skipData()
85 if err != nil {
86 return err
87 }
88 return nil
89 }
90 }
91 return nil
92}
93
94func (dec *Decoder) parseEscapedString() error {
95 if dec.cursor >= dec.length && !dec.read() {

Callers 3

StringNullMethod · 0.95
UnmarshalFunction · 0.95
DecodeMethod · 0.95

Calls 5

readMethod · 0.95
getStringMethod · 0.95
assertNullMethod · 0.95
skipDataMethod · 0.95

Tested by

no test coverage detected