improve matched condition
This commit is contained in:
20
pike.c
20
pike.c
@@ -482,6 +482,17 @@ else if (spc == JMP) { \
|
||||
goto rec##nn; \
|
||||
} \
|
||||
|
||||
#define clistmatch()
|
||||
#define nlistmatch() \
|
||||
if (*npc == MATCH) \
|
||||
for (i++; i < clistidx; i++) { \
|
||||
npc = clist[i].pc; \
|
||||
nsub = clist[i].sub; \
|
||||
if (*npc == MATCH) \
|
||||
goto matched; \
|
||||
decref(nsub) \
|
||||
} \
|
||||
|
||||
#define addthread(nn, list, listidx) \
|
||||
si = 0; \
|
||||
rec##nn: \
|
||||
@@ -495,6 +506,7 @@ if ((unsigned int)spc < WBEG) { \
|
||||
nsub = subs[si]; \
|
||||
goto rec##nn; \
|
||||
} \
|
||||
list##match() \
|
||||
continue; \
|
||||
} \
|
||||
next##nn: \
|
||||
@@ -556,9 +568,8 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
|
||||
rsub *subs[prog->splits];
|
||||
char nsubs[rsubsize * (prog->len-prog->splits+14)];
|
||||
rsub *nsub, *s1, *matched = NULL, *freesub = NULL;
|
||||
rthread _clist[prog->len+1], _nlist[prog->len+1];
|
||||
_clist[0].pc = insts, _nlist[0].pc = insts;
|
||||
rthread *clist = _clist+1, *nlist = _nlist+1, *tmp;
|
||||
rthread _clist[prog->len], _nlist[prog->len];
|
||||
rthread *clist = _clist, *nlist = _nlist, *tmp;
|
||||
goto jmp_start;
|
||||
for (;; sp = _sp) {
|
||||
uc_len(i, sp) uc_code(c, sp)
|
||||
@@ -577,6 +588,7 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
|
||||
deccont()
|
||||
npc += *(npc+2) * 2 + 3;
|
||||
} else if (spc == MATCH) {
|
||||
matched:
|
||||
nlist[nlistidx++].pc = &mcont;
|
||||
if (npc != &mcont) {
|
||||
if (matched) {
|
||||
@@ -596,8 +608,6 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
|
||||
goto _continue;
|
||||
} else
|
||||
npc++;
|
||||
if (*nlist[nlistidx-1].pc == MATCH)
|
||||
deccont()
|
||||
addthread(2, nlist, nlistidx)
|
||||
}
|
||||
if (sp == _sp)
|
||||
|
||||
Reference in New Issue
Block a user