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

Function checkrule

other_src/lua/src/lpeg.cpp:785–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783
784
785static void checkrule (lua_State *L, Instruction *op, int from, int to,
786 int postable, int rule) {
787 int i;
788 int lastopen = 0; /* more recent OpenCall seen in the code */
789 for (i = from; i < to; i += sizei(op + i)) {
790 if (op[i].i.code == IPartialCommit && op[i].i.offset < 0) { /* loop? */
791 int start = dest(op, i);
792 assert(op[start - 1].i.code == IChoice &&
793 dest(op, start - 1) == target(op, i + 1));
794 if (start <= lastopen) { /* loop does contain an open call? */
795 if (!verify(L, op, op + start, op + i, postable, rule)) /* check body */
796 luaL_error(L, "possible infinite loop in %s", val2str(L, rule));
797 }
798 }
799 else if (op[i].i.code == IOpenCall)
800 lastopen = i;
801 }
802 assert(op[i - 1].i.code == IRet);
803 verify(L, op, op + from, op + to - 1, postable, rule);
804}
805
806
807

Callers 1

fix_lFunction · 0.85

Calls 5

sizeiFunction · 0.85
targetFunction · 0.85
verifyFunction · 0.85
val2strFunction · 0.85
luaL_errorFunction · 0.70

Tested by

no test coverage detected