2013-08-08 02:10:12 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
2013-08-17 00:11:24 +00:00
|
|
|
#include "context.h"
|
2013-08-08 02:10:12 +00:00
|
|
|
|
|
|
|
namespace lean {
|
2013-08-17 00:11:24 +00:00
|
|
|
class frontend;
|
|
|
|
class expr_formatter {
|
|
|
|
public:
|
|
|
|
virtual ~expr_formatter() {}
|
|
|
|
/** \brief Convert expression in the given context into a format object. */
|
|
|
|
virtual format operator()(expr const & e, context const & c = context()) = 0;
|
|
|
|
/** \brief format a definition. */
|
|
|
|
virtual format operator()(char const * kwd, name const & n, expr const & t, expr const & v);
|
|
|
|
/** \brief format a postulate. */
|
|
|
|
virtual format operator()(char const * kwd, name const & n, expr const & t);
|
|
|
|
|
|
|
|
/** \brief Return options for pretty printing. */
|
|
|
|
virtual options get_options() const = 0;
|
|
|
|
|
|
|
|
void pp(std::ostream & out, expr const & e, context const & c);
|
|
|
|
void pp(std::ostream & out, expr const & e);
|
|
|
|
|
|
|
|
/** \brief Nest the given format object using the setting provided by get_options. */
|
|
|
|
format nest(format const & f);
|
|
|
|
};
|
2013-08-16 01:54:01 +00:00
|
|
|
std::shared_ptr<expr_formatter> mk_pp_expr_formatter(frontend const & fe, options const & opts);
|
2013-08-08 02:10:12 +00:00
|
|
|
}
|