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.
This commit is contained in:
Mattias Engdegård 2020-11-06 17:10:55 +01:00
parent 6b77ad6e77
commit 6e9564f09a
2 changed files with 15 additions and 12 deletions

View file

@ -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

View file

@ -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\":"