MCPcopy Create free account
hub / github.com/cuberite/cuberite / trydecpoint

Function trydecpoint

lib/lua/src/llex.c:177–192  ·  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 char old = ls->decpoint;
180#if defined(ANDROID_NDK)
181 ls->decpoint = '.';
182#else
183 struct lconv *cv = localeconv();
184 ls->decpoint = (cv ? cv->decimal_point[0] : '.');
185#endif
186 buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */
187 if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) {
188 /* format error with correct decimal point: no more options */
189 buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */
190 luaX_lexerror(ls, "malformed number", TK_NUMBER);
191 }
192}
193
194
195/* 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