| 638 | |
| 639 | |
| 640 | static void f_parser (lua_State *L, void *ud) { |
| 641 | int i; |
| 642 | Closure *cl; |
| 643 | struct SParser *p = cast(struct SParser *, ud); |
| 644 | int c = zgetc(p->z); /* read first character */ |
| 645 | if (c == LUA_SIGNATURE[0]) { |
| 646 | checkmode(L, p->mode, "binary"); |
| 647 | cl = luaU_undump(L, p->z, &p->buff, p->name); |
| 648 | } |
| 649 | else { |
| 650 | checkmode(L, p->mode, "text"); |
| 651 | cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c); |
| 652 | } |
| 653 | lua_assert(cl->l.nupvalues == cl->l.p->sizeupvalues); |
| 654 | for (i = 0; i < cl->l.nupvalues; i++) { /* initialize upvalues */ |
| 655 | UpVal *up = luaF_newupval(L); |
| 656 | cl->l.upvals[i] = up; |
| 657 | luaC_objbarrier(L, cl, up); |
| 658 | } |
| 659 | } |
| 660 | |
| 661 | |
| 662 | int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, |
nothing calls this directly
no test coverage detected