Add ParserError

Adapt parser to throw ParserError (lib/parser_error.js)
instances instead of strings. Pass reason and details as
properties.