emacs-diffs
[Top][All Lists]
Advanced

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

master 6e9564f: Fix javac message parsing column number off-by-one


From: Mattias Engdegård
Subject: master 6e9564f: Fix javac message parsing column number off-by-one
Date: Fri, 6 Nov 2020 11:26:44 -0500 (EST)

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

    Fix javac message parsing column number off-by-one
    
    * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
    'javac': Column numbers are 1-based by default; remove subtraction and
    η-reduce.  Translate regexp to rx (mechanised).
    * test/lisp/progmodes/compile-tests.el (compile-tests--test-regexps-data):
    Adapt 'javac' test cases to the change.
---
 lisp/progmodes/compile.el            | 23 +++++++++++++----------
 test/lisp/progmodes/compile-tests.el |  4 ++--
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index de0ea42..e0dabed 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -268,17 +268,20 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
      "^\\(?:[ \t]+at \\|==[0-9]+== 
+\\(?:at\\|b\\(y\\)\\)\\).+(\\([^()\n]+\\):\\([0-9]+\\))$" 2 3 nil (1))
 
     (javac
-     ,(concat
-       ;; line1
-       "^\\(\\(?:[A-Za-z]:\\)?[^:\n]+\\):" ;file
-       "\\([0-9]+\\): "                    ;line
-       "\\(warning: \\)?.*\n"              ;type (optional) and message
-       ;; line2: source line containing error
-       ".*\n"
-       ;; line3: single "^" under error position in line2
-       " *\\^$")
+     ,(rx bol
+          (group                        ; file
+           (? (in "A-Za-z") ":")
+           (+ (not (in "\n:"))))
+          ":"
+          (group (+ (in "0-9")))        ; line number
+          ": "
+          (? (group "warning: "))       ; type (optional)
+          (* nonl) "\n"                 ; message
+          (* nonl) "\n"                 ; source line containing error
+          (* " ") "^"                   ; caret line; ^ marks error
+          eol)
      1 2
-     ,(lambda () (1- (current-column)))
+     ,#'current-column
      (3))
 
     (jikes-file
diff --git a/test/lisp/progmodes/compile-tests.el 
b/test/lisp/progmodes/compile-tests.el
index b8ed6e0..0288cba 100644
--- a/test/lisp/progmodes/compile-tests.el
+++ b/test/lisp/progmodes/compile-tests.el
@@ -191,10 +191,10 @@
     ;; javac
     (javac
      "/src/Test.java:5: ';' expected\n        foo foo\n               ^\n"
-     1 15 5 "/src/Test.java" 2)
+     1 16 5 "/src/Test.java" 2)
     (javac
      "e:\\src\\Test.java:7: warning: ';' expected\n   foo foo\n          ^\n"
-     1 10 7 "e:\\src\\Test.java" 1)
+     1 11 7 "e:\\src\\Test.java" 1)
     ;; jikes-file jikes-line
     (jikes-file
      "Found 2 semantic errors compiling \"../javax/swing/BorderFactory.java\":"



reply via email to

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