38 #define hasmultret(k) ((k) == VCALL || (k) == VVARARG) 43 #define eqstr(a,b) ((a) == (b)) 78 const char *where = (line == 0)
122 #define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } 136 "%s expected (to close %s at line %d)",
179 LocVar, SHRT_MAX,
"local variables");
180 while (oldsize < f->sizelocvars)
208 #define new_localvarliteral(ls,v) \ 210 luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char)) - 1)); 269 e->
u.
var.vidx = vidx;
288 varname = vardesc->
vd.
name;
302 "attempt to assign to const variable '%s'",
getstr(varname));
315 for (i = 0; i < nvars; i++) {
318 var->
vd.
sidx = stklevel++;
330 while (fs->
nactvar > tolevel) {
345 for (i = 0; i < fs->
nups; i++) {
346 if (
eqstr(up[i].name, name))
return i;
358 while (oldsize < f->sizeupvalues)
472 int needed = nvars - nexps;
474 int extra = needed + 1;
495 #define enterlevel(ls) luaE_enterCcall((ls)->L) 497 #define leavelevel(ls) luaE_exitCcall((ls)->L) 506 const char *msg =
"<goto %s> at line %d jumps into the scope of local '%s'";
525 for (i = g; i < gl->
n - 1; i++)
526 gl->
arr[i] = gl->
arr[i + 1];
622 for (i = bl->
firstgoto; i < gl->n; i++) {
651 msg =
"break outside loop at line %d";
655 msg =
"no visible label '%s' for <goto> at line %d";
694 int oldsize = f->
sizep;
696 while (oldsize < f->sizep)
697 f->
p[oldsize++] = NULL;
931 if (ls->
t.
token ==
'}')
break;
970 }
while (!isvararg &&
testnext(ls,
','));
1052 nparams = fs->
freereg - (base+1);
1163 "cannot use '...' outside a vararg function");
1227 static const struct {
1235 {6, 6}, {4, 4}, {5, 5},
1238 {3, 3}, {3, 3}, {3, 3},
1239 {3, 3}, {3, 3}, {3, 3},
1243 #define UNARY_PRIORITY 12 1325 for (; lh; lh = lh->
prev) {
1331 lh->
v.
u.
ind.t = extra;
1337 lh->
v.
u.
ind.t = extra;
1343 lh->
v.
u.
ind.idx = extra;
1441 const char *msg =
"label '%s' already defined on line %d";
1466 condexit =
cond(ls);
1488 condexit =
cond(ls);
1522 int offset = dest - (pc + 1);
1578 forbody(ls, base, line, 1, 0);
1606 forbody(ls, base, line, nvars - 4, 1);
1619 case '=':
fornum(ls, varname, line);
break;
1734 if (strcmp(attr,
"const") == 0)
1736 else if (strcmp(attr,
"close") == 0)
1771 luaK_semerror(ls,
"multiple to-be-closed variables in local list");
1772 toclose = fs->
nactvar + nvars;
1783 if (nvars == nexps &&
1802 while (ls->
t.
token ==
'.')
1804 if (ls->
t.
token ==
':') {
1818 body(ls, &b, ismethod, line);
1985 lexstate.
buff = buff;
static void closelistfield(FuncState *fs, ConsControl *cc)
static void test_then_block(LexState *ls, int *escapelist)
#define check_condition(ls, c, msg)
static LocVar * localdebuginfo(FuncState *fs, int vidx)
static void localstat(LexState *ls)
static int searchvar(FuncState *fs, TString *n, expdesc *var)
static void setvararg(FuncState *fs, int nparams)
l_noret luaX_syntaxerror(LexState *ls, const char *msg)
static void enterblock(FuncState *fs, BlockCnt *bl, lu_byte isloop)
void luaK_exp2anyregup(FuncState *fs, expdesc *e)
#define luaK_setmultret(fs, e)
void luaK_reserveregs(FuncState *fs, int n)
static void removevars(FuncState *fs, int tolevel)
static void exp1(LexState *ls)
LClosure * luaF_newLclosure(lua_State *L, int nupvals)
void luaK_indexed(FuncState *fs, expdesc *t, expdesc *k)
static void primaryexp(LexState *ls, expdesc *v)
int luaK_exp2const(FuncState *fs, const expdesc *e, TValue *v)
static int registerlocalvar(LexState *ls, FuncState *fs, TString *varname)
int luaK_exp2anyreg(FuncState *fs, expdesc *e)
static void codename(LexState *ls, expdesc *e)
static void check_readonly(LexState *ls, expdesc *e)
static void exprstat(LexState *ls)
static void close_func(LexState *ls)
static int testnext(LexState *ls, int c)
static void init_exp(expdesc *e, expkind k, int i)
static void check_conflict(LexState *ls, struct LHS_assign *lh, expdesc *v)
LClosure * luaY_parser(lua_State *L, ZIO *z, Mbuffer *buff, Dyndata *dyd, const char *name, int firstchar)
static void checkrepeated(LexState *ls, TString *name)
static int solvegotos(LexState *ls, Labeldesc *lb)
static l_noret jumpscopeerror(LexState *ls, Labeldesc *gt)
static void adjustlocalvars(LexState *ls, int nvars)
static int new_localvar(LexState *ls, TString *name)
static void leaveblock(FuncState *fs)
static void simpleexp(LexState *ls, expdesc *v)
static void body(LexState *ls, expdesc *e, int ismethod, int line)
#define new_localvarliteral(ls, v)
static l_noret undefgoto(LexState *ls, Labeldesc *gt)
AbsLineInfo * abslineinfo
void luaD_inctop(lua_State *L)
static void checklimit(FuncState *fs, int v, int l, const char *what)
static int forprep(lua_State *L, StkId ra)
static int cond(LexState *ls)
void luaK_setoneret(FuncState *fs, expdesc *e)
static void adjust_assign(LexState *ls, int nvars, int nexps, expdesc *e)
int luaK_code(FuncState *fs, Instruction i)
void luaK_self(FuncState *fs, expdesc *e, expdesc *key)
static void singlevaraux(FuncState *fs, TString *n, expdesc *var, int base)
void luaK_setreturns(FuncState *fs, expdesc *e, int nresults)
static void localfunc(LexState *ls)
#define setclLvalue2s(L, o, cl)
static int stacklevel(FuncState *fs, int nvar)
static l_noret errorlimit(FuncState *fs, int limit, const char *what)
static int funcname(LexState *ls, expdesc *v)
static void solvegoto(LexState *ls, int g, Labeldesc *label)
void luaK_goiftrue(FuncState *fs, expdesc *e)
void luaK_storevar(FuncState *fs, expdesc *var, expdesc *ex)
void luaK_infix(FuncState *fs, BinOpr op, expdesc *v)
void luaK_dischargevars(FuncState *fs, expdesc *e)
static int getlocalattribute(LexState *ls)
int luaK_jump(FuncState *fs)
#define luaM_shrinkvector(L, v, size, fs, t)
void luaK_checkstack(FuncState *fs, int n)
void luaK_nil(FuncState *fs, int from, int n)
void luaK_int(FuncState *fs, int reg, lua_Integer i)
#define luaS_newliteral(L, s)
const char * luaX_token2str(LexState *ls, int token)
static void statlist(LexState *ls)
void luaX_next(LexState *ls)
static void fixforjump(FuncState *fs, int pc, int dest, int back)
static void mainfunc(LexState *ls, FuncState *fs)
static void yindex(LexState *ls, expdesc *v)
static void fornum(LexState *ls, TString *varname, int line)
void luaK_finish(FuncState *fs)
void luaK_patchlist(FuncState *fs, int list, int target)
static void fieldsel(LexState *ls, expdesc *v)
#define LFIELDS_PER_FLUSH
static int explist(LexState *ls, expdesc *v)
static int newupvalue(FuncState *fs, TString *name, expdesc *v)
static BinOpr getbinopr(int op)
l_noret luaK_semerror(LexState *ls, const char *msg)
static TString * str_checkname(LexState *ls)
static void labelstat(LexState *ls, TString *name, int line)
static void block(LexState *ls)
static void breakstat(LexState *ls)
static void forstat(LexState *ls, int line)
static void recfield(LexState *ls, ConsControl *cc)
static Proto * addprototype(LexState *ls)
static void open_func(LexState *ls, FuncState *fs, BlockCnt *bl)
static UnOpr getunopr(int op)
struct expdesc::@25::@27 var
Table * luaH_new(lua_State *L)
int luaK_codeABx(FuncState *fs, OpCode o, int a, unsigned int bc)
static void funcstat(LexState *ls, int line)
static void forlist(LexState *ls, TString *indexname)
static void constructor(LexState *ls, expdesc *t)
static void parlist(LexState *ls)
static void checktoclose(LexState *ls, int level)
static void codestring(expdesc *e, TString *s)
void luaK_prefix(FuncState *fs, UnOpr op, expdesc *e, int line)
static Vardesc * getlocalvardesc(FuncState *fs, int vidx)
static void movegotosout(FuncState *fs, BlockCnt *bl)
static void field(LexState *ls, ConsControl *cc)
static void gotostat(LexState *ls)
static void check(LexState *ls, int c)
static l_noret error_expected(LexState *ls, int token)
void luaK_ret(FuncState *fs, int first, int nret)
static int newlabelentry(LexState *ls, Labellist *l, TString *name, int line, int pc)
static void retstat(LexState *ls)
struct ConsControl ConsControl
int luaX_lookahead(LexState *ls)
TString * luaS_new(lua_State *L, const char *str)
struct expdesc::@25::@26 ind
static void whilestat(LexState *ls, int line)
void luaK_goiffalse(FuncState *fs, expdesc *e)
static void markupval(FuncState *fs, int level)
int luaK_getlabel(FuncState *fs)
void luaK_exp2val(FuncState *fs, expdesc *e)
struct Dyndata::@29 actvar
void luaK_fixline(FuncState *fs, int line)
static void listfield(LexState *ls, ConsControl *cc)
#define getinstruction(fs, e)
#define luaK_jumpto(fs, t)
static void repeatstat(LexState *ls, int line)
static void check_match(LexState *ls, int what, int who, int where)
#define luaK_codeABC(fs, o, a, b, c)
static BinOpr subexpr(LexState *ls, expdesc *v, int limit)
static void forbody(LexState *ls, int base, int line, int nvars, int isgen)
void luaK_settablesize(FuncState *fs, int pc, int ra, int asize, int hsize)
void luaX_setinput(lua_State *L, LexState *ls, ZIO *z, TString *source, int firstchar)
static Labeldesc * findlabel(LexState *ls, TString *name)
static void statement(LexState *ls)
#define sethvalue2s(L, o, h)
static void suffixedexp(LexState *ls, expdesc *v)
static void init_var(FuncState *fs, expdesc *e, int vidx)
struct BlockCnt * previous
static int newgotoentry(LexState *ls, TString *name, int line, int pc)
static void ifstat(LexState *ls, int line)
static void expr(LexState *ls, expdesc *v)
const char * luaO_pushfstring(lua_State *L, const char *fmt,...)
static void codeclosure(LexState *ls, expdesc *v)
void luaK_exp2nextreg(FuncState *fs, expdesc *e)
static const struct @24 priority[]
static void restassign(LexState *ls, struct LHS_assign *lh, int nvars)
static void singlevar(LexState *ls, expdesc *var)
static int issinglejump(LexState *ls, TString **label, int *target)
#define luaC_objbarrier(L, p, o)
static void checknext(LexState *ls, int c)
void luaK_patchtohere(FuncState *fs, int list)
static void lastlistfield(FuncState *fs, ConsControl *cc)
Proto * luaF_newproto(lua_State *L)
#define luaM_growvector(L, v, nelems, size, t, limit, e)
void luaK_setlist(FuncState *fs, int base, int nelems, int tostore)
void luaK_posfix(FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2, int line)
static Upvaldesc * allocupvalue(FuncState *fs)
int luaY_nvarstack(FuncState *fs)
static int block_follow(LexState *ls, int withuntil)
static int searchupvalue(FuncState *fs, TString *name)
static int createlabel(LexState *ls, TString *name, int line, int last)
static void funcargs(LexState *ls, expdesc *f, int line)
void luaK_concat(FuncState *fs, int *l1, int l2)