emacs-diffs
[Top][All Lists]
Advanced

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

master 82bba6713fc: regex-emacs.c (forall_firstchar): Fix regression bug


From: Stefan Monnier
Subject: master 82bba6713fc: regex-emacs.c (forall_firstchar): Fix regression bug#67226
Date: Sat, 25 Nov 2023 11:03:18 -0500 (EST)

branch: master
commit 82bba6713fc9d5c7cc24c182236df4f16545e941
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    regex-emacs.c (forall_firstchar): Fix regression bug#67226
    
    All zero-width operations need to be taken into account when reaching
    `succeed` in `mutually_exclusive_one`!
    
    * src/regex-emacs.c (forall_firstchar_1): Call `f` for all zero-width
    matching operators.
    (analyze_first_fastmap, analyze_first_null, mutually_exclusive_one):
    Adjust accordingly.
---
 src/regex-emacs.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/regex-emacs.c b/src/regex-emacs.c
index 95c3366652d..cb4fbd58faa 100644
--- a/src/regex-emacs.c
+++ b/src/regex-emacs.c
@@ -2857,6 +2857,9 @@ forall_firstchar_1 (re_char *p, re_char *pend,
       else
         switch (*p)
           {
+          case no_op:
+            p++; continue;
+
           /* Cases which stop the iteration.  */
           case succeed:
           case exactn:
@@ -2872,15 +2875,9 @@ forall_firstchar_1 (re_char *p, re_char *pend,
           /* Cases which may match the empty string.  */
           case at_dot:
           case begbuf:
-          case no_op:
           case wordbound:
           case notwordbound:
           case begline:
-            p++;
-            continue;
-
-          /* Cases which may match the empty string and may
-             tell us something about the next char.  */
           case endline:
           case endbuf:
           case wordbeg:
@@ -3201,6 +3198,11 @@ analyze_first_fastmap (const re_char *p, void *arg)
        }
       return true;
 
+    case at_dot:
+    case begbuf:
+    case wordbound:
+    case notwordbound:
+    case begline:
     case endline:
     case endbuf:
     case wordbeg:
@@ -3244,6 +3246,11 @@ analyze_first_null (const re_char *p, void *arg)
     case notcategoryspec:
       return true;
 
+    case at_dot:
+    case begbuf:
+    case wordbound:
+    case notwordbound:
+    case begline:
     case endline:
     case endbuf:
     case wordbeg:
@@ -3983,6 +3990,13 @@ mutually_exclusive_one (re_char *p2, void *arg)
       RETURN_CONSTRAIN (*data->p1 == syntaxspec
                         && (data->p1[1] == Ssymbol || data->p1[1] == Sword));
 
+    case at_dot:
+    case begbuf:
+    case wordbound:
+    case notwordbound:
+    case begline:
+      RETURN_CONSTRAIN (false);
+
     case duplicate:
       /* At this point, we know nothing about what this can match, sadly.  */
       return false;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]