2014-08-15 00:44:07 +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
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
#include <utility>
|
|
|
|
#include <string>
|
|
|
|
#include "util/name.h"
|
2014-09-04 14:42:18 +00:00
|
|
|
#include "util/name_map.h"
|
2014-08-23 19:39:59 +00:00
|
|
|
#include "kernel/expr.h"
|
2014-08-15 00:44:07 +00:00
|
|
|
#include "kernel/pos_info_provider.h"
|
2014-08-23 19:39:59 +00:00
|
|
|
#include "library/io_state_stream.h"
|
2014-08-15 00:44:07 +00:00
|
|
|
|
|
|
|
namespace lean {
|
|
|
|
/** \brief Datastructure for storing where a given declaration was defined. */
|
|
|
|
class declaration_index {
|
2014-09-04 14:42:18 +00:00
|
|
|
typedef std::tuple<std::string, pos_info, name, expr> decl;
|
|
|
|
typedef std::tuple<std::string, pos_info, name> ref;
|
2014-09-04 16:30:25 +00:00
|
|
|
typedef pair<name, name> abbrev;
|
|
|
|
name_map<decl> m_decls;
|
|
|
|
std::vector<abbrev> m_abbrevs;
|
|
|
|
std::vector<ref> m_refs;
|
2014-08-15 00:44:07 +00:00
|
|
|
public:
|
2014-08-23 19:39:59 +00:00
|
|
|
void add_decl(std::string const fname, pos_info const & p, name const & n, name const & k, expr const & t);
|
2014-09-04 16:30:25 +00:00
|
|
|
void add_abbrev(name const & n, name const & d);
|
2014-08-15 00:44:07 +00:00
|
|
|
void add_ref(std::string const fname, pos_info const & p, name const & n);
|
2014-08-23 19:39:59 +00:00
|
|
|
void save(io_state_stream const & out) const;
|
2014-08-15 00:44:07 +00:00
|
|
|
};
|
|
|
|
}
|