diff options
Diffstat (limited to 'lparser.h')
-rw-r--r-- | lparser.h | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.h,v 1.63 2010/03/12 19:14:06 roberto Exp roberto $ | 2 | ** $Id: lparser.h,v 1.64 2010/07/02 20:42:40 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -23,27 +23,30 @@ typedef enum { | |||
23 | VFALSE, | 23 | VFALSE, |
24 | VK, /* info = index of constant in `k' */ | 24 | VK, /* info = index of constant in `k' */ |
25 | VKNUM, /* nval = numerical value */ | 25 | VKNUM, /* nval = numerical value */ |
26 | VNONRELOC, /* info = result register */ | ||
26 | VLOCAL, /* info = local register */ | 27 | VLOCAL, /* info = local register */ |
27 | VUPVAL, /* info = index of upvalue in 'upvalues' */ | 28 | VUPVAL, /* info = index of upvalue in 'upvalues' */ |
28 | VINDEXED, /* t = table register; idx = index R/K */ | 29 | VINDEXED, /* t = table register/upvalue; idx = index R/K */ |
29 | VINDEXEDUP, /* t = table upvalue; idx = index R/K */ | ||
30 | VJMP, /* info = instruction pc */ | 30 | VJMP, /* info = instruction pc */ |
31 | VRELOCABLE, /* info = instruction pc */ | 31 | VRELOCABLE, /* info = instruction pc */ |
32 | VNONRELOC, /* info = result register */ | ||
33 | VCALL, /* info = instruction pc */ | 32 | VCALL, /* info = instruction pc */ |
34 | VVARARG /* info = instruction pc */ | 33 | VVARARG /* info = instruction pc */ |
35 | } expkind; | 34 | } expkind; |
36 | 35 | ||
37 | 36 | ||
37 | #define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED) | ||
38 | #define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL) | ||
39 | |||
38 | typedef struct expdesc { | 40 | typedef struct expdesc { |
39 | expkind k; | 41 | expkind k; |
40 | union { | 42 | union { |
41 | struct { | 43 | struct { /* for indexed variables (VINDEXED) */ |
42 | short idx; | 44 | short idx; /* index (R/K) */ |
43 | lu_byte t; | 45 | lu_byte t; /* table (register or upvalue) */ |
44 | } ind; /* for indexed variables */ | 46 | lu_byte vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */ |
45 | int info; | 47 | } ind; |
46 | lua_Number nval; | 48 | int info; /* for generic use */ |
49 | lua_Number nval; /* for VKNUM */ | ||
47 | } u; | 50 | } u; |
48 | int t; /* patch list of `exit when true' */ | 51 | int t; /* patch list of `exit when true' */ |
49 | int f; /* patch list of `exit when false' */ | 52 | int f; /* patch list of `exit when false' */ |