Re: [Pyparsing] better parse error reporting
Brought to you by:
ptmcg
From: Gre7g L. <haf...@ya...> - 2008-04-09 16:35:05
|
--- "W. Martin Borgert" <de...@de...> wrote: > This patch is really helpful, many thanks! No problemo. > First, the performance penalty is very low, about 1% > for me. > > Second, the position of the error is now located > much more > accurate. Not 100% exact in my tests, but I can live > with that. Yeah this code locates the END of the last thing parsed and ideally you'd like the BEGINNING of the next thing. There's probably somewhere else you could stick the test, but I'm not sure where that would be. Perhaps Paul could suggest a better place to move the comparison code? In my code, I just start with this location and then skip over white space and comments and then reparse the next "word" I can find. That way I can report what I did not expect to encounter and where it was. Regardless, I would recommend doing that in your own code anyhow, since it wouldn't make much sense to add to pyparsing.py. Gre7g __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |