MCPcopy Create free account
hub / github.com/couchbase/fleece / parseString

Method parseString

Fleece/Support/JSON5.cc:108–128  ·  view source on GitHub ↗

Reads a string, writing JSON to the output.

Source from the content-addressed store, hash-verified

106
107 // Reads a string, writing JSON to the output.
108 void parseString() {
109 _out << '"';
110 const char quote = get();
111 char c;
112 while (quote != (c = get())) {
113 if (c == '"') {
114 _out << "\\\""; // Escape double-quote in single-quoted string
115 } else if (c == '\\') {
116 char esc = get();
117 if (!isnewline(esc)) { // ignore backslash + newline
118 if (esc != '\'')
119 _out << '\\'; // Don't write a single-quote as an escape
120 _out << esc;
121 }
122 // We don't need to detect Unicode escapes; just pass them through.
123 } else {
124 _out << c;
125 }
126 }
127 _out << '"';
128 }
129
130 // Reads an array or object, writing JSON to the output.
131 void parseSequence(bool isObject) {

Callers

nothing calls this directly

Calls 1

isnewlineFunction · 0.85

Tested by

no test coverage detected