The file type checking is quite error-prone. I suggest simplifying the interface with a function check_file for each parser.
check_file