diff --git a/pike.c b/pike.c index e78dfa1..49a0e38 100644 --- a/pike.c +++ b/pike.c @@ -487,6 +487,39 @@ memcpy(s1->sub, nsub->sub, osubp / 2);) \ newsub(/*nop*/, /*nop*/) \ memcpy(s1->sub, nsub->sub, osubp); \ +#define instclist(nn) \ +case WBEG: \ + if (((sp != s || sp != _sp) && isword(sp)) \ + || !isword(_sp)) \ + deccheck(nn) \ + npc++; goto rec##nn; \ +case BOL: \ + if (_sp != s) { \ + if (!i && !clistidx) \ + return 0; \ + deccheck(nn) \ + } \ + npc++; goto rec##nn; \ + +#define instnlist(nn) \ +case JMP: \ + npc += 2 + npc[1]; \ + goto rec##nn; \ +case RSPLIT: \ + onnlist(nn) \ + npc += 2; \ + pcs[i] = npc; \ + npc += npc[-1]; \ + fastrec(nn, nlist, nlistidx) \ +case WEND: \ + if (isword(_sp)) \ + deccheck(nn) \ + npc++; goto rec##nn; \ +case EOL: \ + if (*_sp) \ + deccheck(nn) \ + npc++; goto rec##nn; \ + #define addthread(nn, list, listidx) \ { \ int i = 0; \ @@ -504,20 +537,11 @@ memcpy(s1->sub, nsub->sub, osubp); \ } \ next##nn: \ switch(*npc) { \ - case JMP: \ - npc += 2 + npc[1]; \ - goto rec##nn; \ case SPLIT: \ on##list(nn) \ npc += 2; \ pcs[i] = npc + npc[-1]; \ fastrec(nn, list, listidx) \ - case RSPLIT: \ - on##list(nn) \ - npc += 2; \ - pcs[i] = npc; \ - npc += npc[-1]; \ - fastrec(nn, list, listidx) \ case SAVE: \ if (nsub->ref > 1) { \ nsub->ref--; \ @@ -528,27 +552,9 @@ memcpy(s1->sub, nsub->sub, osubp); \ nsub->sub[npc[1]] = _sp; \ npc += 2; \ goto rec##nn; \ - case WBEG: \ - if (((sp != s || sp != _sp) && isword(sp)) \ - || !isword(_sp)) \ - deccheck(nn) \ - npc++; goto rec##nn; \ - case WEND: \ - if (isword(_sp)) \ - deccheck(nn) \ - npc++; goto rec##nn; \ - case BOL: \ - if (_sp != s) { \ - if (!i && !listidx) \ - return 0; \ - deccheck(nn) \ - } \ - npc++; goto rec##nn; \ - case EOL: \ - if (*_sp) \ - deccheck(nn) \ - npc++; goto rec##nn; \ + inst##list(nn) \ } \ + deccheck(nn) \ } \ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)