aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-03 11:58:26 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-03 11:58:26 -0300
commit3c9d999424520c809e05bee11d81788b488434f6 (patch)
tree7556d9ea10bda42b226aec4dd956753467cc0864 /llex.c
parentf7840a3e0bc07813246b2bad6bf4579848187908 (diff)
downloadlua-3c9d999424520c809e05bee11d81788b488434f6.tar.gz
lua-3c9d999424520c809e05bee11d81788b488434f6.tar.bz2
lua-3c9d999424520c809e05bee11d81788b488434f6.zip
many details (most by lhf).
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/llex.c b/llex.c
index 19edb8f0..6745fbbc 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 1.50 2000/01/26 18:51:49 roberto Exp roberto $ 2** $Id: llex.c,v 1.51 2000/02/08 16:34:31 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*/
@@ -23,7 +23,7 @@
23 23
24 24
25 25
26#define next(LS) (LS->current = zgetc(LS->lex_z)) 26#define next(LS) (LS->current = zgetc(LS->z))
27 27
28 28
29#define save(L, c) luaL_addchar(L, c) 29#define save(L, c) luaL_addchar(L, c)
@@ -37,7 +37,7 @@ static const char *const token2string [] = {"and", "do", "else", "elseif", "end"
37 37
38 38
39void luaX_init (lua_State *L) { 39void luaX_init (lua_State *L) {
40 unsigned 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 TaggedString *ts = luaS_new(L, token2string[i]);
43 ts->marked = (unsigned char)(RESERVEDMARK+i); /* reserved word */ 43 ts->marked = (unsigned char)(RESERVEDMARK+i); /* reserved word */
@@ -49,7 +49,7 @@ void luaX_init (lua_State *L) {
49 49
50void luaX_syntaxerror (LexState *ls, const char *s, const char *token) { 50void luaX_syntaxerror (LexState *ls, const char *s, const char *token) {
51 char buff[MAXSRC]; 51 char buff[MAXSRC];
52 luaL_chunkid(buff, zname(ls->lex_z), sizeof(buff)); 52 luaL_chunkid(buff, zname(ls->z), sizeof(buff));
53 luaL_verror(ls->L, "%.100s;\n last token read: `%.50s' at line %d in %.80s", 53 luaL_verror(ls->L, "%.100s;\n last token read: `%.50s' at line %d in %.80s",
54 s, token, ls->linenumber, buff); 54 s, token, ls->linenumber, buff);
55} 55}
@@ -86,10 +86,10 @@ static void luaX_invalidchar (LexState *ls, int c) {
86 86
87static void firstline (LexState *LS) 87static void firstline (LexState *LS)
88{ 88{
89 int c = zgetc(LS->lex_z); 89 int c = zgetc(LS->z);
90 if (c == '#') 90 if (c == '#')
91 while ((c=zgetc(LS->lex_z)) != '\n' && c != EOZ) /* skip first line */; 91 while ((c=zgetc(LS->z)) != '\n' && c != EOZ) /* skip first line */;
92 zungetc(LS->lex_z); 92 zungetc(LS->z);
93} 93}
94 94
95 95
@@ -100,7 +100,7 @@ void luaX_setinput (lua_State *L, LexState *LS, ZIO *z) {
100 LS->iflevel = 0; 100 LS->iflevel = 0;
101 LS->ifstate[0].skip = 0; 101 LS->ifstate[0].skip = 0;
102 LS->ifstate[0].elsepart = 1; /* to avoid a free $else */ 102 LS->ifstate[0].elsepart = 1; /* to avoid a free $else */
103 LS->lex_z = z; 103 LS->z = z;
104 LS->fs = NULL; 104 LS->fs = NULL;
105 firstline(LS); 105 firstline(LS);
106 luaL_resetbuffer(L); 106 luaL_resetbuffer(L);
@@ -322,7 +322,7 @@ int luaX_lex (LexState *LS) {
322 for (;;) { 322 for (;;) {
323 switch (LS->current) { 323 switch (LS->current) {
324 324
325 case ' ': case '\t': case '\r': /* CR: to avoid problems with DOS */ 325 case ' ': case '\t': case '\r': /* `\r' to avoid problems with DOS */
326 next(LS); 326 next(LS);
327 continue; 327 continue;
328 328