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

Function luaY_parser

third-party/lua-5.3.5/src/lparser.c:1626–1649  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1624
1625
1626LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
1627 Dyndata *dyd, const char *name, int firstchar) {
1628 LexState lexstate;
1629 FuncState funcstate;
1630 LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */
1631 setclLvalue(L, L->top, cl); /* anchor it (to avoid being collected) */
1632 luaD_inctop(L);
1633 lexstate.h = luaH_new(L); /* create table for scanner */
1634 sethvalue(L, L->top, lexstate.h); /* anchor it */
1635 luaD_inctop(L);
1636 funcstate.f = cl->p = luaF_newproto(L);
1637 funcstate.f->source = luaS_new(L, name); /* create and anchor TString */
1638 lua_assert(iswhite(funcstate.f)); /* do not need barrier here */
1639 lexstate.buff = buff;
1640 lexstate.dyd = dyd;
1641 dyd->actvar.n = dyd->gt.n = dyd->label.n = 0;
1642 luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar);
1643 mainfunc(&lexstate, &funcstate);
1644 lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs);
1645 /* all scopes should be correctly finished */
1646 lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0);
1647 L->top--; /* remove scanner's table */
1648 return cl; /* closure is on the stack, too */
1649}
1650

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