diff options
author | Mike Pall <mike> | 2012-01-20 11:38:14 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2012-01-20 11:38:14 +0100 |
commit | a72134e28099dac14765cd84810844c742b34029 (patch) | |
tree | 8466a457a59cb80ab4f9d1c0f45da17c7a9cd833 | |
parent | 2f396c6db7c1f0737ebd32c82265befa563b1586 (diff) | |
download | luajit-a72134e28099dac14765cd84810844c742b34029.tar.gz luajit-a72134e28099dac14765cd84810844c742b34029.tar.bz2 luajit-a72134e28099dac14765cd84810844c742b34029.zip |
Fix parsing of hex literals with exponents.
-rw-r--r-- | src/lj_lex.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lj_lex.c b/src/lj_lex.c index 00daccd5..59d82259 100644 --- a/src/lj_lex.c +++ b/src/lj_lex.c | |||
@@ -137,14 +137,17 @@ static int lex_number64(LexState *ls, TValue *tv) | |||
137 | /* Parse a number literal. */ | 137 | /* Parse a number literal. */ |
138 | static void lex_number(LexState *ls, TValue *tv) | 138 | static void lex_number(LexState *ls, TValue *tv) |
139 | { | 139 | { |
140 | int c; | 140 | int c, xp = 'E'; |
141 | lua_assert(lj_char_isdigit(ls->current)); | 141 | lua_assert(lj_char_isdigit(ls->current)); |
142 | do { | 142 | if ((c = ls->current) == '0') { |
143 | save_and_next(ls); | ||
144 | if ((ls->current & ~0x20) == 'X') xp = 'P'; | ||
145 | } | ||
146 | while (lj_char_isident(ls->current) || ls->current == '.' || | ||
147 | ((ls->current == '-' || ls->current == '+') && (c & ~0x20) == xp)) { | ||
143 | c = ls->current; | 148 | c = ls->current; |
144 | save_and_next(ls); | 149 | save_and_next(ls); |
145 | } while (lj_char_isident(ls->current) || ls->current == '.' || | 150 | } |
146 | ((ls->current == '-' || ls->current == '+') && | ||
147 | ((c & ~0x20) == 'E' || (c & ~0x20) == 'P'))); | ||
148 | #if LJ_HASFFI | 151 | #if LJ_HASFFI |
149 | c &= ~0x20; | 152 | c &= ~0x20; |
150 | if ((c == 'I' || c == 'L' || c == 'U') && !ctype_ctsG(G(ls->L))) | 153 | if ((c == 'I' || c == 'L' || c == 'U') && !ctype_ctsG(G(ls->L))) |