Hi,
On Thu, Jun 02, 2011 at 09:14:10AM +0000, Szymczyk, Jacek Janusz (HP Labs -
Fusionopolis, South Twr #14 floor) wrote:
> The good news is I got the Fyzz working.
Good.
> In which case, could you give me a hint how to quickly test AST for parsing
> errors if they occurred.
> So when I invoke:
> ast = parse(query)
> what I need to check to determine that the parse passed OK ?
If the query got parsed correctly, parse returns the abstract syntax
tree.
Otherwise, a FyzzParserError exception is raised.
Try this::
from fyzz import parse, FyzzParserError
for query in (good_query, bad_query):
try:
ast = parse(query)
except FyzzParserError, err:
print 'Error:', err, 'for query', query
Let us know how it goes.
--
Nicolas Chauvat
logilab.fr - services en informatique scientifique et gestion de connaissances
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects