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

Function basicUnion

other_src/lua/src/lpeg.cpp:1507–1535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1505
1506
1507static Instruction *basicUnion (lua_State *L, Instruction *p1, int l1,
1508 int l2, int *size, CharsetTag *st2) {
1509 Instruction *op;
1510 CharsetTag st1;
1511 tocharset(p1, &st1);
1512 if (st1.tag == ISCHARSET && st2->tag == ISCHARSET) {
1513 Instruction *p = auxnew(L, &op, size, CHARSETINSTSIZE);
1514 setinst(p, ISet, 0);
1515 loopset(i, p[1].buff[i] = st1.cs[i] | st2->cs[i]);
1516 }
1517 else if (exclusive(&st1, st2) || isheadfail(p1)) {
1518 Instruction *p = auxnew(L, &op, size, l1 + 1 + l2);
1519 copypatt(p, p1, l1);
1520 check2test(p, l1 + 1);
1521 p += l1;
1522 setinst(p++, IJmp, l2 + 1);
1523 addpatt(L, p, 2);
1524 }
1525 else {
1526 /* choice L1; e1; commit L2; L1: e2; L2: ... */
1527 Instruction *p = auxnew(L, &op, size, 1 + l1 + 1 + l2);
1528 setinst(p++, IChoice, 1 + l1 + 1);
1529 copypatt(p, p1, l1); p += l1;
1530 setinst(p++, ICommit, 1 + l2);
1531 addpatt(L, p, 2);
1532 optimizechoice(p - (1 + l1 + 1));
1533 }
1534 return op;
1535}
1536
1537
1538static Instruction *separateparts (lua_State *L, Instruction *p1, int l1,

Callers 1

separatepartsFunction · 0.85

Calls 7

tocharsetFunction · 0.85
auxnewFunction · 0.85
exclusiveFunction · 0.85
isheadfailFunction · 0.85
check2testFunction · 0.85
addpattFunction · 0.85
optimizechoiceFunction · 0.85

Tested by

no test coverage detected