diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-27 14:41:58 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-27 14:41:58 -0300 |
| commit | 282ab366f4ffe00fc8006f90d2ac6798e9c78d92 (patch) | |
| tree | b36b67e07e156c93abdfce8d0bc7b61dd6e19e46 /llex.h | |
| parent | 444d6a106bdad894808288fc2594ff0b0eac6cba (diff) | |
| download | lua-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.h | 16 |
1 files changed, 10 insertions, 6 deletions
| @@ -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 | ||
| 38 | typedef union { | ||
| 39 | Number r; | ||
| 40 | TString *ts; | ||
| 41 | } SemInfo; /* semantics information */ | ||
| 42 | |||
| 43 | |||
| 38 | typedef struct Token { | 44 | typedef 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 | |||
| 46 | typedef struct LexState { | 50 | typedef 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 | ||
| 59 | void luaX_init (lua_State *L); | 63 | void luaX_init (lua_State *L); |
| 60 | void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source); | 64 | void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source); |
| 61 | int luaX_lex (LexState *LS); | 65 | int luaX_lex (LexState *LS, SemInfo *seminfo); |
| 62 | void luaX_checklimit (LexState *ls, int val, int limit, const char *msg); | 66 | void luaX_checklimit (LexState *ls, int val, int limit, const char *msg); |
| 63 | void luaX_syntaxerror (LexState *ls, const char *s, const char *token); | 67 | void luaX_syntaxerror (LexState *ls, const char *s, const char *token); |
| 64 | void luaX_error (LexState *ls, const char *s, int token); | 68 | void luaX_error (LexState *ls, const char *s, int token); |
