LUA_NUMBER */ ** this function is quite liberal in what it accepts, as 'luaO_str2d' ** will reject ill-formed numerals. */
| 227 | ** will reject ill-formed numerals. |
| 228 | */ |
| 229 | static void read_numeral (LexState *ls, SemInfo *seminfo) { |
| 230 | const char *expo = "Ee"; |
| 231 | int first = ls->current; |
| 232 | lua_assert(lisdigit(ls->current)); |
| 233 | save_and_next(ls); |
| 234 | if (first == '0' && check_next(ls, "Xx")) /* hexadecimal? */ |
| 235 | expo = "Pp"; |
| 236 | for (;;) { |
| 237 | if (check_next(ls, expo)) /* exponent part? */ |
| 238 | (void) check_next(ls, "+-"); /* optional exponent sign */ |
| 239 | if (lisxdigit(ls->current) || ls->current == '.') |
| 240 | save_and_next(ls); |
| 241 | else break; |
| 242 | } |
| 243 | save(ls, '\0'); |
| 244 | buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ |
| 245 | if (!buff2d(ls->buff, &seminfo->r)) /* format error? */ |
| 246 | trydecpoint(ls, seminfo); /* try to update decimal point separator */ |
| 247 | } |
| 248 | |
| 249 | |
| 250 | /* |
no test coverage detected