diff options
| -rw-r--r-- | lparser.c | 12 | ||||
| -rw-r--r-- | ltm.c | 8 |
2 files changed, 14 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 1.4 1998/07/24 18:02:38 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.5 1998/08/11 13:28:05 roberto Exp roberto $ |
| 3 | ** LL(1) Parser and code generator for Lua | 3 | ** LL(1) Parser and code generator for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -586,6 +586,12 @@ static void error_expected (LexState *ls, int token) { | |||
| 586 | luaX_error(ls, buff); | 586 | luaX_error(ls, buff); |
| 587 | } | 587 | } |
| 588 | 588 | ||
| 589 | |||
| 590 | static void error_unexpected (LexState *ls) { | ||
| 591 | luaX_error(ls, "unexpected token"); | ||
| 592 | } | ||
| 593 | |||
| 594 | |||
| 589 | static void error_unmatched (LexState *ls, int what, int who, int where) { | 595 | static void error_unmatched (LexState *ls, int what, int who, int where) { |
| 590 | if (where == ls->linenumber) | 596 | if (where == ls->linenumber) |
| 591 | error_expected(ls, what); | 597 | error_expected(ls, what); |
| @@ -759,7 +765,7 @@ static int stat (LexState *ls) { | |||
| 759 | return 0; | 765 | return 0; |
| 760 | 766 | ||
| 761 | default: | 767 | default: |
| 762 | luaX_error(ls, "<statement> expected"); | 768 | error_unexpected(ls); |
| 763 | return 0; /* to avoid warnings */ | 769 | return 0; /* to avoid warnings */ |
| 764 | } | 770 | } |
| 765 | } | 771 | } |
| @@ -1252,7 +1258,7 @@ static void part (LexState *ls, constdesc *cd) { | |||
| 1252 | code_string(ls, ls->fs->localvar[v.info]); | 1258 | code_string(ls, ls->fs->localvar[v.info]); |
| 1253 | break; | 1259 | break; |
| 1254 | default: | 1260 | default: |
| 1255 | luaX_error(ls, "`=' unexpected"); | 1261 | error_unexpected(ls); |
| 1256 | } | 1262 | } |
| 1257 | next(ls); | 1263 | next(ls); |
| 1258 | exp1(ls); | 1264 | exp1(ls); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltm.c,v 1.16 1998/06/18 16:57:03 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 1.17 1998/08/21 17:43:44 roberto Exp roberto $ |
| 3 | ** Tag methods | 3 | ** Tag methods |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -148,8 +148,10 @@ void luaT_settagmethod (int t, char *event, TObject *func) | |||
| 148 | int e = luaI_checkevent(event, luaT_eventname); | 148 | int e = luaI_checkevent(event, luaT_eventname); |
| 149 | checktag(t); | 149 | checktag(t); |
| 150 | if (!validevent(t, e)) | 150 | if (!validevent(t, e)) |
| 151 | luaL_verror("settagmethod: cannot change tag method `%.20s' for tag %d", | 151 | luaL_verror("cannot change tag method `%.20s' for type `%.20s'%.20s", |
| 152 | luaT_eventname[e], t); | 152 | luaT_eventname[e], luaO_typenames[-t], |
| 153 | (t == LUA_T_ARRAY || t == LUA_T_USERDATA) ? " with default tag" | ||
| 154 | : ""); | ||
| 153 | *func = *luaT_getim(t,e); | 155 | *func = *luaT_getim(t,e); |
| 154 | *luaT_getim(t, e) = temp; | 156 | *luaT_getim(t, e) = temp; |
| 155 | } | 157 | } |
