Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/quiz fix regular expression matcher.



details:   https://anonhg.NetBSD.org/src/rev/a0d046db308a
branches:  trunk
changeset: 534896:a0d046db308a
user:      dbj <dbj%NetBSD.org@localhost>
date:      Tue Aug 06 03:39:44 2002 +0000

description:
fix regular expression matcher.
the string "xc" was failing to match "x[[a|b]|c]"

diffstat:

 games/quiz/rxp.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (49 lines):

diff -r 2f0a74047e91 -r a0d046db308a games/quiz/rxp.c
--- a/games/quiz/rxp.c  Tue Aug 06 01:16:56 2002 +0000
+++ b/games/quiz/rxp.c  Tue Aug 06 03:39:44 2002 +0000
@@ -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 @@
                        if (ch != *sp++) {
                                rp = j_fail;
                                sp = sp_fail;
-                               return (TRUE);
+                               return (FALSE);
                        }
                        rp++;
                        break;
@@ -247,16 +247,17 @@
                        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:
+                       rp = j_fail;
+                       sp = sp_fail;
+                       return (FALSE);
                default:
-                       return (FALSE);
+                       abort();
                }
        return (*rp != END ? FALSE : TRUE);
 }



Home | Main Index | Thread Index | Old Index