Re: Suboptimal error message
- Posted by "Juergen Luethje" <j.lue at gmx.de> May 20, 2005
- 393 views
Pete Lomax wrote: > On Wed, 18 May 2005 23:27:01 +0200, Juergen Luethje wrote: > >> Robert Craig wrote: >>>> Syntax error - expected to see possibly this ..., not a variable >> >> Uuhhh, I didn't know that. <scratching my head like Stan Laurel> >> Wouldn't it be better not to allow things like that? Or would that >> require heavy changes of the interpreter? > > FYI, the 2.4 error was > Syntax error - expected to see possibly '=', not a variable Ah, I see. > Of course all the code involved here is now public domain (eu.ex > and/or parser.e and/or and emit.e), albeit packaged specially. I really appreciate the Public Domain release of Eu in Eu. But the code is rather complex and not easy to understand for me. I probably should take a looong rainy Sunday afternoon to look at the code again. Unfortunately, currently the weather is fine here. > An interesting thing to attempt would be to backtrack at the error > point (add zero overhead in the non-error case, please), possibly > looking through the most recently added var names for something rather > suspicious (probably including user-defined types). I'm sure Rob would > thank you if you came up with something clever in that area. > > You might even get close to perfection here: point at the comma and > say "that comma should probably not be there"? (But I doubt it If it would be not allowed to use "object", "sequence", "atom" and "integer" as variable names (please see me other recent post in this thread) then I think this would be rather easy: Just when one of these four tokens is preceeded by a comma, Eu should throw exactly this error message. Because based on experience (AFAIK and IMHO, of course) this actually is the most probable cause. Regards, Juergen