aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-05-24 15:04:17 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-05-24 15:04:17 -0300
commit677313da32d58b418c15dc5f4a6ff435fb63d365 (patch)
tree418e702f7479e051be69b41fd133b13d846834d2 /llex.c
parentef62b340e0a6b7b18931000dcbb19c4703bfe0e8 (diff)
downloadlua-677313da32d58b418c15dc5f4a6ff435fb63d365.tar.gz
lua-677313da32d58b418c15dc5f4a6ff435fb63d365.tar.bz2
lua-677313da32d58b418c15dc5f4a6ff435fb63d365.zip
bug: record-constructor starting with an upvalue name gets an error
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/llex.c b/llex.c
index 00a248a9..e5275682 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 1.58 2000/05/08 19:32:53 roberto Exp roberto $ 2** $Id: llex.c,v 1.59 2000/05/24 13:54:49 roberto Exp roberto $
3** Lexical Analyzer 3** Lexical Analyzer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -54,7 +54,7 @@ void luaX_checklimit (LexState *ls, int val, int limit, const char *msg) {
54 if (val > limit) { 54 if (val > limit) {
55 char buff[100]; 55 char buff[100];
56 sprintf(buff, "too many %.50s (limit=%d)", msg, limit); 56 sprintf(buff, "too many %.50s (limit=%d)", msg, limit);
57 luaX_error(ls, buff, ls->token); 57 luaX_error(ls, buff, ls->t.token);
58 } 58 }
59} 59}
60 60
@@ -108,6 +108,7 @@ static void firstline (LexState *LS)
108void luaX_setinput (lua_State *L, LexState *LS, ZIO *z) { 108void luaX_setinput (lua_State *L, LexState *LS, ZIO *z) {
109 LS->L = L; 109 LS->L = L;
110 LS->current = '\n'; 110 LS->current = '\n';
111 LS->next.token = TK_EOS; /* no next token */
111 LS->linenumber = 0; 112 LS->linenumber = 0;
112 LS->iflevel = 0; 113 LS->iflevel = 0;
113 LS->ifstate[0].skip = 0; 114 LS->ifstate[0].skip = 0;
@@ -281,7 +282,7 @@ static void read_long_string (lua_State *L, LexState *LS) {
281 } 282 }
282 } endloop: 283 } endloop:
283 save_and_next(L, LS); /* skip the second ']' */ 284 save_and_next(L, LS); /* skip the second ']' */
284 LS->seminfo.ts = luaS_newlstr(L, L->Mbuffer+(L->Mbuffbase+2), 285 LS->t.seminfo.ts = luaS_newlstr(L, L->Mbuffer+(L->Mbuffbase+2),
285 L->Mbuffnext-L->Mbuffbase-4); 286 L->Mbuffnext-L->Mbuffbase-4);
286} 287}
287 288
@@ -327,7 +328,7 @@ static void read_string (lua_State *L, LexState *LS, int del) {
327 } 328 }
328 } 329 }
329 save_and_next(L, LS); /* skip delimiter */ 330 save_and_next(L, LS); /* skip delimiter */
330 LS->seminfo.ts = luaS_newlstr(L, L->Mbuffer+(L->Mbuffbase+1), 331 LS->t.seminfo.ts = luaS_newlstr(L, L->Mbuffer+(L->Mbuffbase+1),
331 L->Mbuffnext-L->Mbuffbase-2); 332 L->Mbuffnext-L->Mbuffbase-2);
332} 333}
333 334
@@ -426,7 +427,7 @@ int luaX_lex (LexState *LS) {
426 save_and_next(L, LS); 427 save_and_next(L, LS);
427 } 428 }
428 save(L, '\0'); 429 save(L, '\0');
429 if (!luaO_str2d(L->Mbuffer+L->Mbuffbase, &LS->seminfo.r)) 430 if (!luaO_str2d(L->Mbuffer+L->Mbuffbase, &LS->t.seminfo.r))
430 luaX_error(LS, "malformed number", TK_NUMBER); 431 luaX_error(LS, "malformed number", TK_NUMBER);
431 return TK_NUMBER; 432 return TK_NUMBER;
432 433
@@ -455,7 +456,7 @@ int luaX_lex (LexState *LS) {
455 ts = luaS_new(L, L->Mbuffer+L->Mbuffbase); 456 ts = luaS_new(L, L->Mbuffer+L->Mbuffbase);
456 if (ts->marked >= RESERVEDMARK) /* reserved word? */ 457 if (ts->marked >= RESERVEDMARK) /* reserved word? */
457 return ts->marked-RESERVEDMARK+FIRST_RESERVED; 458 return ts->marked-RESERVEDMARK+FIRST_RESERVED;
458 LS->seminfo.ts = ts; 459 LS->t.seminfo.ts = ts;
459 return TK_NAME; 460 return TK_NAME;
460 } 461 }
461 } 462 }