MCPcopy Create free account
hub / github.com/TASEmulators/fceux / trydecpoint

Function trydecpoint

src/lua/src/llex.c:177–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175
176
177static void trydecpoint (LexState *ls, SemInfo *seminfo) {
178 /* format error: try to update decimal point separator */
179 struct lconv *cv = localeconv();
180 char old = ls->decpoint;
181 ls->decpoint = (cv ? cv->decimal_point[0] : '.');
182 buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */
183 if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) {
184 /* format error with correct decimal point: no more options */
185 buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */
186 luaX_lexerror(ls, "malformed number", TK_NUMBER);
187 }
188}
189
190
191/* LUA_NUMBER */

Callers 1

read_numeralFunction · 0.85

Calls 3

buffreplaceFunction · 0.85
luaO_str2dFunction · 0.85
luaX_lexerrorFunction · 0.85

Tested by

no test coverage detected