emacs-diffs
[Top][All Lists]
Advanced

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

master 3766bf7: Don't complain about the regexp "[:-:]"


From: Mattias Engdegård
Subject: master 3766bf7: Don't complain about the regexp "[:-:]"
Date: Wed, 26 Feb 2020 17:01:22 -0500 (EST)

branch: master
commit 3766bf728a43933083f4525970bcf9fdace3838d
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    Don't complain about the regexp "[:-:]"
    
    Suggested by Clément Pit-Claudel.
    
    * src/regex-emacs.c (regex_compile):
    * test/src/regex-emacs-tests.el (regexp-invalid): Tolerate ranges.
---
 src/regex-emacs.c             | 2 +-
 test/src/regex-emacs-tests.el | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/regex-emacs.c b/src/regex-emacs.c
index 3882437..794958e 100644
--- a/src/regex-emacs.c
+++ b/src/regex-emacs.c
@@ -2007,7 +2007,7 @@ regex_compile (re_char *pattern, ptrdiff_t size,
             if (*p == ':')
               {
                 re_char *q = p + 1;
-                while (q != pend && *q != ']')
+                while (q != pend && *q != ']' && *q != '-')
                   {
                     if (*q == ':')
                       {
diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el
index 661d416..f1c703a 100644
--- a/test/src/regex-emacs-tests.el
+++ b/test/src/regex-emacs-tests.el
@@ -806,6 +806,7 @@ This evaluates the TESTS test cases from glibc."
 (ert-deftest regexp-invalid ()
   ;; relint suppression: Duplicated
   (should-error (string-match "[:space:]" "")
-                :type 'invalid-regexp))
+                :type 'invalid-regexp)
+  (should (equal (string-match "[:-:]" "a-:") 2)))
 
 ;;; regex-emacs-tests.el ends here



reply via email to

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