On Wed, Apr 20, 2005 at 01:23:49AM +0200, Abigail wrote: > On Tue, Apr 19, 2005 at 04:26:28PM -0500, David Nicol wrote: > > > > could we extend the bit of code that gets quoted when a parsing failure > > is thrown to include the whole expression under consideration at the > > time rather than the last few tokens when things get impossible? > > > > The confusing situation occurs when there are a whole bunch of tokens > > preceding a normal if(expr){ what happens is, the error is reported as > > being near '){' when it is not. > > It's not? Placing a a semi-colon between the ')' and '{' makes it > valid syntax. Putting a ';' after 'comment', or placing a '#' before > 'poorly' also make it syntax, but it will be a bit hard to guess which > of the three mistakes the programmer made. >
Which, I believe, is why David suggests that the error include the whole expression, rather than just the last few tokens, so that *the programmer* can more easily figure out which mistake was made. Ronald