From: Brian Candler Date: 2004-10-07T05:13:39+09:00 Subject: Re: quality of error messages On Thu, Oct 07, 2004 at 04:30:38AM +0900, Charles Hixson wrote: > Perhaps not in that precise area, however when a block isn't close the > error message should indicate the starting line of the unclosed block, > instead of just mentioning a line one past the last line of the file. I think that what you're asking for, is not what you actually want. Consider: class A def m1 end def m2 end def m3(x) if x == 3 puts "hello" end end class B def m1 end def m2 end end The error is obvious to you, right? But because identation is not signficant in Ruby, the parser will read it as: class A def m1 end def m2 end def m3(x) if x == 3 puts "hello" end end class B # nested class definition (A::B) def m1 end def m2 end end # missing 'end' error reported here So where is the starting line of the unclosed block? As far as Ruby is concerned, it is line 1 ('class A'). Unfortunately, that doesn't help you locate the error at all. > I have grown quite paranoid about creating large chunks of code between > tests... And large here can mean only fixing more than five errors in > one pass. Yeah, I understand that, hence my divide-and-conquer strategy for dealing with broken files. An auto-indenter would help lots though; if one existed as a standalone program (i.e. not part of emacs or whatever) I'm sure I'd use it. Perhaps 1.9 with its userland parser will be able to do this. Regards, Brian.