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

Function luaY_parser

third-party/lua-5.4.6/src/lparser.c:1941–1965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1939
1940
1941LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
1942 Dyndata *dyd, const char *name, int firstchar) {
1943 LexState lexstate;
1944 FuncState funcstate;
1945 LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */
1946 setclLvalue2s(L, L->top.p, cl); /* anchor it (to avoid being collected) */
1947 luaD_inctop(L);
1948 lexstate.h = luaH_new(L); /* create table for scanner */
1949 sethvalue2s(L, L->top.p, lexstate.h); /* anchor it */
1950 luaD_inctop(L);
1951 funcstate.f = cl->p = luaF_newproto(L);
1952 luaC_objbarrier(L, cl, cl->p);
1953 funcstate.f->source = luaS_new(L, name); /* create and anchor TString */
1954 luaC_objbarrier(L, funcstate.f, funcstate.f->source);
1955 lexstate.buff = buff;
1956 lexstate.dyd = dyd;
1957 dyd->actvar.n = dyd->gt.n = dyd->label.n = 0;
1958 luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar);
1959 mainfunc(&lexstate, &funcstate);
1960 lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs);
1961 /* all scopes should be correctly finished */
1962 lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0);
1963 L->top.p--; /* remove scanner's table */
1964 return cl; /* closure is on the stack, too */
1965}
1966

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