Revert "Leak-fix: clean up lexer state after parsing."

This reverts commit 921e1d8b5f42137c5f80643e4e11f2921e0e3c22.
Add test for failed_returncodes

When kept_returncodes or repaired_returncodes are specified
failed_returncode is not defaulted properly.
Merge pull request #1736 from nickanderson/redmine/5987

Add test for failed_returncodes