Commits

Anonymous committed d66da30

Shy group fix

  • Participants
  • Parent commits 51ced9b

Comments (0)

Files changed (4)

+2011-12-11  Julian Bradfield <jcb+xeb@jcbradfield.org>
+
+	* regex.c: ^ was wrongly interpreted as literal when occurring at
+	the start of a shy group.
+
 2009-09-23  Stephen Turnbull  <stephen@xemacs.org>
 
 	* glyphs-eimage.c (png_instantiate):
 {
   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));
 }
 
 
+2011-12-11  Julian Bradfield <jcb+xeb@jcbradfield.org>
+
+	* automated/regexp-tests.l: ^ was wrongly interpreted as literal
+	when occurring at the start of a shy group.
+
 2010-03-07  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* automated/mule-tests.el (string character conversion):

tests/automated/regexp-tests.el

   (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:^)"))
 )
 
 
 ;; empty string at point
-;; Thanks Julian Bradford on XEmacs Beta
+;; Thanks Julian Bradfield on XEmacs Beta
 ;; <18652.54975.894512.880956@krk.inf.ed.ac.uk>
 (with-string-as-buffer-contents "a�a"
   (goto-char (point-min))