[Pyparsing] Unparsed cruft
Brought to you by:
ptmcg
From: Gre7g L. <haf...@ya...> - 2008-03-08 17:21:47
|
My parser seems to parse everything correctly in a well-formed source file, which is great, but it seems to stumble a bit if the user's input is imperfect. Here's an example link: http://pastie.textmate.org/163282 This example tries to parse an invalid expression. The input is "x + 5 y" and it returns [['x', '+', 5]]. So it's able to handle everything that is well-formed, but instead of throwing an exception when it hits the part it can't parse, it just returns. This would be real problematic for me. If I can't parse all of the user's program, I need to know that instead of thinking that compilation was successful. Is there some way to determine how much of the string was actually parsed, or to force an exception if the string cannot be parsed in its entirety? Thanks, Gre7g __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |