aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/llex.c b/llex.c
index 118a0186..30130a22 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 2.92 2015/04/03 18:41:57 roberto Exp roberto $ 2** $Id: llex.c,v 2.93 2015/05/22 17:45:56 roberto Exp roberto $
3** Lexical Analyzer 3** Lexical Analyzer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -220,8 +220,6 @@ static void buffreplace (LexState *ls, char from, char to) {
220} 220}
221 221
222 222
223#define buff2num(b,o) (luaO_str2num(luaZ_buffer(b), o) != 0)
224
225/* 223/*
226** in case of format error, try to change decimal point separator to 224** in case of format error, try to change decimal point separator to
227** the one defined in the current locale and check again 225** the one defined in the current locale and check again
@@ -230,7 +228,7 @@ static void trydecpoint (LexState *ls, TValue *o) {
230 char old = ls->decpoint; 228 char old = ls->decpoint;
231 ls->decpoint = lua_getlocaledecpoint(); 229 ls->decpoint = lua_getlocaledecpoint();
232 buffreplace(ls, old, ls->decpoint); /* try new decimal separator */ 230 buffreplace(ls, old, ls->decpoint); /* try new decimal separator */
233 if (!buff2num(ls->buff, o)) { 231 if (luaO_str2num(luaZ_buffer(ls->buff), o) == 0) {
234 /* format error with correct decimal point: no more options */ 232 /* format error with correct decimal point: no more options */
235 buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */ 233 buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */
236 lexerror(ls, "malformed number", TK_FLT); 234 lexerror(ls, "malformed number", TK_FLT);
@@ -262,7 +260,7 @@ static int read_numeral (LexState *ls, SemInfo *seminfo) {
262 } 260 }
263 save(ls, '\0'); 261 save(ls, '\0');
264 buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ 262 buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
265 if (!buff2num(ls->buff, &obj)) /* format error? */ 263 if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0) /* format error? */
266 trydecpoint(ls, &obj); /* try to update decimal point separator */ 264 trydecpoint(ls, &obj); /* try to update decimal point separator */
267 if (ttisinteger(&obj)) { 265 if (ttisinteger(&obj)) {
268 seminfo->i = ivalue(&obj); 266 seminfo->i = ivalue(&obj);