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

Function fxGetNextNumberB

xs/sources/xsLexical.c:358–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358void fxGetNextNumberB(txParser* parser)
359{
360 txString p = parser->buffer;
361 txString q = p + parser->bufferSize;
362 int c;
363 fxGetNextCharacter(parser);
364 p = fxGetNextDigits(parser, fxGetNextDigitsB, p, q, 1);
365 c = parser->character;
366 if (p == q) {
367 fxReportMemoryError(parser, parser->states[2].line, "number overflow");
368 }
369 if (c == 'n')
370 fxGetNextCharacter(parser);
371 if (fxIsIdentifierFirst(parser->character)) {
372 fxReportParserError(parser, parser->states[2].line, "invalid number");
373 }
374 *p = 0;
375 q = parser->buffer;
376 if (c == 'n') {
377 parser->states[2].bigint.data = fxNewParserChunk(parser, fxBigIntMaximumB(mxPtrDiff(p - q)));
378 fxBigIntParseB(&parser->states[2].bigint, q, mxPtrDiff(p - q));
379 parser->states[2].token = XS_TOKEN_BIGINT;
380 }
381 else {
382 txNumber n = 0;
383 while ((c = *q++))
384 n = (n * 2) + (c - '0');
385 fxGetNextNumber(parser, n);
386 }
387}
388
389void fxGetNextNumberE(txParser* parser, int dot)
390{

Callers 2

fxGetNextTokenAuxFunction · 0.85
fxGetNextTokenJSONFunction · 0.85

Calls 9

fxGetNextCharacterFunction · 0.85
fxGetNextDigitsFunction · 0.85
fxReportMemoryErrorFunction · 0.85
fxIsIdentifierFirstFunction · 0.85
fxReportParserErrorFunction · 0.85
fxNewParserChunkFunction · 0.85
fxBigIntMaximumBFunction · 0.85
fxBigIntParseBFunction · 0.85
fxGetNextNumberFunction · 0.85

Tested by

no test coverage detected