MCPcopy Create free account
hub / github.com/Tencent/sluaunreal / luaY_parser

Function luaY_parser

Plugins/slua_unreal/External/lua/lparser.cpp:1624–1647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

f_parserFunction · 0.85

Calls 7

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

Tested by

no test coverage detected