From 74832b2a1005f480963324b5464e20e16fc73ceb Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 23 Jun 2006 13:09:15 -0300 Subject: detail --- lua.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lua.c') diff --git a/lua.c b/lua.c index b8cf32ed..5c0ae9c5 100644 --- a/lua.c +++ b/lua.c @@ -1,5 +1,5 @@ /* -** $Id: lua.c,v 1.159 2006/05/24 14:16:39 roberto Exp roberto $ +** $Id: lua.c,v 1.160 2006/06/02 15:34:00 roberto Exp roberto $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ @@ -157,13 +157,15 @@ static const char *get_prompt (lua_State *L, int firstline) { return p; } +/* mark in error messages for incomplete statements */ +#define mark LUA_QL("") +#define marklen (sizeof(mark) - 1) static int incomplete (lua_State *L, int status) { if (status == LUA_ERRSYNTAX) { size_t lmsg; const char *msg = lua_tolstring(L, -1, &lmsg); - const char *tp = msg + lmsg - (sizeof(LUA_QL("")) - 1); - if (strstr(msg, LUA_QL("")) == tp) { + if (lmsg >= marklen && strcmp(msg + lmsg - marklen, mark) == 0) { lua_pop(L, 1); return 1; } -- cgit v1.2.3-55-g6feb