fix regular expression matcher.
the string "xc" was failing to match "x[[a|b]|c]"
This commit is contained in:
parent
1cbfe6af00
commit
a7d4c58694
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rxp.c,v 1.7 1999/09/08 21:17:56 jsm Exp $ */
|
||||
/* $NetBSD: rxp.c,v 1.8 2002/08/06 03:39:44 dbj Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)rxp.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: rxp.c,v 1.7 1999/09/08 21:17:56 jsm Exp $");
|
||||
__RCSID("$NetBSD: rxp.c,v 1.8 2002/08/06 03:39:44 dbj Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -227,7 +227,7 @@ rxp__match(s, first, j_succ, j_fail, sp_fail)
|
|||
if (ch != *sp++) {
|
||||
rp = j_fail;
|
||||
sp = sp_fail;
|
||||
return (TRUE);
|
||||
return (FALSE);
|
||||
}
|
||||
rp++;
|
||||
break;
|
||||
|
@ -247,16 +247,17 @@ rxp__match(s, first, j_succ, j_fail, sp_fail)
|
|||
break;
|
||||
case ALT_S:
|
||||
rp++;
|
||||
if ((err = rxp__match(sp,
|
||||
FALSE, grp_end, rxpbuf + *rp++, sp)) != TRUE)
|
||||
return (err);
|
||||
rxp__match(sp, FALSE, grp_end, rxpbuf + *rp++, sp);
|
||||
break;
|
||||
case ALT_E:
|
||||
rp = j_succ;
|
||||
return (TRUE);
|
||||
case GRP_E:
|
||||
default:
|
||||
rp = j_fail;
|
||||
sp = sp_fail;
|
||||
return (FALSE);
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
return (*rp != END ? FALSE : TRUE);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue