A commandline option for verbose or emacs standard error format?
I'll have to look at the existing format, see if it's worth keeping.
I think this is going to be a fairly simple change.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
>>A commandline option for verbose or emacs standard error format?
Well, that's not verbose or something. It's just the way emacs handles makefile output - it must contain type of compiler (or another tool) message - error, warning, etc., full filename, line index and column index.
procedure TStatusMesssageReceiver.OnReceiveStatusMessage(const psFile, psMessage: string;
const piY, piX: integer);
var
lsPrefix: string;
lsMessage: string;
begin
lsPrefix := '';
if (Pos('Exception', psMessage) > 0) or (Pos('Error', psMessage) > 0) then
begin
lsPrefix := 'Error:';
end;
if (piX < 0) or (piY < 0) then
begin
// format with no line and col
lsMessage := Format('%s %s %s', [psFile, lsPrefix, psMessage]);
end
else
begin
// format with a line and col
lsMessage := Format('%s(%s,%s) %s %s',
[psFile, IntToStr(piY), IntToStr(piX), lsPrefix, psMessage]);
end;
WriteLn(lsMessage);
end;
No output format switching code yet. When I run jcf on a file that isn't deplhi source, I get:
C:\Code\Jcf\Output>jcf -F dunit.ini
dunit.ini Formatting file dunit.ini
dunit.ini(1,1) Error: Exception TEParseError Expected program, package, library
, unit
Near [
dunit.ini Aborted due to error
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have checked in some code - since looking through the message text to see if it contains "error" etc. is going to go wrong sometimes, I have changed the event proc signature to also take an enumerated message type which will tell you if it's an error, warning or what.
I'll look at including the path later.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi.
It would be excellent, if error message use a standart for free pascal/delphi method of showing errors in line. Like following:
//free pascal
demo.pas(7,1) Fatal: Syntax error, ":" expected but "BEGIN" found
//delphi
demo.pas(151) Error: Missing operator or semicolon
P.S.
I tend to use emacs as code editor, but jcf does not even print file name :(
Thanks.
Best regards,
Denis
Can I fix it myself and send you a patch?
I think commandline option will fit fine for such reporting. Am I right?
Thanks.
A commandline option for verbose or emacs standard error format?
I'll have to look at the existing format, see if it's worth keeping.
I think this is going to be a fairly simple change.
>>A commandline option for verbose or emacs standard error format?
Well, that's not verbose or something. It's just the way emacs handles makefile output - it must contain type of compiler (or another tool) message - error, warning, etc., full filename, line index and column index.
More details here -
http://www.emacswiki.org/cgi-bin/wiki/CreatingYourOwnCompileErrorRegexp
http://www.tddft.org/programs/octopus/wiki/index.php/Emacs_helpers
>>I'll have to look at the existing format, see if it's worth keeping.
>>I think this is going to be a fairly simple change.
You are the boss :)
Thanks.
Ok, here's my attempt at the format:
procedure TStatusMesssageReceiver.OnReceiveStatusMessage(const psFile, psMessage: string;
const piY, piX: integer);
var
lsPrefix: string;
lsMessage: string;
begin
lsPrefix := '';
if (Pos('Exception', psMessage) > 0) or (Pos('Error', psMessage) > 0) then
begin
lsPrefix := 'Error:';
end;
if (piX < 0) or (piY < 0) then
begin
// format with no line and col
lsMessage := Format('%s %s %s', [psFile, lsPrefix, psMessage]);
end
else
begin
// format with a line and col
lsMessage := Format('%s(%s,%s) %s %s',
[psFile, IntToStr(piY), IntToStr(piX), lsPrefix, psMessage]);
end;
WriteLn(lsMessage);
end;
No output format switching code yet. When I run jcf on a file that isn't deplhi source, I get:
C:\Code\Jcf\Output>jcf -F dunit.ini
dunit.ini Formatting file dunit.ini
dunit.ini(1,1) Error: Exception TEParseError Expected program, package, library
, unit
Near [
dunit.ini Aborted due to error
Well, seems like ok. Not tested in real, yet.
Only one proposition - write full file name (with path, I mean).
Another thing - we have warning, AFAIK. It'll be useful to tag them similarly.
P.S. Can you commit it to svn? Or post a diff?
Thanks.
That code is checked in but commented out.
I have checked in some code - since looking through the message text to see if it contains "error" etc. is going to go wrong sometimes, I have changed the event proc signature to also take an enumerated message type which will tell you if it's an error, warning or what.
I'll look at including the path later.
With regards path, it seems that at present, what you give is what you get:
e.g.
C:\Code\Jcf\Output>jcf -F dunit.ini
dunit.ini(1,1) Error Exception TEParseError
or
C:\Code\Jcf\Output>jcf -F c:\code\Jcf\Output\dunit.ini
c:\code\Jcf\Output\dunit.ini(1,1) Error Exception TEParseError
Should the path always be expanded?
>> Should the path always be expanded?
Hm. I'm not sure, but it seems like current behaviour is correct. I'll check it and post back today :).
Thanks.
Tested. Seems like works like a charm. I like it !!! Thanks a lot.
Maybe it would be useful to include to jcf emacs option (free pascal error parsing regexp). Maybe to some kind of "extras\emacs" dir:
=======skipped================
(require 'compile)
(pushnew '("^\\([a-zA-Z0-9\\.]+\\)(\\([0-9]+\\),\\([0-9]+\\))\s\\(.*$\\)" 1 2 3)
compilation-error-regexp-alist)
=======skipped================
I forgot to mention - not meInputError, but mtInputError constant :) Please correct
oops! I had fixed that, but not checked it in yet. Done now.
I think that this format will be the only (or default?) layout.
>> I think that this format will be the only (or default?) layout.
Long live strong standarts :)
Hi
A patch would be excellent.