Ferenc Engard wrote:

> I have a large ruby project (>40 files, >10k rows), and whenever I make
> a syntax error somewhere (e.g. swap an 'end' and a '}' token), I always
> get the same error, dozens of files away, in an END block, that a given
> constant is not defined.
> 
> Isn't it possible to detect such errors by the parser/lexer, and give a
> helpful error message?

I'm not sure if this fixes specifically your error, but for a patch that 
makes error messages for missing "end"s more informative see 
[ruby-talk:115195] and [ruby-core:03486]

The patch is available at 
http://www.reality.com/roberts/markus/software/ruby/location_of_missing_end/missing_end_patch.0.1.diff