aboutsummaryrefslogtreecommitdiff
path: root/llex.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-27 14:41:58 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-27 14:41:58 -0300
commit282ab366f4ffe00fc8006f90d2ac6798e9c78d92 (patch)
treeb36b67e07e156c93abdfce8d0bc7b61dd6e19e46 /llex.h
parent444d6a106bdad894808288fc2594ff0b0eac6cba (diff)
downloadlua-282ab366f4ffe00fc8006f90d2ac6798e9c78d92.tar.gz
lua-282ab366f4ffe00fc8006f90d2ac6798e9c78d92.tar.bz2
lua-282ab366f4ffe00fc8006f90d2ac6798e9c78d92.zip
bug: parser overwrites semantic information when looking ahead
Diffstat (limited to 'llex.h')
-rw-r--r--llex.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/llex.h b/llex.h
index 604b8bf1..f0d0820d 100644
--- a/llex.h
+++ b/llex.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.h,v 1.29 2000/06/19 18:05:14 roberto Exp roberto $ 2** $Id: llex.h,v 1.30 2000/06/21 18:13:56 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*/
@@ -35,14 +35,18 @@ enum RESERVED {
35#define NUM_RESERVED ((int)(TK_WHILE-FIRST_RESERVED+1)) 35#define NUM_RESERVED ((int)(TK_WHILE-FIRST_RESERVED+1))
36 36
37 37
38typedef union {
39 Number r;
40 TString *ts;
41} SemInfo; /* semantics information */
42
43
38typedef struct Token { 44typedef struct Token {
39 int token; 45 int token;
40 union { 46 SemInfo seminfo;
41 Number r;
42 TString *ts;
43 } seminfo; /* semantics information */
44} Token; 47} Token;
45 48
49
46typedef struct LexState { 50typedef struct LexState {
47 int current; /* current character */ 51 int current; /* current character */
48 Token t; /* current token */ 52 Token t; /* current token */
@@ -58,7 +62,7 @@ typedef struct LexState {
58 62
59void luaX_init (lua_State *L); 63void luaX_init (lua_State *L);
60void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source); 64void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source);
61int luaX_lex (LexState *LS); 65int luaX_lex (LexState *LS, SemInfo *seminfo);
62void luaX_checklimit (LexState *ls, int val, int limit, const char *msg); 66void luaX_checklimit (LexState *ls, int val, int limit, const char *msg);
63void luaX_syntaxerror (LexState *ls, const char *s, const char *token); 67void luaX_syntaxerror (LexState *ls, const char *s, const char *token);
64void luaX_error (LexState *ls, const char *s, int token); 68void luaX_error (LexState *ls, const char *s, int token);