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

Function printinst

other_src/lua/src/lpeg.cpp:287–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285
286
287static void printinst (const Instruction *op, const Instruction *p) {
288 const char *const names[] = {
289 "any", "char", "set", "span", "back",
290 "ret", "end",
291 "choice", "jmp", "call", "open_call",
292 "commit", "partial_commit", "back_commit", "failtwice", "fail", "giveup",
293 "func",
294 "fullcapture", "emptycapture", "emptycaptureidx", "opencapture",
295 "closecapture", "closeruntime"
296 };
297 printf("%02ld: %s ", (long)(p - op), names[p->i.code]);
298 switch ((Opcode)p->i.code) {
299 case IChar: {
300 printf("'%c'", p->i.aux);
301 printjmp(op, p);
302 break;
303 }
304 case IAny: {
305 printf("* %d", p->i.aux);
306 printjmp(op, p);
307 break;
308 }
309 case IFullCapture: case IOpenCapture:
310 case IEmptyCapture: case IEmptyCaptureIdx:
311 case ICloseCapture: case ICloseRunTime: {
312 printcapkind(getkind(p));
313 printf("(n = %d) (off = %d)", getoff(p), p->i.offset);
314 break;
315 }
316 case ISet: {
317 printcharset((p+1)->buff);
318 printjmp(op, p);
319 break;
320 }
321 case ISpan: {
322 printcharset((p+1)->buff);
323 break;
324 }
325 case IOpenCall: {
326 printf("-> %d", p->i.offset);
327 break;
328 }
329 case IChoice: {
330 printjmp(op, p);
331 printf(" (%d)", p->i.aux);
332 break;
333 }
334 case IJmp: case ICall: case ICommit:
335 case IPartialCommit: case IBackCommit: {
336 printjmp(op, p);
337 break;
338 }
339 default: break;
340 }
341 printf("\n");
342}
343
344

Callers 2

printpattFunction · 0.85
matchFunction · 0.85

Calls 3

printjmpFunction · 0.85
printcapkindFunction · 0.85
printcharsetFunction · 0.85

Tested by

no test coverage detected