feat(frontends/lean/parser): display elaborator error messages

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-10-24 18:48:53 -07:00
parent ca6a6d71e5
commit df07a84d11

View file

@ -1522,13 +1522,23 @@ class parser::imp {
sync(); sync();
} }
void display_error(elaborator_exception const &) { struct lean_pos_info_provider : public pos_info_provider {
#if 0 imp const & m_ref;
// TODO(Leo) lean_pos_info_provider(imp const & r):m_ref(r) {}
display_error_pos(m_elaborator.get_original(ex.get_expr())); virtual std::pair<unsigned, unsigned> get_pos_info(expr const & e) const {
regular(m_frontend) << " " << ex << endl; expr const & o = m_ref.m_elaborator.get_original(e);
sync(); auto it = m_ref.m_expr_pos_info.find(o);
#endif if (it == m_ref.m_expr_pos_info.end())
throw exception("position is not available"); // information is not available
return it->second;
}
};
void display_error(elaborator_exception const & ex) {
formatter fmt = m_frontend.get_state().get_formatter();
options opts = m_frontend.get_state().get_options();
lean_pos_info_provider pos_provider(*this);
regular(m_frontend) << ex.get_justification().pp(fmt, opts, &pos_provider, true) << endl;
} }
void updt_options() { void updt_options() {