2014-08-06 22:25:28 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
2014-08-07 01:10:33 +00:00
|
|
|
#include <vector>
|
2014-08-06 22:25:28 +00:00
|
|
|
#include "kernel/expr.h"
|
2014-08-14 17:37:24 +00:00
|
|
|
#include "kernel/metavar.h"
|
2014-08-06 22:25:28 +00:00
|
|
|
#include "library/io_state_stream.h"
|
|
|
|
|
|
|
|
namespace lean {
|
2014-10-23 17:40:07 +00:00
|
|
|
class proof_state;
|
2014-08-06 22:25:28 +00:00
|
|
|
class info_manager {
|
2014-08-17 19:14:42 +00:00
|
|
|
struct imp;
|
|
|
|
std::unique_ptr<imp> m_ptr;
|
2014-08-06 22:25:28 +00:00
|
|
|
public:
|
|
|
|
info_manager();
|
2014-08-17 19:14:42 +00:00
|
|
|
~info_manager();
|
|
|
|
|
|
|
|
void add_type_info(unsigned l, unsigned c, expr const & e);
|
2014-09-03 18:52:35 +00:00
|
|
|
void add_extra_type_info(unsigned l, unsigned c, expr const & e, expr const & t);
|
2014-08-17 19:14:42 +00:00
|
|
|
void add_synth_info(unsigned l, unsigned c, expr const & e);
|
|
|
|
void add_overload_info(unsigned l, unsigned c, expr const & e);
|
2014-09-10 00:44:19 +00:00
|
|
|
void add_overload_notation_info(unsigned l, unsigned c, list<expr> const & a);
|
2014-09-03 16:34:13 +00:00
|
|
|
void add_coercion_info(unsigned l, unsigned c, expr const & e, expr const & t);
|
2014-09-03 01:39:06 +00:00
|
|
|
void erase_coercion_info(unsigned l, unsigned c);
|
2014-08-17 22:06:46 +00:00
|
|
|
void add_symbol_info(unsigned l, unsigned c, name const & n);
|
|
|
|
void add_identifier_info(unsigned l, unsigned c, name const & full_id);
|
2014-10-23 17:40:07 +00:00
|
|
|
void add_proof_state_info(unsigned l, unsigned c, proof_state const & e);
|
2014-09-03 18:52:35 +00:00
|
|
|
|
2014-08-17 19:14:42 +00:00
|
|
|
void instantiate(substitution const & s);
|
2014-09-03 18:52:35 +00:00
|
|
|
|
2014-08-27 01:06:37 +00:00
|
|
|
void merge(info_manager const & m, bool overwrite);
|
2014-08-17 19:14:42 +00:00
|
|
|
void insert_line(unsigned l);
|
|
|
|
void remove_line(unsigned l);
|
|
|
|
void invalidate_line(unsigned l);
|
2014-08-28 04:09:52 +00:00
|
|
|
void invalidate_line_col(unsigned l, unsigned c);
|
2014-08-17 19:14:42 +00:00
|
|
|
void commit_upto(unsigned l, bool valid);
|
2014-08-30 01:12:22 +00:00
|
|
|
void set_processed_upto(unsigned l);
|
2014-08-17 19:14:42 +00:00
|
|
|
bool is_invalidated(unsigned l) const;
|
2014-08-27 01:06:37 +00:00
|
|
|
void save_environment_options(unsigned l, environment const & env, options const & o);
|
|
|
|
optional<pair<environment, options>> get_final_env_opts() const;
|
2014-09-02 19:57:20 +00:00
|
|
|
optional<pair<environment, options>> get_closest_env_opts(unsigned linenum) const;
|
2014-09-03 08:35:04 +00:00
|
|
|
optional<expr> get_type_at(unsigned line, unsigned col) const;
|
|
|
|
optional<expr> get_meta_at(unsigned line, unsigned col) const;
|
2014-08-17 19:14:42 +00:00
|
|
|
void clear();
|
2014-09-04 21:02:53 +00:00
|
|
|
void display(environment const & env, io_state const & ios, unsigned line,
|
|
|
|
optional<unsigned> const & col = optional<unsigned>()) const;
|
2014-09-15 17:25:07 +00:00
|
|
|
/** \brief Block new information from being inserted into this info_manager.
|
|
|
|
\remark #start_iteration unblocks it.
|
|
|
|
*/
|
|
|
|
void block_new_info();
|
|
|
|
/** \breif Mark the start of a new information collection cycle.
|
|
|
|
It also enables new information to be added, i.e., it will undo
|
|
|
|
the effect of #block_new_info.
|
|
|
|
*/
|
2014-09-18 23:51:59 +00:00
|
|
|
void start_from(unsigned l);
|
2014-09-02 19:57:20 +00:00
|
|
|
unsigned get_processed_upto() const;
|
2014-08-06 22:25:28 +00:00
|
|
|
};
|
2014-09-23 17:00:36 +00:00
|
|
|
void initialize_info_manager();
|
|
|
|
void finalize_info_manager();
|
2014-08-06 22:25:28 +00:00
|
|
|
}
|