mutually_exclusive_p (struct re_pattern_buffer *bufp, re_char *p1,
re_char *p2)
{
- return mutually_exclusive_aux (bufp, p1, p2, bufp->buffer, NULL);
+ return mutually_exclusive_aux (bufp, p1, p2, bufp->buffer - 1, NULL);
}
\f
/* Matching routines. */
(erase-buffer)
(insert (make-string 1000000 ?x) "=")
(goto-char (point-min))
+ ;; Make sure we do perform the optimization (if we don't, the
+ ;; below will burp with regexp-stack-overflow).
(should (looking-at "x*=*"))
(should (looking-at "x*\\(=\\|:\\)"))
(should (looking-at "x*\\(=\\|:\\)*"))
- (should (looking-at "x*=*?"))))
+ (should (looking-at "x*=*?"))
+ (should (looking-at "x*\\(=*\\|h\\)*?"))
+ (should (looking-at "x*\\(=*\\|h\\)*"))
+ (should (looking-at "x*\\(=*?\\|h\\)*"))
+ (should (looking-at "x*\\(=*?\\|h\\)*?"))
+ (should (looking-at "x*\\(=*\\|h\\)+?"))
+ (should (looking-at "x*\\(=*\\|h\\)+"))
+ (should (looking-at "x*\\(=*?\\|h\\)+"))
+ (should (looking-at "x*\\(=*?\\|h\\)+?"))
+ (should (looking-at "x*\\(=+\\|h\\)+?"))
+ (should (looking-at "x*\\(=+\\|h\\)+"))
+ (should (looking-at "x*\\(=+?\\|h\\)+"))
+ (should (looking-at "x*\\(=+?\\|h\\)+?"))
+ ;; Regression check for overly optimistic optimization.
+ (should (eq 0 (string-match "\\(ca*\\|ab\\)+d" "cabd")))
+ (should (string-match "\\(aa*\\|b\\)*c" "ababc"))
+ ))
(ert-deftest regexp-tests-zero-width-assertion-repetition ()
;; Check compatibility behaviour with repetition operators after