Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef lparser_h
00008 #define lparser_h
00009
00010 #include "llimits.h"
00011 #include "lobject.h"
00012 #include "lzio.h"
00013
00014
00015
00016
00017
00018
00019 typedef enum {
00020 VVOID,
00021 VNIL,
00022 VTRUE,
00023 VFALSE,
00024 VK,
00025 VKNUM,
00026 VNONRELOC,
00027 VLOCAL,
00028 VUPVAL,
00029 VINDEXED,
00030 VJMP,
00031 VRELOCABLE,
00032 VCALL,
00033 VVARARG
00034 } expkind;
00035
00036
00037 #define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED)
00038 #define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL)
00039
00040 typedef struct expdesc {
00041 expkind k;
00042 union {
00043 struct {
00044 short idx;
00045 lu_byte t;
00046 lu_byte vt;
00047 } ind;
00048 int info;
00049 lua_Number nval;
00050 } u;
00051 int t;
00052 int f;
00053 } expdesc;
00054
00055
00056
00057 typedef struct Vardesc {
00058 short idx;
00059 } Vardesc;
00060
00061
00062
00063 typedef struct Labeldesc {
00064 TString *name;
00065 int pc;
00066 int line;
00067 lu_byte nactvar;
00068 } Labeldesc;
00069
00070
00071
00072 typedef struct Labellist {
00073 Labeldesc *arr;
00074 int n;
00075 int size;
00076 } Labellist;
00077
00078
00079
00080 typedef struct Dyndata {
00081 struct {
00082 Vardesc *arr;
00083 int n;
00084 int size;
00085 } actvar;
00086 Labellist gt;
00087 Labellist label;
00088 } Dyndata;
00089
00090
00091
00092 struct BlockCnt;
00093
00094
00095
00096 typedef struct FuncState {
00097 Proto *f;
00098 Table *h;
00099 struct FuncState *prev;
00100 struct LexState *ls;
00101 struct BlockCnt *bl;
00102 int pc;
00103 int lasttarget;
00104 int jpc;
00105 int nk;
00106 int np;
00107 int firstlocal;
00108 short nlocvars;
00109 lu_byte nactvar;
00110 lu_byte nups;
00111 lu_byte freereg;
00112 } FuncState;
00113
00114
00115 LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
00116 Dyndata *dyd, const char *name, int firstchar);
00117
00118
00119 #endif