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

Function fxParseJSONToken

xs/sources/xsJSON.c:228–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228void fxParseJSONToken(txMachine* the, txJSONParser* theParser)
229{
230 txInteger character;
231 txBoolean escaped;
232 txNumber number;
233 txSize offset;
234 txSize size;
235 txString p, s;
236
237 theParser->integer = 0;
238 theParser->number = 0;
239 theParser->string->value.string = mxEmptyString.value.string;
240 theParser->string->kind = mxEmptyString.kind;
241 theParser->token = XS_NO_JSON_TOKEN;
242 p = theParser->slot->value.string + theParser->offset;
243 while (theParser->token == XS_NO_JSON_TOKEN) {
244 switch (*p) {
245 case 0:
246 theParser->token = XS_JSON_TOKEN_EOF;
247 break;
248 case 10:
249 p++;
250 theParser->line++;
251 break;
252 case 13:
253 p++;
254 theParser->line++;
255 if (*p == 10)
256 p++;
257 break;
258 case '\t':
259 case ' ':
260 p++;
261 break;
262 case '-':
263 case '0':
264 case '1':
265 case '2':
266 case '3':
267 case '4':
268 case '5':
269 case '6':
270 case '7':
271 case '8':
272 case '9':
273 s = p;
274 if (*p == '-')
275 p++;
276 if (('0' <= *p) && (*p <= '9')) {
277 if (*p == '0') {
278 p++;
279 }
280 else {
281 p++;
282 while (('0' <= *p) && (*p <= '9'))
283 p++;
284 }
285 if (*p == '.') {

Callers 4

fxParseJSONFunction · 0.70
fxParseJSONArrayFunction · 0.70
fxParseJSONObjectFunction · 0.70
fxParseJSONValueFunction · 0.70

Calls 3

fxStringToNumberFunction · 0.85
fxParseUnicodeEscapeFunction · 0.85
fxNewChunkFunction · 0.85

Tested by

no test coverage detected