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

Function trydecpoint

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