aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2023-11-25 11:03:08 -0500
committerStefan Monnier2023-11-25 11:03:08 -0500
commit82bba6713fc9d5c7cc24c182236df4f16545e941 (patch)
treeb6bb21b097b76102e15192c0dd1ef9441b2bc580 /src
parentc20226a1ef5fbdfd3e71e2ef8654ee19994c0f2f (diff)
downloademacs-82bba6713fc9d5c7cc24c182236df4f16545e941.tar.gz
emacs-82bba6713fc9d5c7cc24c182236df4f16545e941.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/regex-emacs.c26
1 files 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,
2857 else 2857 else
2858 switch (*p) 2858 switch (*p)
2859 { 2859 {
2860 case no_op:
2861 p++; continue;
2862
2860 /* Cases which stop the iteration. */ 2863 /* Cases which stop the iteration. */
2861 case succeed: 2864 case succeed:
2862 case exactn: 2865 case exactn:
@@ -2872,15 +2875,9 @@ forall_firstchar_1 (re_char *p, re_char *pend,
2872 /* Cases which may match the empty string. */ 2875 /* Cases which may match the empty string. */
2873 case at_dot: 2876 case at_dot:
2874 case begbuf: 2877 case begbuf:
2875 case no_op:
2876 case wordbound: 2878 case wordbound:
2877 case notwordbound: 2879 case notwordbound:
2878 case begline: 2880 case begline:
2879 p++;
2880 continue;
2881
2882 /* Cases which may match the empty string and may
2883 tell us something about the next char. */
2884 case endline: 2881 case endline:
2885 case endbuf: 2882 case endbuf:
2886 case wordbeg: 2883 case wordbeg:
@@ -3201,6 +3198,11 @@ analyze_first_fastmap (const re_char *p, void *arg)
3201 } 3198 }
3202 return true; 3199 return true;
3203 3200
3201 case at_dot:
3202 case begbuf:
3203 case wordbound:
3204 case notwordbound:
3205 case begline:
3204 case endline: 3206 case endline:
3205 case endbuf: 3207 case endbuf:
3206 case wordbeg: 3208 case wordbeg:
@@ -3244,6 +3246,11 @@ analyze_first_null (const re_char *p, void *arg)
3244 case notcategoryspec: 3246 case notcategoryspec:
3245 return true; 3247 return true;
3246 3248
3249 case at_dot:
3250 case begbuf:
3251 case wordbound:
3252 case notwordbound:
3253 case begline:
3247 case endline: 3254 case endline:
3248 case endbuf: 3255 case endbuf:
3249 case wordbeg: 3256 case wordbeg:
@@ -3983,6 +3990,13 @@ mutually_exclusive_one (re_char *p2, void *arg)
3983 RETURN_CONSTRAIN (*data->p1 == syntaxspec 3990 RETURN_CONSTRAIN (*data->p1 == syntaxspec
3984 && (data->p1[1] == Ssymbol || data->p1[1] == Sword)); 3991 && (data->p1[1] == Ssymbol || data->p1[1] == Sword));
3985 3992
3993 case at_dot:
3994 case begbuf:
3995 case wordbound:
3996 case notwordbound:
3997 case begline:
3998 RETURN_CONSTRAIN (false);
3999
3986 case duplicate: 4000 case duplicate:
3987 /* At this point, we know nothing about what this can match, sadly. */ 4001 /* At this point, we know nothing about what this can match, sadly. */
3988 return false; 4002 return false;