[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/xr 33c5400 5/6: Suppress false positive in repetition o
From: |
Mattias Engdegård |
Subject: |
[elpa] externals/xr 33c5400 5/6: Suppress false positive in repetition of empty string |
Date: |
Sat, 13 Apr 2019 12:51:17 -0400 (EDT) |
branch: externals/xr
commit 33c540033e2723668330f474c28a9b2b2e6646fd
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
Suppress false positive in repetition of empty string
Don't complain about repetition of the empty string, \(?:\)REPOP,
since that is more likely to be a false positive (from partial parsing
in relint) than an actual error.
Dealing with it here rather than in relint is a clear layer violation
but I don't see a better way.
---
xr-test.el | 2 +-
xr.el | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/xr-test.el b/xr-test.el
index 82585a0..99c85fa 100644
--- a/xr-test.el
+++ b/xr-test.el
@@ -371,7 +371,7 @@
(xr-lint "[-A-Z][A-Z-][A-Z-a][^-A-Z][]-a][A-Z---.]")
'((16 . "Literal `-' not first or last in character alternative"))))
(should (equal
- (xr-lint "\\(?:a*b?\\)*\\(c\\|d\\|\\)+\\(^\\|e\\)*")
+ (xr-lint "\\(?:a*b?\\)*\\(c\\|d\\|\\)+\\(^\\|e\\)*\\(?:\\)*")
'((10 . "Repetition of expression matching an empty string")
(21 . "Repetition of expression matching an empty string"))))
(should (equal (xr-lint "\\'*\\<?\\(?:$\\)+")
diff --git a/xr.el b/xr.el
index d97f147..0438257 100644
--- a/xr.el
+++ b/xr.el
@@ -491,7 +491,10 @@ UPPER may be nil, meaning infinity."
((memq (car sequence) xr--zero-width-assertions)
(xr--report warnings (match-beginning 0)
"Repetition of zero-width assertion"))
- ((xr--matches-empty-p (car sequence))
+ ((and (xr--matches-empty-p (car sequence))
+ ;; Rejecting repetition of the empty string
+ ;; suppresses some false positives.
+ (not (equal (car sequence) "")))
(xr--report
warnings (match-beginning 0)
"Repetition of expression matching an empty string"))))
@@ -519,7 +522,10 @@ UPPER may be nil, meaning infinity."
((memq (car sequence) xr--zero-width-assertions)
(xr--report warnings (match-beginning 0)
"Repetition of zero-width assertion"))
- ((xr--matches-empty-p (car sequence))
+ ((and (xr--matches-empty-p (car sequence))
+ ;; Rejecting repetition of the empty string
+ ;; suppresses some false positives.
+ (not (equal (car sequence) "")))
(xr--report warnings (match-beginning 0)
"Repetition of expression matching an empty string"))))
(if (looking-at (rx (opt (group (one-or-more digit)))
- [elpa] externals/xr updated (2aec9fd -> 8ccace4), Mattias Engdegård, 2019/04/13
- [elpa] externals/xr 4b8d3bc 1/6: Detect `-' not first or last in [...], Mattias Engdegård, 2019/04/13
- [elpa] externals/xr 8ccace4 6/6: Increment version to 1.11, Mattias Engdegård, 2019/04/13
- [elpa] externals/xr a49b9b7 4/6: Check for repetition of empty-matching expression, Mattias Engdegård, 2019/04/13
- [elpa] externals/xr 33c5400 5/6: Suppress false positive in repetition of empty string,
Mattias Engdegård <=
- [elpa] externals/xr 6c1c713 2/6: Strengthen ad-hoc [...] check in skip-set parser, Mattias Engdegård, 2019/04/13
- [elpa] externals/xr 0b9979e 3/6: Use doc strings instead of comments preceding functions, Mattias Engdegård, 2019/04/13