emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/xr c6e12b7 04/10: Handle \w and \W in subsumption check


From: Mattias Engdegård
Subject: [elpa] externals/xr c6e12b7 04/10: Handle \w and \W in subsumption checks
Date: Sun, 3 May 2020 11:13:08 -0400 (EDT)

branch: externals/xr
commit c6e12b71234c1009395d8b0c013db77d63834269
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    Handle \w and \W in subsumption checks
---
 xr-test.el | 8 ++++++++
 xr.el      | 6 +++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/xr-test.el b/xr-test.el
index a46cf60..88e68f7 100644
--- a/xr-test.el
+++ b/xr-test.el
@@ -509,6 +509,14 @@
     (should (equal (xr-lint "\\Ca\\|ü")
                    '((5 . "Branch matches subset of a previous branch"))))
     
+    (should (equal (xr-lint "\\w\\|[^z-a]")
+                   '((4 . "Branch matches superset of a previous branch"))))
+    (should (equal (xr-lint "\\W\\|[^z-a]")
+                   '((4 . "Branch matches superset of a previous branch"))))
+    (should (equal (xr-lint "\\w\\|a")
+                   '((4 . "Branch matches subset of a previous branch"))))
+    (should (equal (xr-lint "\\W\\|\f")
+                   '((4 . "Branch matches subset of a previous branch"))))
   ))
 
 (ert-deftest xr-lint-subsumed-repetition ()
diff --git a/xr.el b/xr.el
index fa89862..03b5f0a 100644
--- a/xr.el
+++ b/xr.el
@@ -1033,7 +1033,8 @@ A-SETS and B-SETS are arguments to `any'."
   (or (memq rx '(nonl anything
                  ascii alnum alpha blank cntrl digit graph
                  lower multibyte nonascii print punct space
-                 unibyte upper word xdigit))
+                 unibyte upper word xdigit
+                 wordchar not-wordchar))
       (characterp rx)
       (and (consp rx)
            (or (memq (car rx) '(any category syntax))
@@ -1160,6 +1161,9 @@ A-SETS and B-SETS are arguments to `any'."
        (`(not (syntax ,syn))
         (or (equal a b) (xr--syntax-superset-of-rx-p syn t b)))
 
+       ('wordchar (or (equal a b) (xr--syntax-superset-of-rx-p 'word nil b)))
+       ('not-wordchar (or (equal a b) (xr--syntax-superset-of-rx-p 'word t b)))
+
        ((or `(category ,_) `(not (category ,_)))
         (or (equal a b)
             (and (characterp b)



reply via email to

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