MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxStringifyJSONString

Function fxStringifyJSONString

xs/sources/xsJSON.c:1141–1181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1139}
1140
1141void fxStringifyJSONString(txMachine* the, txJSONStringifier* theStringifier, txString theString)
1142{
1143 fxStringifyJSONChars(the, theStringifier, "\"", 1);
1144 for (;;) {
1145 txInteger character;
1146 theString = mxStringByteDecode(theString, &character);
1147 if (character == C_EOF)
1148 break;
1149 if (character < 8)
1150 fxStringifyJSONUnicodeEscape(the, theStringifier, character);
1151 else if (character == 8)
1152 fxStringifyJSONChars(the, theStringifier, "\\b", 2);
1153 else if (character == 9)
1154 fxStringifyJSONChars(the, theStringifier, "\\t", 2);
1155 else if (character == 10)
1156 fxStringifyJSONChars(the, theStringifier, "\\n", 2);
1157 else if (character == 11)
1158 fxStringifyJSONUnicodeEscape(the, theStringifier, character);
1159 else if (character == 12)
1160 fxStringifyJSONChars(the, theStringifier, "\\f", 2);
1161 else if (character == 13)
1162 fxStringifyJSONChars(the, theStringifier, "\\r", 2);
1163 else if (character < 32)
1164 fxStringifyJSONUnicodeEscape(the, theStringifier, character);
1165 else if (character < 34)
1166 fxStringifyJSONCharacter(the, theStringifier, character);
1167 else if (character == 34)
1168 fxStringifyJSONChars(the, theStringifier, "\\\"", 2);
1169 else if (character < 92)
1170 fxStringifyJSONCharacter(the, theStringifier, character);
1171 else if (character == 92)
1172 fxStringifyJSONChars(the, theStringifier, "\\\\", 2);
1173 else if (character < 127)
1174 fxStringifyJSONCharacter(the, theStringifier, character);
1175 else if ((0xD800 <= character) && (character <= 0xDFFF))
1176 fxStringifyJSONUnicodeEscape(the, theStringifier, character);
1177 else
1178 fxStringifyJSONCharacter(the, theStringifier, character);
1179 }
1180 fxStringifyJSONChars(the, theStringifier, "\"", 1);
1181}
1182
1183void fxStringifyJSONUnicodeEscape(txMachine* the, txJSONStringifier* theStringifier, txInteger character)
1184{

Callers 2

fxStringifyJSONNameFunction · 0.85
fxStringifyJSONPropertyFunction · 0.85

Calls 3

fxStringifyJSONCharsFunction · 0.85
fxStringifyJSONCharacterFunction · 0.85

Tested by

no test coverage detected