[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)
- [elpa] externals/xr updated (434b300 -> 35dbbeb), Mattias Engdegård, 2020/05/03
- [elpa] externals/xr e5b51bf 01/10: Add wrapped subsumption in repeated forms, Mattias Engdegård, 2020/05/03
- [elpa] externals/xr f3b61ef 05/10: Fix false negative in empty string repetition check, Mattias Engdegård, 2020/05/03
- [elpa] externals/xr c98bb7b 03/10: Handle whitespace and word syntax subsumption in one place, Mattias Engdegård, 2020/05/03
- [elpa] externals/xr c7e7557 07/10: Broaden anchor check to check more paths, Mattias Engdegård, 2020/05/03
- [elpa] externals/xr d752aab 09/10: Use "option" instead of "repetition" in diagnostics for ? and ??, Mattias Engdegård, 2020/05/03
- [elpa] externals/xr c6e12b7 04/10: Handle \w and \W in subsumption checks,
Mattias Engdegård <=
- [elpa] externals/xr 21eab3c 06/10: Check for bol, eol and eos in conflict with other expressions, Mattias Engdegård, 2020/05/03
- [elpa] externals/xr 7160235 02/10: Refactor repetition subsumption check to avoid code duplication, Mattias Engdegård, 2020/05/03
- [elpa] externals/xr d0b09e1 08/10: Add filename-specific checks, Mattias Engdegård, 2020/05/03
- [elpa] externals/xr 35dbbeb 10/10: Increment version to 1.19, Mattias Engdegård, 2020/05/03