Update libregexp with recent bug fixes from Plan 9.
This commit is contained in:
parent
4da83e7cce
commit
62390091b7
12 changed files with 111 additions and 81 deletions
|
|
@ -45,7 +45,7 @@ rregexec1(Reprog *progp, /* program to run */
|
|||
switch(j->starttype) {
|
||||
case RUNE:
|
||||
while(*s != j->startchar) {
|
||||
if(*s == 0)
|
||||
if(*s == 0 || s == j->reol)
|
||||
return match;
|
||||
s++;
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ rregexec1(Reprog *progp, /* program to run */
|
|||
if(s == bol)
|
||||
break;
|
||||
while(*s != '\n') {
|
||||
if(*s == 0)
|
||||
if(*s == 0 || s == j->reol)
|
||||
return match;
|
||||
s++;
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ rregexec1(Reprog *progp, /* program to run */
|
|||
nl->inst = 0;
|
||||
|
||||
/* Add first instruction to current list */
|
||||
_rrenewemptythread(tl, progp->startinst, s);
|
||||
_rrenewemptythread(tl, progp->startinst, ms, s);
|
||||
|
||||
/* Execute machine until current list is empty */
|
||||
for(tlp=tl; tlp->inst; tlp++){
|
||||
|
|
@ -80,7 +80,7 @@ rregexec1(Reprog *progp, /* program to run */
|
|||
switch(inst->type){
|
||||
case RUNE: /* regular character */
|
||||
if(inst->u1.r == r)
|
||||
if(_renewthread(nl, inst->u2.next, &tlp->se)==nle)
|
||||
if(_renewthread(nl, inst->u2.next, ms, &tlp->se)==nle)
|
||||
return -1;
|
||||
break;
|
||||
case LBRA:
|
||||
|
|
@ -91,11 +91,11 @@ rregexec1(Reprog *progp, /* program to run */
|
|||
continue;
|
||||
case ANY:
|
||||
if(r != '\n')
|
||||
if(_renewthread(nl, inst->u2.next, &tlp->se)==nle)
|
||||
if(_renewthread(nl, inst->u2.next, ms, &tlp->se)==nle)
|
||||
return -1;
|
||||
break;
|
||||
case ANYNL:
|
||||
if(_renewthread(nl, inst->u2.next, &tlp->se)==nle)
|
||||
if(_renewthread(nl, inst->u2.next, ms, &tlp->se)==nle)
|
||||
return -1;
|
||||
break;
|
||||
case BOL:
|
||||
|
|
@ -110,7 +110,7 @@ rregexec1(Reprog *progp, /* program to run */
|
|||
ep = inst->u1.cp->end;
|
||||
for(rp = inst->u1.cp->spans; rp < ep; rp += 2)
|
||||
if(r >= rp[0] && r <= rp[1]){
|
||||
if(_renewthread(nl, inst->u2.next, &tlp->se)==nle)
|
||||
if(_renewthread(nl, inst->u2.next, ms, &tlp->se)==nle)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
|
@ -121,12 +121,12 @@ rregexec1(Reprog *progp, /* program to run */
|
|||
if(r >= rp[0] && r <= rp[1])
|
||||
break;
|
||||
if(rp == ep)
|
||||
if(_renewthread(nl, inst->u2.next, &tlp->se)==nle)
|
||||
if(_renewthread(nl, inst->u2.next, ms, &tlp->se)==nle)
|
||||
return -1;
|
||||
break;
|
||||
case OR:
|
||||
/* evaluate right choice later */
|
||||
if(_renewthread(tlp, inst->u1.right, &tlp->se) == tle)
|
||||
if(_renewthread(tlp, inst->u1.right, ms, &tlp->se) == tle)
|
||||
return -1;
|
||||
/* efficiency: advance and re-evaluate */
|
||||
continue;
|
||||
|
|
@ -190,7 +190,7 @@ rregexec(Reprog *progp, /* program to run */
|
|||
}
|
||||
j.starttype = 0;
|
||||
j.startchar = 0;
|
||||
if(progp->startinst->type == RUNE && progp->startinst->u1.r < (Rune)Runeself) {
|
||||
if(progp->startinst->type == RUNE && progp->startinst->u1.r < Runeself) {
|
||||
j.starttype = RUNE;
|
||||
j.startchar = progp->startinst->u1.r;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue