Tighten and simplify typescript compilation-mode regexps (bug#61104)

* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Tighten regexps and simplify.  Translate to rx.
* etc/compilation.txt: Add examples.

In collaboration with Jostein Kjønigsen.
This commit is contained in:
Mattias Engdegård 2023-02-06 11:45:33 +01:00
parent 97533e73ad
commit 321cbd9a60
2 changed files with 34 additions and 8 deletions

View file

@ -639,6 +639,20 @@ symbol: weblint
index.html (13:1) Unknown element <fdjsk> index.html (13:1) Unknown element <fdjsk>
* Typescript prior to tsc version 2.7, "plain" format
symbol: typescript-tsc-plain
greeter.ts(30,12): error TS2339: Property 'foo' does not exist.
* Typescript after tsc version 2.7, "pretty" format
symbol: typescript-tsc-pretty
src/resources/document.ts:140:22 - error TS2362: something.
* Directory tracking * Directory tracking
Directories are matched via 'compilation-directory-matcher'. Files which are Directories are matched via 'compilation-directory-matcher'. Files which are

View file

@ -653,19 +653,31 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?"
;; Typescript compilation prior to tsc version 2.7, "plain" format: ;; Typescript compilation prior to tsc version 2.7, "plain" format:
;; greeter.ts(30,12): error TS2339: Property 'foo' does not exist. ;; greeter.ts(30,12): error TS2339: Property 'foo' does not exist.
(typescript-tsc-plain (typescript-tsc-plain
,(concat ,(rx bol
"^[[:blank:]]*" (group (not (in " \t\n()")) ; 1: file
"\\([^(\r\n)]+\\)(\\([0-9]+\\),\\([0-9]+\\)):[[:blank:]]+" (* (not (in "\n()"))))
"error [[:alnum:]]+: [^\r\n]+$") "("
(group (+ (in "0-9"))) ; 2: line
","
(group (+ (in "0-9"))) ; 3: column
"): error "
(+ (in "0-9A-Z")) ; error code
": ")
1 2 3 2) 1 2 3 2)
;; Typescript compilation after tsc version 2.7, "pretty" format: ;; Typescript compilation after tsc version 2.7, "pretty" format:
;; src/resources/document.ts:140:22 - error TS2362: something. ;; src/resources/document.ts:140:22 - error TS2362: something.
(typescript-tsc-pretty (typescript-tsc-pretty
,(concat ,(rx bol
"^[[:blank:]]*" (group (not (in " \t\n()")) ; 1: file
"\\([^(\r\n)]+\\):\\([0-9]+\\):\\([0-9]+\\) - [[:blank:]]*" (* (not (in "\n()"))))
"error [[:alnum:]]+: [^\r\n]+$") ":"
(group (+ (in "0-9"))) ; 2: line
":"
(group (+ (in "0-9"))) ; 3: column
" - error "
(+ (in "0-9A-Z")) ; error code
": ")
1 2 3 2) 1 2 3 2)
)) ))
"Alist of values for `compilation-error-regexp-alist'.") "Alist of values for `compilation-error-regexp-alist'.")