^ was wrongly interpreted as literal when occurring at the start
of a shy group. Cause: regex.c:at_begline_loc_p() was not told about
shy groups.
Two tests added to tests/automated/regexp-tests.el.
Patch applies against 21.5.31.
--- src/regex.c-dist 2011-04-29 14:31:16.000000000 +0100
+++ src/regex.c 2011-12-11 19:43:46.000000000 +0000
@@ -3553,12 +3553,18 @@
{
re_char *prev = p - 2;
re_bool prev_prev_backslash = prev > pattern && prev[-1] == '\\';
+ re_bool shy_open = prev-1 > pattern && prev[0] == ':'
+ && prev[-1] == '?' && prev[-2] == '(';
+ re_bool ppp_backslash = prev-2 > pattern && prev[-3] == '\\';
return
/* After a subexpression? */
(*prev == '(' && (syntax & RE_NO_BK_PARENS ||
prev_prev_backslash))
/* After an alternative? */
- || (*prev == '|' && (syntax & RE_NO_BK_VBAR ||
prev_prev_backslash));
+ || (*prev == '|' && (syntax & RE_NO_BK_VBAR ||
prev_prev_backslash))
+ /* After a shy open? */
+ || (!(syntax & RE_NO_SHY_GROUPS) && shy_open
+ && (syntax & RE_NO_BK_PARENS || ppp_backslash));
}
--- tests/automated/regexp-tests.el-dist 2011-04-29 14:31:17.000000000 +0100
+++ tests/automated/regexp-tests.el 2011-12-11 19:48:59.000000000 +0000
@@ -401,6 +401,11 @@
(Assert (progn (string-match "\\(a\\)" a)
(string-match "\\(?:a\\)" a)
(not (match-beginning 1))))
+
+ ;; ^ at beginning of shy group. Fix by
+ ;; Julian Bradfield on 2012-12-11.
+ (Assert (string-match "\\(?:^\\)" ""))
+ (Assert (string-match "a(?:^)" "a:^)"))
)
;; bug identified by Katsumi Yamaoka 2004-09-03 <b9ywtzbbpue.fsf_-_(a)jpl.org>
@@ -548,7 +553,7 @@
;; combinations of STRING and STRBUFFER.
;; empty string at point
-;; Thanks Julian Bradford on XEmacs Beta
+;; Thanks Julian Bradfield on XEmacs Beta
;; <18652.54975.894512.880956(a)krk.inf.ed.ac.uk>
(with-string-as-buffer-contents "aáa"
(goto-char (point-min))
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta