emacs-diffs
[Top][All Lists]
Advanced

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

emacs-27 96a269d 1/3: Speed up 'maven' compilation error message regexp


From: Mattias Engdegård
Subject: emacs-27 96a269d 1/3: Speed up 'maven' compilation error message regexp
Date: Mon, 17 Feb 2020 05:30:36 -0500 (EST)

branch: emacs-27
commit 96a269d045091bcf7ed424a7a039385727f6e694
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    Speed up 'maven' compilation error message regexp
    
    Anchor the regexp at line-start to prevent quadratic behaviour when
    it doesn't match (bug#39595).  It's unclear whether the type tag, like
    [ERROR], is always present; we keep it optional just in case.
    
    * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
    Rewrite 'maven' regexp, using rx for clarity.
    * etc/compilation.txt (maven): More examples.
    * test/lisp/progmodes/compile-tests.el
    (compile-tests--test-regexps-data): No leading spaces; they seems to
    stem from a misunderstanding in bug#11517.
---
 etc/compilation.txt                  |  2 ++
 lisp/progmodes/compile.el            | 20 ++++++++++++++++----
 test/lisp/progmodes/compile-tests.el |  2 +-
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/etc/compilation.txt b/etc/compilation.txt
index a597216..c465b4b 100644
--- a/etc/compilation.txt
+++ b/etc/compilation.txt
@@ -341,6 +341,8 @@ makepp: bla bla `/foo/bar.c' and `/foo/bar.h'
 symbol: maven
 
 FooBar.java:[111,53] no interface expected here
+[ERROR] /Users/cinsk/hello.java:[651,96] ';' expected
+[WARNING] /foo/bar/Test.java:[27,43] unchecked conversion
 
 
 * MIPS lint; looks good for SunPro lint also
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 48ac85a..9959c82 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -268,12 +268,24 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
     (jikes-file
      "^\\(?:Found\\|Issued\\) .* compiling \"\\(.+\\)\":$" 1 nil nil 0)
 
-
-    ;; This used to be pathologically slow on long lines (Bug#3441),
-    ;; due to matching filenames via \\(.*?\\).  This might be faster.
     (maven
      ;; Maven is a popular free software build tool for Java.
-     "\\(\\[WARNING\\] *\\)?\\([^ \n]\\(?:[^\n :]\\| [^-/\n]\\|:[^ 
\n]\\)*?\\):\\[\\([0-9]+\\),\\([0-9]+\\)\\] " 2 3 4 (1))
+     ,(rx bol
+          ;; It is unclear whether the initial [type] tag is always present.
+          (? "["
+             (or "ERROR" (group-n 1 "WARNING") (group-n 2 "INFO"))
+             "] ")
+          (group-n 3                    ; File
+                   (not (any "\n ["))
+                   (* (or (not (any "\n :"))
+                          (: " " (not (any "\n/-")))
+                          (: ":" (not (any "\n ["))))))
+          ":["
+          (group-n 4 (+ digit))         ; Line
+          ","
+          (group-n 5 (+ digit))         ; Column
+          "] ")
+     3 4 5 (1 . 2))
 
     (jikes-line
      "^ *\\([0-9]+\\)\\.[ \t]+.*\n +\\(<-*>\n\\*\\*\\* 
\\(?:Error\\|Warnin\\(g\\)\\)\\)"
diff --git a/test/lisp/progmodes/compile-tests.el 
b/test/lisp/progmodes/compile-tests.el
index 350b4eb..c3cec01 100644
--- a/test/lisp/progmodes/compile-tests.el
+++ b/test/lisp/progmodes/compile-tests.el
@@ -242,7 +242,7 @@
     ;; maven
     ("FooBar.java:[111,53] no interface expected here"
      1 53 111 "FooBar.java" 2)
-    ("  [ERROR] /Users/cinsk/hello.java:[651,96] ';' expected"
+    ("[ERROR] /Users/cinsk/hello.java:[651,96] ';' expected"
      15 96 651 "/Users/cinsk/hello.java" 2) ;Bug#11517.
     ("[WARNING] /foo/bar/Test.java:[27,43] unchecked conversion"
      11 43 27 "/foo/bar/Test.java" 1) ;Bug#20556



reply via email to

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