Refine initialization order. Polish Universe command pretty printer.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-08-16 09:30:08 -07:00
parent 4560527058
commit 1038f7346e
3 changed files with 4 additions and 5 deletions

View file

@ -195,8 +195,7 @@ struct frontend::imp {
void add_mixfixc(unsigned sz, name const * opns, unsigned p, name const & n) { add_op(mixfixc(sz, opns, p), n, false); } void add_mixfixc(unsigned sz, name const * opns, unsigned p, name const & n) { add_op(mixfixc(sz, opns, p), n, false); }
imp(frontend & fe): imp(frontend & fe):
m_num_children(0), m_num_children(0) {
m_env(mk_toplevel()) {
} }
explicit imp(std::shared_ptr<imp> const & parent): explicit imp(std::shared_ptr<imp> const & parent):
@ -214,6 +213,7 @@ struct frontend::imp {
frontend::frontend():m_imp(new imp(*this)) { frontend::frontend():m_imp(new imp(*this)) {
init_builtin_notation(*this); init_builtin_notation(*this);
init_toplevel(m_imp->m_env);
m_imp->m_env.set_formatter(mk_pp_expr_formatter(*this, options())); m_imp->m_env.set_formatter(mk_pp_expr_formatter(*this, options()));
} }
frontend::frontend(imp * new_ptr):m_imp(new_ptr) {} frontend::frontend(imp * new_ptr):m_imp(new_ptr) {}

View file

@ -29,7 +29,7 @@ public:
static char const * g_keyword; static char const * g_keyword;
virtual char const * keyword() const { return g_keyword; } virtual char const * keyword() const { return g_keyword; }
virtual format pp(environment const &) const { virtual format pp(environment const &) const {
return format{format(keyword()), space(), format(m_name), space(), format("\u2265"), space(), ::lean::pp(m_level)}; return format{highlight_command(format(keyword())), space(), format(m_name), space(), format("\u2265"), space(), ::lean::pp(m_level)};
} }
}; };
char const * uvar_declaration::g_keyword = "Universe"; char const * uvar_declaration::g_keyword = "Universe";

View file

@ -48,8 +48,7 @@ static void tst2() {
static void tst3() { static void tst3() {
frontend f; frontend f;
f.add_infixl("+", 10, name{"Int", "add"}); std::cout << "====================\n";
f.add_infixl("-", 10, name{"Int", "sub"});
std::cout << f; std::cout << f;
} }