MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaY_parser

Function luaY_parser

third-party/lua-5.5.0/src/lparser.c:2168–2192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2166
2167
2168LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
2169 Dyndata *dyd, const char *name, int firstchar) {
2170 LexState lexstate;
2171 FuncState funcstate;
2172 LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */
2173 setclLvalue2s(L, L->top.p, cl); /* anchor it (to avoid being collected) */
2174 luaD_inctop(L);
2175 lexstate.h = luaH_new(L); /* create table for scanner */
2176 sethvalue2s(L, L->top.p, lexstate.h); /* anchor it */
2177 luaD_inctop(L);
2178 funcstate.f = cl->p = luaF_newproto(L);
2179 luaC_objbarrier(L, cl, cl->p);
2180 funcstate.f->source = luaS_new(L, name); /* create and anchor TString */
2181 luaC_objbarrier(L, funcstate.f, funcstate.f->source);
2182 lexstate.buff = buff;
2183 lexstate.dyd = dyd;
2184 dyd->actvar.n = dyd->gt.n = dyd->label.n = 0;
2185 luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar);
2186 mainfunc(&lexstate, &funcstate);
2187 lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs);
2188 /* all scopes should be correctly finished */
2189 lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0);
2190 L->top.p--; /* remove scanner's table */
2191 return cl; /* closure is on the stack, too */
2192}
2193

Callers 1

f_parserFunction · 0.70

Calls 7

luaF_newLclosureFunction · 0.70
luaD_inctopFunction · 0.70
luaH_newFunction · 0.70
luaF_newprotoFunction · 0.70
luaS_newFunction · 0.70
luaX_setinputFunction · 0.70
mainfuncFunction · 0.70

Tested by

no test coverage detected