I was wondering if anyone could help me figure out why the compilation-error-regexp for IAR ( compilation-error-regexp-alist-alist, in compile.el ) does not work?
The regexp is:
(iar
"^\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(?:Error\\|Warnin\\(g\\)\\)\\[[0-9]+\\]:"
1 2 nil (3))
An IAR EWARM (7.80.4) error/warning message has the following format:
c:\someFolder\someFile.cpp(18) : Error[Pe018]: expected a ")"
c:\someFolder\someFile.cpp(26) : Warning[Pe012]: parsing restarts here after previous syntax error
I have no experience with Emacs regular expressions, so any help would be greatly appreciated.
Note that the error/warning features of compile.el work for python, so it does not seem to be a configuration issue.
Emacs version: emacs-25.1.1 (x86_64-w64-mingw32)
Edit: Thanks! That was very helpful. Using M-x re-builder I was able to use the pattern you provided to make the following expression :
"\\(^..*\\.cpp\\|^..*\\.c\\|^..*\\.hpp\\|^..*\\.h\\)(\\([0-9]+\\))\\s-+:\\s-+\\(?:Error\\|Warnin\\(g\\)\\)\\[[Pe0-9]+\\]:.*"
It detects the filename and line number. I am however still not able to make it work in compilation mode, as I don't quite understand the remaining arguments of compilation-error-regexp-alist-alist. The documentation states:
"Each elt has the form (REGEXP FILE [LINE COLUMN TYPE HYPERLINK HIGHLIGHT...]). If REGEXP matches, the FILE'th subexpression gives the file name, and the LINE'th subexpression gives the line number. The COLUMN'th subexpression gives the column number on that line."
As far as I can tell the complete expression should be something like:
(iarbuild
"\\(^..*\\.cpp\\|^..*\\.c\\|^..*\\.hpp\\|^..*\\.h\\)(\\([0-9]+\\))\\s-+:\\s-+\\(?:Error\\|Warnin\\(g\\)\\)\\[[Pe0-9]+\\]:.*" 1 2 nil)
But I can't get it to work. Any tips?
Remark
, which is a kind of message you get when you have enabled remarks in the compiler settings.Remark
be proper value forInfo
that I was guessing at in my answer? I did wonder about simply making that group\\(.+\\)
to mean "anything other than an Error or a Warning"; but if all lines will specify either Error, Warning, or Remark then the regexp may as well use it explicitly.Fatal Error
(e.g. when a header file is missing),Error
,Warning
, andRemark
. I would strongly recommend a regexp that match these explicitly, to avoid false positives.