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

Function diff_l

other_src/lua/src/lpeg.cpp:1354–1381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1352
1353
1354static int diff_l (lua_State *L) {
1355 int l1, l2;
1356 Instruction *p1 = getpatt(L, 1, &l1);
1357 Instruction *p2 = getpatt(L, 2, &l2);
1358 CharsetTag st1, st2;
1359 if (tocharset(p1, &st1) == ISCHARSET && tocharset(p2, &st2) == ISCHARSET) {
1360 Instruction *p = newcharset(L);
1361 loopset(i, p[1].buff[i] = st1.cs[i] & ~st2.cs[i]);
1362 }
1363 else if (isheadfail(p2)) {
1364 Instruction *p = newpatt(L, l2 + 1 + l1);
1365 p += addpatt(L, p, 2);
1366 check2test(p - l2, l2 + 1);
1367 setinst(p++, IFail, 0);
1368 addpatt(L, p, 1);
1369 }
1370 else { /* !e2 . e1 */
1371 /* !e -> choice L1; e; failtwice; L1: ... */
1372 Instruction *p = newpatt(L, 1 + l2 + 1 + l1);
1373 Instruction *pi = p;
1374 setinst(p++, IChoice, 1 + l2 + 1);
1375 p += addpatt(L, p, 2);
1376 setinst(p++, IFailTwice, 0);
1377 addpatt(L, p, 1);
1378 optimizechoice(pi);
1379 }
1380 return 1;
1381}
1382
1383
1384static int unm_l (lua_State *L) {

Callers 1

unm_lFunction · 0.85

Calls 8

getpattFunction · 0.85
tocharsetFunction · 0.85
newcharsetFunction · 0.85
isheadfailFunction · 0.85
newpattFunction · 0.85
addpattFunction · 0.85
check2testFunction · 0.85
optimizechoiceFunction · 0.85

Tested by

no test coverage detected