aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-10 15:37:44 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-10 15:37:44 -0300
commit73aa465a8ed8dee6c6a27a6f8b2f51227b70789d (patch)
tree496a63ffffe0312f1d0b9882d97944fa38ed7801 /llex.c
parent3d0577f4b98908be3f2d697ab75c5fbbd3f6999b (diff)
downloadlua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.tar.gz
lua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.tar.bz2
lua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.zip
some name changes
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/llex.c b/llex.c
index 6745fbbc..a3d2cab3 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 1.51 2000/02/08 16:34:31 roberto Exp roberto $ 2** $Id: llex.c,v 1.52 2000/03/03 14:58:26 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*/
@@ -39,7 +39,7 @@ static const char *const token2string [] = {"and", "do", "else", "elseif", "end"
39void luaX_init (lua_State *L) { 39void luaX_init (lua_State *L) {
40 int i; 40 int i;
41 for (i=0; i<NUM_RESERVED; i++) { 41 for (i=0; i<NUM_RESERVED; i++) {
42 TaggedString *ts = luaS_new(L, token2string[i]); 42 TString *ts = luaS_new(L, token2string[i]);
43 ts->marked = (unsigned char)(RESERVEDMARK+i); /* reserved word */ 43 ts->marked = (unsigned char)(RESERVEDMARK+i); /* reserved word */
44 } 44 }
45} 45}
@@ -160,7 +160,7 @@ static void ifskip (lua_State *L, LexState *LS) {
160 if (LS->current == '\n') 160 if (LS->current == '\n')
161 inclinenumber(L, LS); 161 inclinenumber(L, LS);
162 else if (LS->current == EOZ) 162 else if (LS->current == EOZ)
163 luaX_error(LS, "input ends inside a $if", EOS); 163 luaX_error(LS, "input ends inside a $if", TK_EOS);
164 else next(LS); 164 else next(LS);
165 } 165 }
166} 166}
@@ -240,7 +240,7 @@ static void read_long_string (lua_State *L, LexState *LS) {
240 for (;;) { 240 for (;;) {
241 switch (LS->current) { 241 switch (LS->current) {
242 case EOZ: 242 case EOZ:
243 luaX_error(LS, "unfinished long string", STRING); 243 luaX_error(LS, "unfinished long string", TK_STRING);
244 break; /* to avoid warnings */ 244 break; /* to avoid warnings */
245 case '[': 245 case '[':
246 save_and_next(L, LS); 246 save_and_next(L, LS);
@@ -276,7 +276,7 @@ static void read_string (lua_State *L, LexState *LS, int del) {
276 while (LS->current != del) { 276 while (LS->current != del) {
277 switch (LS->current) { 277 switch (LS->current) {
278 case EOZ: case '\n': 278 case EOZ: case '\n':
279 luaX_error(LS, "unfinished string", STRING); 279 luaX_error(LS, "unfinished string", TK_STRING);
280 break; /* to avoid warnings */ 280 break; /* to avoid warnings */
281 case '\\': 281 case '\\':
282 next(LS); /* do not save the '\' */ 282 next(LS); /* do not save the '\' */
@@ -298,7 +298,7 @@ static void read_string (lua_State *L, LexState *LS, int del) {
298 next(LS); 298 next(LS);
299 } while (++i<3 && isdigit(LS->current)); 299 } while (++i<3 && isdigit(LS->current));
300 if (c != (unsigned char)c) 300 if (c != (unsigned char)c)
301 luaX_error(LS, "escape sequence too large", STRING); 301 luaX_error(LS, "escape sequence too large", TK_STRING);
302 save(L, c); 302 save(L, c);
303 break; 303 break;
304 } 304 }
@@ -343,34 +343,34 @@ int luaX_lex (LexState *LS) {
343 else { 343 else {
344 save_and_next(L, LS); /* pass the second '[' */ 344 save_and_next(L, LS); /* pass the second '[' */
345 read_long_string(L, LS); 345 read_long_string(L, LS);
346 return STRING; 346 return TK_STRING;
347 } 347 }
348 348
349 case '=': 349 case '=':
350 next(LS); 350 next(LS);
351 if (LS->current != '=') return '='; 351 if (LS->current != '=') return '=';
352 else { next(LS); return EQ; } 352 else { next(LS); return TK_EQ; }
353 353
354 case '<': 354 case '<':
355 next(LS); 355 next(LS);
356 if (LS->current != '=') return '<'; 356 if (LS->current != '=') return '<';
357 else { next(LS); return LE; } 357 else { next(LS); return TK_LE; }
358 358
359 case '>': 359 case '>':
360 next(LS); 360 next(LS);
361 if (LS->current != '=') return '>'; 361 if (LS->current != '=') return '>';
362 else { next(LS); return GE; } 362 else { next(LS); return TK_GE; }
363 363
364 case '~': 364 case '~':
365 next(LS); 365 next(LS);
366 if (LS->current != '=') return '~'; 366 if (LS->current != '=') return '~';
367 else { next(LS); return NE; } 367 else { next(LS); return TK_NE; }
368 368
369 case '"': 369 case '"':
370 case '\'': 370 case '\'':
371 luaL_resetbuffer(L); 371 luaL_resetbuffer(L);
372 read_string(L, LS, LS->current); 372 read_string(L, LS, LS->current);
373 return STRING; 373 return TK_STRING;
374 374
375 case '.': 375 case '.':
376 luaL_resetbuffer(L); 376 luaL_resetbuffer(L);
@@ -379,9 +379,9 @@ int luaX_lex (LexState *LS) {
379 next(LS); 379 next(LS);
380 if (LS->current == '.') { 380 if (LS->current == '.') {
381 next(LS); 381 next(LS);
382 return DOTS; /* ... */ 382 return TK_DOTS; /* ... */
383 } 383 }
384 else return CONC; /* .. */ 384 else return TK_CONC; /* .. */
385 } 385 }
386 else if (!isdigit(LS->current)) return '.'; 386 else if (!isdigit(LS->current)) return '.';
387 else goto fraction; /* LS->current is a digit */ 387 else goto fraction; /* LS->current is a digit */
@@ -397,7 +397,7 @@ int luaX_lex (LexState *LS) {
397 if (LS->current == '.') { 397 if (LS->current == '.') {
398 save(L, '.'); 398 save(L, '.');
399 luaX_error(LS, "ambiguous syntax" 399 luaX_error(LS, "ambiguous syntax"
400 " (decimal point x string concatenation)", NUMBER); 400 " (decimal point x string concatenation)", TK_NUMBER);
401 } 401 }
402 } 402 }
403 fraction: /* LUA_NUMBER */ 403 fraction: /* LUA_NUMBER */
@@ -412,13 +412,13 @@ int luaX_lex (LexState *LS) {
412 } 412 }
413 save(L, '\0'); 413 save(L, '\0');
414 if (!luaO_str2d(L->Mbuffer+L->Mbuffbase, &LS->seminfo.r)) 414 if (!luaO_str2d(L->Mbuffer+L->Mbuffbase, &LS->seminfo.r))
415 luaX_error(LS, "malformed number", NUMBER); 415 luaX_error(LS, "malformed number", TK_NUMBER);
416 return NUMBER; 416 return TK_NUMBER;
417 417
418 case EOZ: 418 case EOZ:
419 if (LS->iflevel > 0) 419 if (LS->iflevel > 0)
420 luaX_error(LS, "input ends inside a $if", EOS); 420 luaX_error(LS, "input ends inside a $if", TK_EOS);
421 return EOS; 421 return TK_EOS;
422 422
423 case '_': goto tname; 423 case '_': goto tname;
424 424
@@ -431,7 +431,7 @@ int luaX_lex (LexState *LS) {
431 return c; 431 return c;
432 } 432 }
433 tname: { /* identifier or reserved word */ 433 tname: { /* identifier or reserved word */
434 TaggedString *ts; 434 TString *ts;
435 luaL_resetbuffer(L); 435 luaL_resetbuffer(L);
436 do { 436 do {
437 save_and_next(L, LS); 437 save_and_next(L, LS);
@@ -441,7 +441,7 @@ int luaX_lex (LexState *LS) {
441 if (ts->marked >= RESERVEDMARK) /* reserved word? */ 441 if (ts->marked >= RESERVEDMARK) /* reserved word? */
442 return ts->marked-RESERVEDMARK+FIRST_RESERVED; 442 return ts->marked-RESERVEDMARK+FIRST_RESERVED;
443 LS->seminfo.ts = ts; 443 LS->seminfo.ts = ts;
444 return NAME; 444 return TK_NAME;
445 } 445 }
446 } 446 }
447 } 447 }