From: David Flanagan Date: 2007-10-24T04:15:05+09:00 Subject: Re: Improving 'syntax error, unexpected $end, expecting kEND'? The patch below changes this message to: syntax error, unexpected "end-of-file", expecting "end" It doesn't tell you where the outermost open block begins, but at least the message isn't so cryptic. I don't know any way to get rid of the quotes around "end-of-file". David Index: parse.y =================================================================== --- parse.y (revision 13760) +++ parse.y (working copy) @@ -596,6 +596,7 @@ /*% %token %*/ + end_of_file 0 "end-of-file" keyword_class keyword_module keyword_def @@ -603,7 +604,7 @@ keyword_begin keyword_rescue keyword_ensure - keyword_end + keyword_end "end" keyword_if keyword_unless keyword_then Hugh Sasse wrote: > I've had a look at this, but can't see how to do it: When I get > syntax error, unexpected $end, expecting kEND > I know from experience that $end means "end of file" and kEND means > the lexical token "end". What I can't figure out from reading > parse.c is how the stack works and how the rules are stored. I think > knowing if it was expecting the 'end' from a 'class', 'def', 'begin' > 'while', 'for', 'do', 'if', 'unless' or 'case' would help me narrow > down where I've failed to have a closing "end". If there's line > number information that would be even better. Indentation has not > solved this for me. > > So is this too difficult, which is why is hasn't happened already? > > Meanwhile I'll just break up my program into smaller bits. > > Thank you, > Hugh >