diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-05 16:24:59 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-05 16:24:59 -0300 |
| commit | be8120906304a8658fab998587b969e0e42f5650 (patch) | |
| tree | 81cf2d38522b10468d09763fc25d261486008197 /lparser.h | |
| parent | e05590591410a5e007a1e3f1691f6c1cf9d8fe45 (diff) | |
| download | lua-be8120906304a8658fab998587b969e0e42f5650.tar.gz lua-be8120906304a8658fab998587b969e0e42f5650.tar.bz2 lua-be8120906304a8658fab998587b969e0e42f5650.zip | |
First implementation of global declarations
Diffstat (limited to 'lparser.h')
| -rw-r--r-- | lparser.h | 15 |
1 files changed, 12 insertions, 3 deletions
| @@ -37,6 +37,9 @@ typedef enum { | |||
| 37 | info = result register */ | 37 | info = result register */ |
| 38 | VLOCAL, /* local variable; var.ridx = register index; | 38 | VLOCAL, /* local variable; var.ridx = register index; |
| 39 | var.vidx = relative index in 'actvar.arr' */ | 39 | var.vidx = relative index in 'actvar.arr' */ |
| 40 | VGLOBAL, /* global variable; | ||
| 41 | info = relative index in 'actvar.arr' (or -1 for | ||
| 42 | implicit declaration) */ | ||
| 40 | VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */ | 43 | VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */ |
| 41 | VCONST, /* compile-time <const> variable; | 44 | VCONST, /* compile-time <const> variable; |
| 42 | info = absolute index in 'actvar.arr' */ | 45 | info = absolute index in 'actvar.arr' */ |
| @@ -87,10 +90,16 @@ typedef struct expdesc { | |||
| 87 | 90 | ||
| 88 | 91 | ||
| 89 | /* kinds of variables */ | 92 | /* kinds of variables */ |
| 90 | #define VDKREG 0 /* regular */ | 93 | #define VDKREG 0 /* regular local */ |
| 91 | #define RDKCONST 1 /* constant */ | 94 | #define RDKCONST 1 /* local constant */ |
| 92 | #define RDKTOCLOSE 2 /* to-be-closed */ | 95 | #define RDKTOCLOSE 2 /* to-be-closed */ |
| 93 | #define RDKCTC 3 /* compile-time constant */ | 96 | #define RDKCTC 3 /* local compile-time constant */ |
| 97 | #define GDKREG 4 /* regular global */ | ||
| 98 | #define GDKCONST 5 /* global constant */ | ||
| 99 | |||
| 100 | /* variables that live in registers */ | ||
| 101 | #define varinreg(v) ((v)->vd.kind <= RDKTOCLOSE) | ||
| 102 | |||
| 94 | 103 | ||
| 95 | /* description of an active local variable */ | 104 | /* description of an active local variable */ |
| 96 | typedef union Vardesc { | 105 | typedef union Vardesc { |
