[Pyparsing] Get Better Error Messages - Prevent Backtracking
Brought to you by:
ptmcg
From: Ken K. <ksk...@gm...> - 2008-04-20 02:47:03
|
Hi.. I'm a new pyparsing user, and I just wanted to comment on Eike Welk's recent proposal [1] to improve error messages by stopping backtracking at defined points using a "ErrStop" ParserElement. It's awesome. Totally flipping awesome. I'd beat my head against the wall for a couple of hours before I stumbled on it & was instantly relieved. I've posted a diff of the simpleSQL.py example to the pastebin [2] that shows a use of ErrStop on a statement that was previously happily accepted ("select * from table1 where a b" -- note the missing operator). The diff assumes that ErrStop has been added to pyparsing. Thanks Eike for the solution, and to Paul for the excellent package! -ken PS: Sorry for creating a new thread.. I don't know how to continue the old one when I wasn't a list member until just now. PSS: Since the docs & examples aren't in the svn repos, the diff is against what was in the 1.4.11 tarball. [1] http://sourceforge.net/mailarchive/message.php?msg_name=200804140116.37166.eike.welk%40gmx.net [2] http://pastebin.com/f25124b32 |