Handle parser exceptions correctly

Addresses lexer errors appearing on the wrong lines as mentioned in
issue #26