branch: externals/xr commit 3c1344b10a2700a16359434a60c4b3eb6bb1de0c Author: Mattias Engdegård <matti...@acm.org> Commit: Mattias Engdegård <matti...@acm.org>
Don't warn about repetition of counted repetition Repetition of counted repetition can actually be legitimate; -- consider a\{3\}? -- so don't warn about it. --- xr-test.el | 5 ++--- xr.el | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/xr-test.el b/xr-test.el index 33c1e3e..0c686c1 100644 --- a/xr-test.el +++ b/xr-test.el @@ -275,11 +275,10 @@ '((0 . "Escaped non-special character `}'") (4 . "Escaped non-special character `a'") (8 . "Escaped non-special character `%'")))) - (should (equal (xr-lint "a?+b+?\\(?:c?\\)*d\\{3\\}+e*\\{2,5\\}") + (should (equal (xr-lint "a?+b+?\\(?:c?\\)*d\\{3\\}+e*?\\{2,5\\}") '((2 . "Repetition of repetition") (14 . "Repetition of repetition") - (21 . "Repetition of repetition") - (24 . "Repetition of repetition")))) + (25 . "Repetition of repetition")))) ) (provide 'xr-test) diff --git a/xr.el b/xr.el index 5a5fff4..95845dd 100644 --- a/xr.el +++ b/xr.el @@ -315,8 +315,7 @@ (let ((operator (match-string 0))) (when (and (consp (car sequence)) (memq (caar sequence) - '(opt zero-or-more one-or-more - repeat = >=))) + '(opt zero-or-more one-or-more +? *? ??))) (xr--report warnings (match-beginning 0) "Repetition of repetition")) (goto-char (match-end 0)) @@ -335,8 +334,7 @@ (forward-char 2) (when (and (consp (car sequence)) (memq (caar sequence) - '(opt zero-or-more one-or-more - repeat = >=))) + '(opt zero-or-more one-or-more +? *? ??))) (xr--report warnings (match-beginning 0) "Repetition of repetition")) (if (looking-at (rx (opt (group (one-or-more digit)))