aboutsummaryrefslogtreecommitdiff
path: root/lparser.h
diff options
context:
space:
mode:
Diffstat (limited to 'lparser.h')
-rw-r--r--lparser.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/lparser.h b/lparser.h
index 3d6bd978..3b5d399f 100644
--- a/lparser.h
+++ b/lparser.h
@@ -33,8 +33,8 @@ typedef enum {
33 VKINT, /* integer constant; nval = numerical integer value */ 33 VKINT, /* integer constant; nval = numerical integer value */
34 VNONRELOC, /* expression has its value in a fixed register; 34 VNONRELOC, /* expression has its value in a fixed register;
35 info = result register */ 35 info = result register */
36 VLOCAL, /* local variable; info = local register */ 36 VLOCAL, /* local variable; var.idx = local register */
37 VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */ 37 VUPVAL, /* upvalue variable; var.idx = index of upvalue in 'upvalues' */
38 VINDEXED, /* indexed variable; 38 VINDEXED, /* indexed variable;
39 ind.t = table register; 39 ind.t = table register;
40 ind.idx = key's R index */ 40 ind.idx = key's R index */
@@ -58,7 +58,7 @@ typedef enum {
58 58
59#define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXSTR) 59#define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXSTR)
60#define vkisindexed(k) (VINDEXED <= (k) && (k) <= VINDEXSTR) 60#define vkisindexed(k) (VINDEXED <= (k) && (k) <= VINDEXSTR)
61#define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL) 61
62 62
63typedef struct expdesc { 63typedef struct expdesc {
64 expkind k; 64 expkind k;
@@ -70,15 +70,20 @@ typedef struct expdesc {
70 short idx; /* index (R or "long" K) */ 70 short idx; /* index (R or "long" K) */
71 lu_byte t; /* table (register or upvalue) */ 71 lu_byte t; /* table (register or upvalue) */
72 } ind; 72 } ind;
73 struct { /* for local variables and upvalues */
74 lu_byte idx; /* index of the variable */
75 } var;
73 } u; 76 } u;
74 int t; /* patch list of 'exit when true' */ 77 int t; /* patch list of 'exit when true' */
75 int f; /* patch list of 'exit when false' */ 78 int f; /* patch list of 'exit when false' */
76} expdesc; 79} expdesc;
77 80
78 81
79/* description of active local variable */ 82/* description of an active local variable */
80typedef struct Vardesc { 83typedef struct Vardesc {
84 TString *name;
81 short idx; /* index of the variable in the Proto's 'locvars' array */ 85 short idx; /* index of the variable in the Proto's 'locvars' array */
86 lu_byte ro; /* true if variable is 'const' */
82} Vardesc; 87} Vardesc;
83 88
84 89