From: Markus Date: 2004-10-10T02:25:33+09:00 Subject: Re: quality of error messages On Sat, 2004-10-09 at 10:06, Brian Candler wrote: > On Sun, Oct 10, 2004 at 01:45:23AM +0900, Markus wrote: > > Instead, try to capture what they DON'T do, and store the location > > to use in the message if there turns out to be a problem. What don't > > they do? > > > > * They don't 'exdent' beyond the indentation of the line that > > started the present construct, except for comments & here docs, > > etc. which are already distinguished by the compiler. > > I think you're saying: warn (or note the location of) any line which has > fewer spaces at the front than the number of spaces which were in front of > the line which started the current (most deeply nested) construct. > > That seems OK to me; you won't get warnings for > def foo > line1 > line2 > line3 > end > > but we don't really care, as we're unlikely to have a missing 'end' here. Exactly. > > * They don't start a nested construct at the same indentation > > level of the present construct. > > I do :-( Especially for deeply-nested modules: to keep listings not too > deeply indented, I write > > module Foo > module Bar > class C1 > def m1 > end > end # class C1 > class C2 > def m2 > end > end # class C2 > end # module Bar > end # module Foo Good point. I have seen stuff like that. > > I suspect that this would be dirt simple to implement, especially > > compared to anything that required lookahead. > > You're probably right there. Good enough would do. After all, it's only a > hint when you get a 'syntax error' at the end of the file. > > Since you've been playing with the parser anyway, perhaps you can have a > look at it? :-) I might. I'm a little over committed at the moment, but I think I could sell my boss on the utility of it, in which case, *evil grin* ah, what to delegate.... It probably wouldn't be for a few weeks in any case though. -- Markus