From: Bill Kelly Date: 2006-08-19T09:09:05+09:00 Subject: Re: Syntax checker wtf? From: "inboulder" > Matthew Smillie wrote: > >> >> Actually yes. Error identification and recovery in parsing is a >> difficult task to begin with, engineering it into an existing system >> is far from trivial. >> > > The compiler throws away the line # of the start of the expression it is > trying to evaluate? Keeping this # around and printing it out would be a > great step in improving the debug info. I wonder... 0001: class Foo 0002: 0003: def initialize 0004: # whatever 0005: end 0006: [...] 0347: def bar 0348: if @gargle 0349: puts "glug!" 0350: #end (missing end for if) 0360: end [...] 0415: 0416: end # of class Foo Now, the error message we'd like is that the 'end' is missing for the 'if' expression starting on line 348. But the parser did find an 'end' that paired up with the 'if', at line 360. And it found an 'end' for the 'def' at line 416. Ultimately, it reaches the end of the file, and is missing an 'end' for 'class Foo'. So, would "unexpected EOF, missing kEND from line 1" really be all that helpful? It seems like a missing 'end' would probably tend to be reported for whatever line the outermost class or module being compiled started on... (?) Regards, Bill