MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / capture_aux

Function capture_aux

other_src/lua/src/lpeg.cpp:1693–1713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1691
1692
1693static int capture_aux (lua_State *L, int kind, int labelidx) {
1694 int l1, n;
1695 Instruction *p1 = getpatt(L, 1, &l1);
1696 int lc = skipchecks(p1, 0, &n);
1697 if (lc == l1) { /* got whole pattern? */
1698 /* may use a IFullCapture instruction at its end */
1699 Instruction *p = newpatt(L, l1 + 1);
1700 int label = getlabel(L, labelidx);
1701 p += addpatt(L, p, 1);
1702 setinstcap(p, IFullCapture, label, kind, n);
1703 }
1704 else { /* must use open-close pair */
1705 Instruction *op = newpatt(L, 1 + l1 + 1);
1706 Instruction *p = op;
1707 setinstcap(p++, IOpenCapture, getlabel(L, labelidx), kind, 0);
1708 p += addpatt(L, p, 1);
1709 setinstcap(p, ICloseCapture, 0, Cclose, 0);
1710 optimizecaptures(op);
1711 }
1712 return 1;
1713}
1714
1715
1716static int capture_l (lua_State *L) { return capture_aux(L, Csimple, 0); }

Callers 6

capture_lFunction · 0.85
tcapture_lFunction · 0.85
capsubst_lFunction · 0.85
rcapture_lFunction · 0.85
fold_lFunction · 0.85
group_lFunction · 0.85

Calls 6

getpattFunction · 0.85
skipchecksFunction · 0.85
newpattFunction · 0.85
getlabelFunction · 0.85
addpattFunction · 0.85
optimizecapturesFunction · 0.85

Tested by

no test coverage detected