summaryrefslogtreecommitdiff
path: root/lisp/progmodes/compile.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2022-06-29 12:34:39 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2022-06-29 17:28:24 +0200
commitd462c8133bfb9ac9325228184e5dcf0c9b7011cc (patch)
tree59614995481d32ea4938a026f4e865caf62ca2f8 /lisp/progmodes/compile.el
parent3447e79f2493580864962db69859bda1afd4643b (diff)
downloademacs-d462c8133bfb9ac9325228184e5dcf0c9b7011cc.tar.gz
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.
Diffstat (limited to 'lisp/progmodes/compile.el')
-rw-r--r--lisp/progmodes/compile.el73
1 files changed, 39 insertions, 34 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 28a49fc0dda..3393aa9b635 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