Improved error handling so that parsing doesn't stop working
for the rest of the file when there's invalid syntax.