diff options
Diffstat (limited to 'llex.c')
-rw-r--r-- | llex.c | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 1.2 1997/09/26 15:02:26 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 1.3 1997/10/13 22:10:45 roberto Exp roberto $ |
3 | ** Lexical Analizer | 3 | ** Lexical Analizer |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -30,7 +30,7 @@ int lua_debug=0; | |||
30 | 30 | ||
31 | 31 | ||
32 | 32 | ||
33 | static void addReserved (void) | 33 | void luaX_init (void) |
34 | { | 34 | { |
35 | static struct { | 35 | static struct { |
36 | char *name; | 36 | char *name; |
@@ -41,14 +41,10 @@ static void addReserved (void) | |||
41 | {"nil", NIL}, {"not", NOT}, {"or", OR}, {"repeat", REPEAT}, | 41 | {"nil", NIL}, {"not", NOT}, {"or", OR}, {"repeat", REPEAT}, |
42 | {"return", RETURN}, {"then", THEN}, {"until", UNTIL}, {"while", WHILE} | 42 | {"return", RETURN}, {"then", THEN}, {"until", UNTIL}, {"while", WHILE} |
43 | }; | 43 | }; |
44 | static int firsttime = 1; | 44 | int i; |
45 | if (firsttime) { | 45 | for (i=0; i<(sizeof(reserved)/sizeof(reserved[0])); i++) { |
46 | int i; | 46 | TaggedString *ts = luaS_new(reserved[i].name); |
47 | firsttime = 0; | 47 | ts->head.marked = reserved[i].token; /* reserved word (always > 255) */ |
48 | for (i=0; i<(sizeof(reserved)/sizeof(reserved[0])); i++) { | ||
49 | TaggedString *ts = luaS_new(reserved[i].name); | ||
50 | ts->head.marked = reserved[i].token; /* reserved word (always > 255) */ | ||
51 | } | ||
52 | } | 48 | } |
53 | } | 49 | } |
54 | 50 | ||
@@ -85,7 +81,6 @@ static void firstline (void) | |||
85 | 81 | ||
86 | void luaX_setinput (ZIO *z) | 82 | void luaX_setinput (ZIO *z) |
87 | { | 83 | { |
88 | addReserved(); | ||
89 | current = '\n'; | 84 | current = '\n'; |
90 | luaX_linenumber = 0; | 85 | luaX_linenumber = 0; |
91 | iflevel = 0; | 86 | iflevel = 0; |