/* this function is quite liberal in what it accepts, as 'luaO_str2num' will reject ill-formed numerals.  */
static int read_numeral(LexState *ls, SemInfo *seminfo)
/* this function is quite liberal in what it accepts, as 'luaO_str2num' will reject ill-formed numerals.  */
static int read_numeral(LexState *ls, SemInfo *seminfo)
{
    if (check_next2(ls, expo))
      check_next2(ls, "-+");
    if (lisxdigit(ls->current))
      save_and_next(ls);
    else if (ls->current == '.')
      save_and_next(ls);
    else break;
  }
  save(ls, '\0');
  if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0)
    lexerror(ls, "malformed number", TK_FLT);
  if (ttisinteger(&obj)) {
    seminfo->i = ivalue(&obj);
    return TK_INT;
  }
  else {
    lua_assert(ttisfloat(&obj));
    seminfo->r = fltvalue(&obj);
    return TK_FLT;
  }
}