MCPcopy Create free account
hub / github.com/F-Stack/f-stack / read_numeral

Function read_numeral

freebsd/contrib/openzfs/module/lua/llex.c:229–247  ·  view source on GitHub ↗

LUA_NUMBER */ ** this function is quite liberal in what it accepts, as 'luaO_str2d' ** will reject ill-formed numerals. */

Source from the content-addressed store, hash-verified

227** will reject ill-formed numerals.
228*/
229static void read_numeral (LexState *ls, SemInfo *seminfo) {
230 const char *expo = "Ee";
231 int first = ls->current;
232 lua_assert(lisdigit(ls->current));
233 save_and_next(ls);
234 if (first == '0' && check_next(ls, "Xx")) /* hexadecimal? */
235 expo = "Pp";
236 for (;;) {
237 if (check_next(ls, expo)) /* exponent part? */
238 (void) check_next(ls, "+-"); /* optional exponent sign */
239 if (lisxdigit(ls->current) || ls->current == '.')
240 save_and_next(ls);
241 else break;
242 }
243 save(ls, '\0');
244 buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
245 if (!buff2d(ls->buff, &seminfo->r)) /* format error? */
246 trydecpoint(ls, seminfo); /* try to update decimal point separator */
247}
248
249
250/*

Callers 1

llexFunction · 0.70

Calls 4

check_nextFunction · 0.70
saveFunction · 0.70
buffreplaceFunction · 0.70
trydecpointFunction · 0.70

Tested by

no test coverage detected