Mercurial > vba-clojure
diff src/lua/lparser.h @ 11:27763b933818
raise lua sources up one level
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 11:07:39 -0600 |
parents | src/lua/src/lparser.h@f9f4f1b99eed |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/lua/lparser.h Sat Mar 03 11:07:39 2012 -0600 1.3 @@ -0,0 +1,82 @@ 1.4 +/* 1.5 +** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $ 1.6 +** Lua Parser 1.7 +** See Copyright Notice in lua.h 1.8 +*/ 1.9 + 1.10 +#ifndef lparser_h 1.11 +#define lparser_h 1.12 + 1.13 +#include "llimits.h" 1.14 +#include "lobject.h" 1.15 +#include "lzio.h" 1.16 + 1.17 + 1.18 +/* 1.19 +** Expression descriptor 1.20 +*/ 1.21 + 1.22 +typedef enum { 1.23 + VVOID, /* no value */ 1.24 + VNIL, 1.25 + VTRUE, 1.26 + VFALSE, 1.27 + VK, /* info = index of constant in `k' */ 1.28 + VKNUM, /* nval = numerical value */ 1.29 + VLOCAL, /* info = local register */ 1.30 + VUPVAL, /* info = index of upvalue in `upvalues' */ 1.31 + VGLOBAL, /* info = index of table; aux = index of global name in `k' */ 1.32 + VINDEXED, /* info = table register; aux = index register (or `k') */ 1.33 + VJMP, /* info = instruction pc */ 1.34 + VRELOCABLE, /* info = instruction pc */ 1.35 + VNONRELOC, /* info = result register */ 1.36 + VCALL, /* info = instruction pc */ 1.37 + VVARARG /* info = instruction pc */ 1.38 +} expkind; 1.39 + 1.40 +typedef struct expdesc { 1.41 + expkind k; 1.42 + union { 1.43 + struct { int info, aux; } s; 1.44 + lua_Number nval; 1.45 + } u; 1.46 + int t; /* patch list of `exit when true' */ 1.47 + int f; /* patch list of `exit when false' */ 1.48 +} expdesc; 1.49 + 1.50 + 1.51 +typedef struct upvaldesc { 1.52 + lu_byte k; 1.53 + lu_byte info; 1.54 +} upvaldesc; 1.55 + 1.56 + 1.57 +struct BlockCnt; /* defined in lparser.c */ 1.58 + 1.59 + 1.60 +/* state needed to generate code for a given function */ 1.61 +typedef struct FuncState { 1.62 + Proto *f; /* current function header */ 1.63 + Table *h; /* table to find (and reuse) elements in `k' */ 1.64 + struct FuncState *prev; /* enclosing function */ 1.65 + struct LexState *ls; /* lexical state */ 1.66 + struct lua_State *L; /* copy of the Lua state */ 1.67 + struct BlockCnt *bl; /* chain of current blocks */ 1.68 + int pc; /* next position to code (equivalent to `ncode') */ 1.69 + int lasttarget; /* `pc' of last `jump target' */ 1.70 + int jpc; /* list of pending jumps to `pc' */ 1.71 + int freereg; /* first free register */ 1.72 + int nk; /* number of elements in `k' */ 1.73 + int np; /* number of elements in `p' */ 1.74 + short nlocvars; /* number of elements in `locvars' */ 1.75 + lu_byte nactvar; /* number of active local variables */ 1.76 + upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ 1.77 + unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ 1.78 +} FuncState; 1.79 + 1.80 + 1.81 +LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, 1.82 + const char *name); 1.83 + 1.84 + 1.85 +#endif