emacs-diffs
[Top][All Lists]
Advanced

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

master d462c8133b 2/3: Complete transition to rx for compilation `gnu` p


From: Mattias Engdegård
Subject: master d462c8133b 2/3: Complete transition to rx for compilation `gnu` pattern
Date: Wed, 29 Jun 2022 11:29:17 -0400 (EDT)

branch: master
commit d462c8133bfb9ac9325228184e5dcf0c9b7011cc
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Complete transition to rx for compilation `gnu` pattern
    
    * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
    Change from a mixture of traditional regexp syntax and rx,
    to make intentions clearer.
---
 lisp/progmodes/compile.el | 73 +++++++++++++++++++++++++----------------------
 1 file changed, 39 insertions(+), 34 deletions(-)

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 28a49fc0dd..3393aa9b63 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -359,12 +359,15 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
      ": \\*\\*\\* \\[\\(\\(.+?\\):\\([0-9]+\\): .+\\)\\]" 2 3 nil 0 1)
 
     (gnu
+     ;; The `gnu' message syntax is
+     ;;   [PROGRAM:]FILE:LINE[-ENDLINE]:[COL[-ENDCOL]:] MESSAGE
+     ;; or
+     ;;   [PROGRAM:]FILE:LINE[.COL][-ENDLINE[.ENDCOL]]: MESSAGE
      ,(rx
        bol
-       ;; Match an optional program name in the format
-       ;;     PROGRAM:SOURCE-FILE-NAME:LINENO: MESSAGE
-       ;; which is used for non-interactive programs other than
-       ;; compilers (e.g. the "jade:" entry in compilation.txt).
+       ;; Match an optional program name which is used for
+       ;; non-interactive programs other than compilers (e.g. the
+       ;; "jade:" entry in compilation.txt).
        (? (: (* " ")        ; Allow space to precede the program name.
              (| (: alpha (+ (in ?. ?- alnum)) ":" (? " "))
                 ;; Skip indentation generated by GCC's -fanalyzer.
@@ -372,54 +375,56 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
 
        ;; File name group.
        (group-n 1
-                ;; Avoid matching the file name as a program in the pattern
-                ;; above by disallow file names entirely composed of digits.
-                (: (regexp "[0-9]*[^0-9\n]")
-                   ;; This rule says that a file name can be composed
-                   ;; of any non-newline char, but it also rules out
-                   ;; some valid but unlikely cases, such as a
-                   ;; trailing space or a space followed by a -, or a
-                   ;; colon followed by a space.
-                   (*? (| (regexp "[^\n :]")
-                          (regexp " [^-/\n]")
-                          (regexp ":[^ \n]")))))
-       (regexp ": ?")
+         ;; Avoid matching the file name as a program in the pattern
+         ;; above by disallowing file names entirely composed of digits.
+         (* (in "0-9"))
+         (not (in "0-9" "\n"))
+         ;; A file name can be composed of any non-newline char, but
+         ;; rule out some valid but unlikely cases, such as a trailing
+         ;; space or a space followed by a -, or a colon followed by a
+         ;; space.
+         (*? (| (not (in "\n :"))
+                (: " " (not (in ?- "/\n")))
+                (: ":" (not (in " \n"))))))
+       ":" (? " ")
 
        ;; Line number group.
-       (group-n 2 (regexp "[0-9]+"))
+       (group-n 2 (+ (in "0-9")))
        (? (| (: "-"
-                (group-n 4 (regexp "[0-9]+"))          ; ending line
-                (? "." (group-n 5 (regexp "[0-9]+")))) ; ending column
+                (group-n 4 (+ (in "0-9")))               ; ending line
+                (? "." (group-n 5 (+ (in "0-9")))))      ; ending column
              (: (in ".:")
-                (group-n 3 (regexp "[0-9]+")) ; starting column
+                (group-n 3 (+ (in "0-9")))               ; starting column
                 (? "-"
-                   (? (group-n 4 (regexp "[0-9]+")) ".") ; ending line
-                   (group-n 5 (regexp "[0-9]+")))))) ; ending column
+                   (? (group-n 4 (+ (in "0-9"))) ".")    ; ending line
+                   (group-n 5 (+ (in "0-9")))))))        ; ending column
        ":"
        (| (: (* " ")
              (group-n 6 (| "FutureWarning"
                            "RuntimeWarning"
-                           "Warning"
-                           "warning"
+                           "Warning" "warning"
                            "W:")))
           (: (* " ")
-             (group-n 7 (| (regexp "[Ii]nfo\\(?:\\>\\|rmationa?l?\\)")
-                           "I:"
-                           (: "[ skipping " (+ nonl) " ]")
-                           "instantiated from"
-                           "required from"
-                           (regexp "[Nn]ote"))))
+             (group-n 7
+               (| (| "Info" "info"
+                     "Information" "information"
+                     "Informational" "informational"
+                     "I:"
+                     "instantiated from"
+                     "required from"
+                     "Note" "note")
+                  (: "[ skipping " (+ nonl) " ]"))))
           (: (* " ")
-             (regexp "[Ee]rror"))
+             (| "Error" "error"))
 
           ;; Avoid matching time stamps on the form "HH:MM:SS" where
           ;; MM is interpreted as a line number by trying to rule out
           ;; messages where the text after the line number starts with
           ;; a 2-digit number.
-          (: (regexp "[0-9]?")
-             (| (regexp "[^0-9\n]")
+          (: (? (in "0-9"))
+             (| (not (in "0-9\n"))
                 eol))
-          (regexp "[0-9][0-9][0-9]")))
+          (: (in "0-9") (in "0-9") (in "0-9"))))
      1 (2 . 4) (3 . 5) (6 . 7))
 
     (cucumber



reply via email to

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