Move print_parse_failure from parse to dbg.

Also some minor cleanup in parse.py.