Forums

file.cobra(11): error: twice in error messages.

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

file.cobra(11): error: twice in error messages.

Postby nevdelap » Sun Jul 04, 2010 7:17 am

Hi Chuck. I searched for "error twice", couldn't think of anything, maybe it's already been touched on...

I wonder why the duplication of filename, line number and "error:" in error messages that want to tell us the column?
test.cobra(11): error: test.cobra(11,1): error: Cannot mix tabs and...

rather than...
test.cobra(11,1): error: Cannot mix tabs and...
call me Nev.
nevdelap
 
Posts: 61
Location: Buenos Aires

Re: file.cobra(11): error: twice in error messages.

Postby Charles » Sun Jul 04, 2010 9:36 am

Looks like a bug. Other errors I tried don't have this problem, so it may only be happening for errors generated by the parser. Another ticket, please. :-D
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: file.cobra(11): error: twice in error messages.

Postby nevdelap » Mon Jul 05, 2010 3:35 pm

Done. I'd thought it might have something to do with tools reading the compiler output so I wanted to check before ticketing. #212.
call me Nev.
nevdelap
 
Posts: 61
Location: Buenos Aires

Re: file.cobra(11): error: twice in error messages.

Postby hopscc » Thu Jul 08, 2010 4:05 am

patch for this on the ticket (ticket:212)
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: file.cobra(11): error: twice in error messages.

Postby Charles » Thu Jul 08, 2010 2:13 pm

This bug is now fixed and ticket is closed.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: file.cobra(11): error: twice in error messages.

Postby hopscc » Fri Jul 09, 2010 9:35 am

The fix dropped display of column number an error was detected on (where available) - probably an unintended regression
nevdelap discovered and reported against ticket.

I reopened the ticket and posted a patch that continues to provide the column info if available.
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: file.cobra(11): error: twice in error messages.

Postby Charles » Fri Jul 09, 2010 2:02 pm

I vaguely recall not reporting column info in Cobra errors early on because Cobra wasn't counting out the tabs, so the column didn't really match what I saw in my editor. Maybe we added that at some point and I've forgotten. Are those column numbers correct in your editor?
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: file.cobra(11): error: twice in error messages.

Postby hopscc » Sat Jul 10, 2010 3:30 am

Yeah pretty much.
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: file.cobra(11): error: twice in error messages.

Postby Charles » Sun Jul 11, 2010 7:44 pm

When I try an error from one of the binding phases like "x = badname", I get:

foo.cobra(5): error: Cannot find "badname".

I'm now more certain that column info was left out because it does match editors. When I'm three tabs over, my editors tell me I'm on column 13, not 4 which is what Cobra would tell me.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: file.cobra(11): error: twice in error messages.

Postby hopscc » Sun Jul 11, 2010 11:07 pm

Presumably you mean 'does not match editors'.

Cobra cant ever be correct for this (without talking to your editor) because it depends on what your tab expansion is set to in your editor
- at best if you want to try and virtualise this you assume a tab expansion of 4 (which is what cobra seems to equate with spaces ) and accumulate a Tab count and multiply the number of Tabs by that
- fine if it is correct to the editor settings really confusing if not. And I'm sure I'm not the only one who just loves it when a compiler lies to you.....

On the other hand you could do what every compiler has done since the first one was carved from primordial mud and just quote the character count offset from the start of the line (4 in your example)
and assume the user/developer can work it out.

Most serious programming editors have a mode or command that will give you this on a line (char offset vs display offset) -
Its just one of the things you have to know how to handle if you use/allow Tabs in source code...

Its still needed because it gives the user at least an inkling to exactly where on a line the compiler thinks it detected the problem which may or may not be obvious from the rest of the error message....
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Next

Return to Discussion

Who is online

Users browsing this forum: No registered users and 14 guests