emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 321cbd9a60: Tighten and simplify typescript compilation-mode re


From: Mattias Engdegård
Subject: emacs-29 321cbd9a60: Tighten and simplify typescript compilation-mode regexps (bug#61104)
Date: Mon, 6 Feb 2023 12:34:34 -0500 (EST)

branch: emacs-29
commit 321cbd9a6014bf0b70dc0b01aed27f36aec4051d
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    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.
---
 etc/compilation.txt       | 14 ++++++++++++++
 lisp/progmodes/compile.el | 28 ++++++++++++++++++++--------
 2 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/etc/compilation.txt b/etc/compilation.txt
index 672cbebaff..5f6ecb09cc 100644
--- a/etc/compilation.txt
+++ b/etc/compilation.txt
@@ -639,6 +639,20 @@ symbol: weblint
 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
 
 Directories are matched via 'compilation-directory-matcher'.  Files which are
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 1e57d0b7bb..ccf64fb670 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -653,19 +653,31 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = 
\\([0-9]+\\)\\)?"
     ;; Typescript compilation prior to tsc version 2.7, "plain" format:
     ;; greeter.ts(30,12): error TS2339: Property 'foo' does not exist.
     (typescript-tsc-plain
-     ,(concat
-      "^[[:blank:]]*"
-      "\\([^(\r\n)]+\\)(\\([0-9]+\\),\\([0-9]+\\)):[[:blank:]]+"
-      "error [[:alnum:]]+: [^\r\n]+$")
+     ,(rx bol
+          (group (not (in " \t\n()"))   ; 1: file
+                 (* (not (in "\n()"))))
+          "("
+          (group (+ (in "0-9")))        ; 2: line
+          ","
+          (group (+ (in "0-9")))        ; 3: column
+          "): error "
+          (+ (in "0-9A-Z"))             ; error code
+          ": ")
      1 2 3 2)
 
     ;; Typescript compilation after tsc version 2.7, "pretty" format:
     ;; src/resources/document.ts:140:22 - error TS2362: something.
     (typescript-tsc-pretty
-     ,(concat
-       "^[[:blank:]]*"
-       "\\([^(\r\n)]+\\):\\([0-9]+\\):\\([0-9]+\\) - [[:blank:]]*"
-       "error [[:alnum:]]+: [^\r\n]+$")
+     ,(rx bol
+          (group (not (in " \t\n()"))   ; 1: file
+                 (* (not (in "\n()"))))
+          ":"
+          (group (+ (in "0-9")))        ; 2: line
+          ":"
+          (group (+ (in "0-9")))        ; 3: column
+          " - error "
+          (+ (in "0-9A-Z"))             ; error code
+          ": ")
      1 2 3 2)
     ))
   "Alist of values for `compilation-error-regexp-alist'.")



reply via email to

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