1
0
mirror of https://github.com/lua/lua.git synced 2025-01-28 06:03:00 +08:00

hexadecimal constants may be floating values too

This commit is contained in:
Roberto Ierusalimschy 2010-09-13 18:49:58 -03:00
parent a289a62717
commit b22356e5c5

10
llex.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: llex.c,v 2.37 2010/04/16 12:31:07 roberto Exp roberto $ ** $Id: llex.c,v 2.38 2010/09/07 19:21:39 roberto Exp roberto $
** Lexical Analyzer ** Lexical Analyzer
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -221,11 +221,9 @@ static void read_numeral (LexState *ls, SemInfo *seminfo) {
lua_assert(lisdigit(ls->current)); lua_assert(lisdigit(ls->current));
do { do {
save_and_next(ls); save_and_next(ls);
} while (lisdigit(ls->current) || ls->current == '.'); if (check_next(ls, "EePp")) /* exponent part? */
if (check_next(ls, "Ee")) /* `E'? */ check_next(ls, "+-"); /* optional exponent sign */
check_next(ls, "+-"); /* optional exponent sign */ } while (lislalnum(ls->current) || ls->current == '.');
while (lislalnum(ls->current))
save_and_next(ls);
save(ls, '\0'); save(ls, '\0');
buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */ if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */