diff options
-rw-r--r-- | lua.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.144 2005/05/17 19:49:15 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.145 2005/06/03 20:16:16 roberto Exp roberto $ |
3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -148,13 +148,16 @@ static const char *get_prompt (lua_State *L, int firstline) { | |||
148 | 148 | ||
149 | 149 | ||
150 | static int incomplete (lua_State *L, int status) { | 150 | static int incomplete (lua_State *L, int status) { |
151 | if (status == LUA_ERRSYNTAX && | 151 | if (status == LUA_ERRSYNTAX) { |
152 | strstr(lua_tostring(L, -1), LUA_QL("<eof>")) != NULL) { | 152 | size_t lmsg; |
153 | lua_pop(L, 1); | 153 | const char *msg = lua_tolstring(L, -1, &lmsg); |
154 | return 1; | 154 | const char *tp = msg + lmsg - (sizeof(LUA_QL("<eof>")) - 1); |
155 | if (strstr(msg, LUA_QL("<eof>")) == tp) { | ||
156 | lua_pop(L, 1); | ||
157 | return 1; | ||
158 | } | ||
155 | } | 159 | } |
156 | else | 160 | return 0; /* else... */ |
157 | return 0; | ||
158 | } | 161 | } |
159 | 162 | ||
160 | 163 | ||