diff options
Diffstat (limited to 'src/lparser.h')
-rw-r--r-- | src/lparser.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/lparser.h b/src/lparser.h index 18836afd..2ad0a509 100644 --- a/src/lparser.h +++ b/src/lparser.h @@ -1,5 +1,5 @@ /* -** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $ +** $Id: lparser.h,v 1.61 2009/10/11 20:02:19 roberto Exp $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -23,8 +23,8 @@ typedef enum { VFALSE, VK, /* info = index of constant in `k' */ VKNUM, /* nval = numerical value */ - VLOCAL, /* info = local register */ - VUPVAL, /* info = index of upvalue in `upvalues' */ + VLOCAL, /* info = local register; aux = read only */ + VUPVAL, /* info = index of upvalue in 'upvalues'; aux = read only */ VGLOBAL, /* info = index of table; aux = index of global name in `k' */ VINDEXED, /* info = table register; aux = index register (or `k') */ VJMP, /* info = instruction pc */ @@ -34,6 +34,7 @@ typedef enum { VVARARG /* info = instruction pc */ } expkind; + typedef struct expdesc { expkind k; union { @@ -45,10 +46,17 @@ typedef struct expdesc { } expdesc; -typedef struct upvaldesc { - lu_byte k; - lu_byte info; -} upvaldesc; +typedef struct vardesc { + unsigned short idx; +} vardesc; + + +/* list of all active local variables */ +typedef struct Varlist { + vardesc *actvar; + int nactvar; + int actvarsize; +} Varlist; struct BlockCnt; /* defined in lparser.c */ @@ -68,15 +76,16 @@ typedef struct FuncState { int freereg; /* first free register */ int nk; /* number of elements in `k' */ int np; /* number of elements in `p' */ + int firstlocal; /* index of first local var of this function */ short nlocvars; /* number of elements in `locvars' */ lu_byte nactvar; /* number of active local variables */ - upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ - unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ + lu_byte nups; /* number of upvalues */ + lu_byte envreg; /* register holding current lexical environment */ } FuncState; LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, - const char *name); + Varlist *varl, const char *name); #endif |