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-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 {
|
|
|
|
enum class entry_kind { Declaration, Reference };
|
2014-08-23 19:39:59 +00:00
|
|
|
typedef std::tuple<entry_kind, std::string, pos_info, name, name, expr> entry;
|
2014-08-15 00:44:07 +00:00
|
|
|
std::vector<entry> m_entries;
|
|
|
|
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-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
|
|
|
};
|
|
|
|
}
|