Improve error messages

Replace fileinput with a custom class that allows error messages to
show filename and line number.