73 lines
1.3 KiB
C++
73 lines
1.3 KiB
C++
#include "elna/source/symboltable.hpp"
|
|
|
|
namespace elna::source
|
|
{
|
|
std::shared_ptr<info> symbol_table::lookup(const std::string& name)
|
|
{
|
|
auto entry = entries.find(name);
|
|
if (entry == entries.cend())
|
|
{
|
|
return nullptr;
|
|
}
|
|
else
|
|
{
|
|
return entry->second;
|
|
}
|
|
}
|
|
|
|
void symbol_table::enter(const std::string& name, std::shared_ptr<info> entry)
|
|
{
|
|
entries.insert_or_assign(name, entry);
|
|
}
|
|
|
|
info::~info()
|
|
{
|
|
}
|
|
|
|
info::info()
|
|
{
|
|
}
|
|
|
|
constant_info::constant_info(const std::int32_t value)
|
|
: m_value(value)
|
|
{
|
|
}
|
|
|
|
constant_info::~constant_info()
|
|
{
|
|
}
|
|
|
|
std::int32_t constant_info::value() const noexcept
|
|
{
|
|
return m_value;
|
|
}
|
|
|
|
variable_info::~variable_info()
|
|
{
|
|
}
|
|
|
|
void name_analysis_visitor::visit(source::definition *definition)
|
|
{
|
|
}
|
|
|
|
void name_analysis_visitor::visit(source::bang_statement *statement)
|
|
{
|
|
}
|
|
|
|
void name_analysis_visitor::visit(source::block *block)
|
|
{
|
|
}
|
|
|
|
void name_analysis_visitor::visit(source::integer_literal *number)
|
|
{
|
|
}
|
|
|
|
void name_analysis_visitor::visit(source::variable_expression *variable)
|
|
{
|
|
}
|
|
|
|
void name_analysis_visitor::visit(source::binary_expression *expression)
|
|
{
|
|
}
|
|
}
|