lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


In Lua 5.0.2, lua.c contains:

static int incomplete (int status) {
  if (status == LUA_ERRSYNTAX &&
         strstr(lua_tostring(L, -1), "near `<eof>'") != NULL) {
    lua_pop(L, 1);
    return 1;
  }
  else
    return 0;
}

In 5.1work 6, the test at the third line was incorrectly simplified to:

         strstr(lua_tostring(L, -1), "<eof>") != NULL) {


Unfortunately:

> =loadstring("do", "foo")
nil     [string "foo"]:1: `end' expected near `<eof>'
> =loadstring("end", "foo")
nil     [string "foo"]:1: <eof> expected near `end'

So the latter error message always causes incomplete to return 1, and if you ever type an unmatched end at the standalone interpreter, you have no escape.

R.