From 0f0e19e655fa9f271642db485212d8af172926eb Mon Sep 17 00:00:00 2001 From: pixel Date: Sun, 19 Dec 2004 16:14:04 +0000 Subject: Fixing lua's decimal system. --- lib/lua/src/llex.c | 4 +++- lib/lua/src/lobject.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/lua/src') diff --git a/lib/lua/src/llex.c b/lib/lua/src/llex.c index ff88f92..c06ea9f 100644 --- a/lib/lua/src/llex.c +++ b/lib/lua/src/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 1.5 2004-11-27 21:46:07 pixel Exp $ +** $Id: llex.c,v 1.6 2004-12-19 16:14:04 pixel Exp $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -185,6 +185,8 @@ static void read_numeral (LexState *LS, int comma, SemInfo *seminfo) { hex = 1; checkbuffer(LS, 1); save_and_next(LS, l); + } else if (LS->current == '.') { + oct = hex = 0; } } while (isdigit(LS->current) || (hex && isxdigit(LS->current))) { diff --git a/lib/lua/src/lobject.c b/lib/lua/src/lobject.c index bdc83b3..62c70b6 100644 --- a/lib/lua/src/lobject.c +++ b/lib/lua/src/lobject.c @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 1.5 2004-11-27 21:46:07 pixel Exp $ +** $Id: lobject.c,v 1.6 2004-12-19 16:14:04 pixel Exp $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -86,7 +86,7 @@ int luaO_str2d (const char *s, lua_Number *result) { char *endptr; size_t l = strlen(s); lua_Number res; - if ((l > 0) && (s[0] == '0')) { + if ((l > 0) && (s[0] == '0') && (s[1] != '.')) { if ((l > 2) && (s[1] == 'x')) { res = strtol(s + 2, &endptr, 16); } else { -- cgit v1.2.3