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

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

[elpa] externals/relint bc17dfcd16 05/17: Use ranges in relint's own dia


From: ELPA Syncer
Subject: [elpa] externals/relint bc17dfcd16 05/17: Use ranges in relint's own diags
Date: Thu, 1 Aug 2024 12:59:00 -0400 (EDT)

branch: externals/relint
commit bc17dfcd16ec638b5413e0a94d667a256510ca54
Author: Mattias EngdegÄrd <mattiase@acm.org>
Commit: Mattias EngdegÄrd <mattiase@acm.org>

    Use ranges in relint's own diags
---
 relint.el        | 18 +++++++++---------
 test/1.expected  |  8 ++++----
 test/11.expected | 20 ++++++++++----------
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/relint.el b/relint.el
index e9a25c1fc3..fba546bcaf 100644
--- a/relint.el
+++ b/relint.el
@@ -273,14 +273,14 @@ in case it occupies more than one position in the buffer."
 (defun relint--warn-at (beg-pos end-pos message)
   (relint--report message nil beg-pos end-pos nil nil nil 'warning))
 
-(defun relint--warn (start-pos path message &optional str str-idx)
-  (relint--report-at-path start-pos path message str str-idx str-idx 'warning))
+(defun relint--warn (start-pos path message &optional str str-beg str-end)
+  (relint--report-at-path start-pos path message str str-beg str-end 'warning))
 
 (defun relint--err-at (pos message)
   (relint--report message nil pos nil nil nil nil 'error))
 
 (defun relint--err (start-pos path message &optional str str-idx)
-  (relint--report-at-path start-pos path message str str-idx str-idx 'error))
+  (relint--report-at-path start-pos path message str str-idx nil 'error))
 
 (defun relint--escape-string (str escape-printable)
   (replace-regexp-in-string
@@ -1699,20 +1699,20 @@ than just to a surrounding or producing expression."
                           pos (if exact-path (cons i path) path)
                           (format-message "Suspect range `%s'"
                                           (relint--pretty-range from to))
-                          s j))
+                          s j (+ j 2)))
                         ((= to from)
                          (relint--warn
                           pos (if exact-path (cons i path) path)
                           (format-message
                            "Single-character range `%s'"
                            (relint--escape-string (format "%c-%c" from to) 
nil))
-                          s j))
+                          s j j))
                         ((= to (1+ from))
                          (relint--warn
                           pos (if exact-path (cons i path) path)
                           (format-message "Two-character range `%s'"
                                           (relint--pretty-range from to))
-                          s j)))
+                          s j (+ j 2))))
                        ;; Take care to split ASCII-raw ranges; they do not
                        ;; include anything in-between.
                        (let* ((split (and (<= from #x7f) (>= to #x3fff80)))
@@ -1730,7 +1730,7 @@ than just to a surrounding or producing expression."
                                             (relint--pretty-range from to)
                                             (relint--pretty-range
                                              (car overlap) (cdr overlap)))
-                            s j))
+                            s j (+ j 2)))
                          (if split
                              (progn
                                (push (cons from #x7f) ranges)
@@ -1744,7 +1744,7 @@ than just to a surrounding or producing expression."
                      (relint--warn
                       pos (if exact-path (cons i path) path)
                       (format-message "Literal `-' not first or last")
-                      s j))
+                      s j j))
                    (let ((overlap
                           (relint--intersecting-range from from ranges)))
                      (when overlap
@@ -1757,7 +1757,7 @@ than just to a surrounding or producing expression."
                            "Character `%s' included in range `%s'"
                            (relint--pretty-range from from)
                            (relint--pretty-range (car overlap) (cdr overlap))))
-                        s j)))
+                        s j j)))
                    (push (cons from from) ranges)
                    (setq j (1+ j)))))))
 
diff --git a/test/1.expected b/test/1.expected
index b7466aa10d..c0bac97f9d 100644
--- a/test/1.expected
+++ b/test/1.expected
@@ -184,9 +184,9 @@
 1.elisp:117:54-54: In my-ts-mode-font-lock-rules: Duplicated `6' inside 
character alternative (pos 2)
   "[66]"
    ..^
-1.elisp:121:16-16: Suspect range `+-/' (pos 0)
+1.elisp:121:16-18: Suspect range `+-/' (pos 0..2)
   "+-/"
-   ^
-1.elisp:124:16-16: Suspect range `+-/' (pos 0)
+   ^^^
+1.elisp:124:16-18: Suspect range `+-/' (pos 0..2)
   "+-/"
-   ^
+   ^^^
diff --git a/test/11.expected b/test/11.expected
index ce666a5a17..c44a9f9e62 100644
--- a/test/11.expected
+++ b/test/11.expected
@@ -5,9 +5,9 @@
 11.elisp:8:30-30: Single-character range `c-c' (pos 4)
   "0-9ac-ceg-h3"
    ....^
-11.elisp:8:34-34: Two-character range `g-h' (pos 8)
+11.elisp:8:34-36: Two-character range `g-h' (pos 8..10)
   "0-9ac-ceg-h3"
-   ........^
+   ........^^^
 11.elisp:8:37-37: Character `3' included in range `0-9' (pos 11)
   "0-9ac-ceg-h3"
    ...........^
@@ -16,12 +16,12 @@
   "!s"
    .^
 11.elisp:10:45: Duplicated class `space'
-11.elisp:11:21-21: Suspect range `)-+' (pos 4)
+11.elisp:11:21-23: Suspect range `)-+' (pos 4..6)
   "0-9()-+"
-   ....^
-11.elisp:12:20-20: Suspect range `+-.' (pos 3)
+   ....^^^
+11.elisp:12:20-22: Suspect range `+-.' (pos 3..5)
   "0-9+-."
-   ...^
+   ...^^^
 11.elisp:15:20-20: Literal `-' not first or last (pos 3)
   "A-F-K-T"
    ...^
@@ -55,12 +55,12 @@
   "\240"
    ^^^^
 11.elisp:33:18: Character `m' included in range `a-z'
-11.elisp:34:19-22: Range `\000-\377' overlaps previous `a-f' (pos 0)
+11.elisp:34:19-27: Range `\000-\377' overlaps previous `a-f' (pos 0..2)
   "\000-\377"
-   ^^^^
-11.elisp:35:25-28: Range `\000-\377' overlaps previous `\240-\277' (pos 0)
+   ^^^^^^^^^
+11.elisp:35:25-33: Range `\000-\377' overlaps previous `\240-\277' (pos 0..2)
   "\000-\377"
-   ^^^^
+   ^^^^^^^^^
 11.elisp:37:17: Duplicated rx form in or-pattern: ?A
 11.elisp:37:20: Duplicated rx form in or-pattern: "def"
 11.elisp:38:10: Duplicated rx form in or-pattern: "abc"



reply via email to

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