rpm  4.5
lparser.h
Go to the documentation of this file.
1 /*
2 ** $Id: lparser.h,v 1.1 2004/03/16 21:58:30 niemeyer Exp $
3 ** Lua Parser
4 ** See Copyright Notice in lua.h
5 */
6 
7 #ifndef lparser_h
8 #define lparser_h
9 
10 #include "llimits.h"
11 #include "lobject.h"
12 #include "ltable.h"
13 #include "lzio.h"
14 
15 
16 /*
17 ** Expression descriptor
18 */
19 
20 typedef enum {
21  VVOID, /* no value */
25  VK, /* info = index of constant in `k' */
26  VLOCAL, /* info = local register */
27  VUPVAL, /* info = index of upvalue in `upvalues' */
28  VGLOBAL, /* info = index of table; aux = index of global name in `k' */
29  VINDEXED, /* info = table register; aux = index register (or `k') */
30  VJMP, /* info = instruction pc */
31  VRELOCABLE, /* info = instruction pc */
32  VNONRELOC, /* info = result register */
33  VCALL /* info = result register */
34 } expkind;
35 
36 typedef struct expdesc {
38  int info, aux;
39  int t; /* patch list of `exit when true' */
40  int f; /* patch list of `exit when false' */
41 } expdesc;
42 
43 
44 struct BlockCnt; /* defined in lparser.c */
45 
46 
47 /* state needed to generate code for a given function */
48 typedef struct FuncState {
49 /*@null@*/
50  Proto *f; /* current function header */
51 /*@null@*/
52  Table *h; /* table to find (and reuse) elements in `k' */
53 /*@null@*/
54  struct FuncState *prev; /* enclosing function */
55  struct LexState *ls; /* lexical state */
56  struct lua_State *L; /* copy of the Lua state */
57 /*@null@*/
58  struct BlockCnt *bl; /* chain of current blocks */
59  int pc; /* next position to code (equivalent to `ncode') */
60  int lasttarget; /* `pc' of last `jump target' */
61  int jpc; /* list of pending jumps to `pc' */
62  int freereg; /* first free register */
63  int nk; /* number of elements in `k' */
64  int np; /* number of elements in `p' */
65  int nlocvars; /* number of elements in `locvars' */
66  int nactvar; /* number of active local variables */
67  expdesc upvalues[MAXUPVALUES]; /* upvalues */
68  int actvar[MAXVARS]; /* declared-variable stack */
69 } FuncState;
70 
71 
72 Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff)
73  /*@modifies L, z @*/;
74 
75 
76 #endif