Fix parsing of hex literals with exponents.

This commit is contained in:
Mike Pall 2012-01-20 11:38:14 +01:00
parent 2f396c6db7
commit a72134e280

View File

@ -137,14 +137,17 @@ static int lex_number64(LexState *ls, TValue *tv)
/* Parse a number literal. */ /* Parse a number literal. */
static void lex_number(LexState *ls, TValue *tv) static void lex_number(LexState *ls, TValue *tv)
{ {
int c; int c, xp = 'E';
lua_assert(lj_char_isdigit(ls->current)); lua_assert(lj_char_isdigit(ls->current));
do { if ((c = ls->current) == '0') {
save_and_next(ls);
if ((ls->current & ~0x20) == 'X') xp = 'P';
}
while (lj_char_isident(ls->current) || ls->current == '.' ||
((ls->current == '-' || ls->current == '+') && (c & ~0x20) == xp)) {
c = ls->current; c = ls->current;
save_and_next(ls); save_and_next(ls);
} while (lj_char_isident(ls->current) || ls->current == '.' || }
((ls->current == '-' || ls->current == '+') &&
((c & ~0x20) == 'E' || (c & ~0x20) == 'P')));
#if LJ_HASFFI #if LJ_HASFFI
c &= ~0x20; c &= ~0x20;
if ((c == 'I' || c == 'L' || c == 'U') && !ctype_ctsG(G(ls->L))) if ((c == 'I' || c == 'L' || c == 'U') && !ctype_ctsG(G(ls->L)))