Configure the Regular Expressions for errors and warnings

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
HardyPill
Posts: 13
Joined: Wed Feb 09, 2005 12:58 pm
Location: Germany

Configure the Regular Expressions for errors and warnings

Post by HardyPill »

Hi,

is there somebody, who can help me to configure the Regular Expressions for errors and warnings. Here is an sample of the compiler output.
It seems that the difference between error and warning lines is (Warning only).
:FE:MCM.C:3623: Illegal structure selector
:FE:MCM.C:3623: Lvalue required
:FE:MCM.C:3625: Illegal structure selector
:FE:MCM.C:3625: Lvalue required
:FE:MCM.C:3667: Illegal structure selector
:FE:MCM.C:3667: Lvalue required
:FE:MCM.C:3669: Illegal structure selector
:FE:MCM.C:3669: Lvalue required
:FE:MCM.C:3385: "bTmp4" never referenced (Warning only)
:FE:MCM.C:3385: "bTmp3" never referenced (Warning only)
:FE:MCM.C:3385: "bTmp2" never referenced (Warning only)
:FE:MCM.C:3385: "bTmp1" never referenced (Warning only)
All C compiler error messages have the following format:
:XX:name.c:nnn:message
XX identifies the compiler phase
PP = Pre-processor
FE = Front End
OP = Optimizer
BE = Back End
name.c is the name of the source file with the error.
nnn is the line number.
message is a description of the error.

Maybe I only need a regex starting with : and having not (Warning only) in the line for the ERROR regex. For the WARNING regex I think that I need the same regex but with the (Warning only) in the line...


Regards
Michael
Guest

Post by Guest »

Hi Michael,

Here is what I did to come up with what I think is a suitable regular expression:

Step 1
I pasted the sample error message text to a new Zeus document.

Step 2
Based on the :XX: format rule I came up with this :[BFEOP]+: search string.

Step 3
Using the Zeus Edit, Find menu I can test the this regular expression against the sample error output and sure enough it highlights the first four characters of the line.

This regular expression should work just fine as an error regexp but I can improve on it by making it search for more characters, meaning there is less chance of a false alarm.

Step 4
So I just build on the expression to come up with this :[BFEOP]+:.+:[0-9]+: search string.

Once again I can use the Edit, Find menu to test the string and sure enough it highlights the entire rule section of the line of error. If I then add some random lines of text to the test document an repeat the search test, the regexp ignores these other lines. This is a good indication that the regexp is working as it is only detecting lines that look like errors.

Step 5
Finally I can build on this errors string to produce a warning regexp by searching for the extra (Warning only) marker. Doing so I come up with this :[BFEOP]+:.+:[0-9]+:.+(Warning only) string.

Here is a breakdown of how to read these regexp strings:
  • [BFEOP]+ Find at least one string made up of the B,F,E,O or P characters
  • : Find the : character
  • .+: Find any character up to an including the next : character
  • [0-9]+: Find at least one string made up of the characters 0 thru 9 followed by the : character
Jussi
HardyPill
Posts: 13
Joined: Wed Feb 09, 2005 12:58 pm
Location: Germany

Post by HardyPill »

Hi Jussi,

Thanks for your quick reply. Here is the result of my test:

If I enter in the Errors regex
:[BFEOP]+:.+:[0-9]+:.
and in the Warning regex
:[BFEOP]+:.+:[0-9]+:.+(Warning only)
the result is, that both a error line and a warning line occur in red (error color). Is there a regex possibility to except the (Warning only) string?

Remark:
The other Regex fields are left empty (like Lines regex, Filename regex...)

Regards
Michael
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Is there a regex possibility to except the (Warning only) string?
In my original reply I thought this would be possible, but after a bit more investigation I can now see that is is not :(

The Zeus error/warning coloring system uses a simple logic which basically comes down to this:

Code: Select all

If the string for the error/warning is found on the line then paint it using the error/warning color.
But the problem in this case is there is no search string that uniquely identifies an error from a warning. Consider the errors which are defined to look like this:

Code: Select all

:CODE:FILENAME:LINE NUMBER: Then some other text
which can represented by the :[BFEOP]+:.+:[0-9]+: regular expression.

The problem is a typical warning message like this:

Code: Select all

:FE:MCM.C:3385: "bTmp4" never referenced (Warning only)
is in fact nothing more than an error message where the some other text is defined as "bTmp4" never referenced (Warning only).

Jussi
Post Reply