]> granicus.if.org Git - python/commitdiff
Small bugfixes for broken old style use of the syntax table. AMK, of
authorGuido van Rossum <guido@python.org>
Tue, 2 Dec 1997 20:39:23 +0000 (20:39 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 2 Dec 1997 20:39:23 +0000 (20:39 +0000)
course.

Modules/regexpr.c

index 7cdcbd98d9aa1172af9d17b5da50f5b22cf75e66..64e199d9bef6722acf2f318d688df3cc0de25962 100644 (file)
@@ -611,7 +611,7 @@ static void re_compile_fastmap_aux(code,
                {
                        syntaxcode = code[pos++];
                        for (a = 0; a < 256; a++)
-                               if (SYNTAX(a) == syntaxcode)
+                               if (SYNTAX(a) & syntaxcode) 
                                        fastmap[a] = 1;
                        return;
                }
@@ -619,7 +619,7 @@ static void re_compile_fastmap_aux(code,
                {
                        syntaxcode = code[pos++];
                        for (a = 0; a < 256; a++)
-                               if (SYNTAX(a) != syntaxcode)
+                               if (!(SYNTAX(a) & syntaxcode) )
                                        fastmap[a] = 1;
                        return;
                }
@@ -1866,12 +1866,12 @@ int re_match(bufp,
                        if (translate)
                        {
                                while (text < textend &&
-                                      translate[SYNTAX(*text)] == a)
+                                      (SYNTAX(translate[*text]) & a) )
                                        text++;
                        }
                        else
                        {
-                               while (text < textend && SYNTAX(*text) == a)
+                               while (text < textend && (SYNTAX(*text) & a) )
                                        text++;
                        }
                        break;
@@ -1882,12 +1882,12 @@ int re_match(bufp,
                        if (translate)
                        {
                                while (text < textend &&
-                                      translate[SYNTAX(*text)] != a)
+                                      !(SYNTAX(translate[*text]) & a) )
                                        text++;
                        }
                        else
                        {
-                               while (text < textend && SYNTAX(*text) != a)
+                               while (text < textend && !(SYNTAX(*text) & a) )
                                        text++;
                        }
                        break;