fxos/lib/symbols.cpp

32 lines
497 B
C++

#include <fxos/symbols.h>
namespace FxOS {
void SymbolTable::add(Symbol s)
{
symbols.push_back(s);
}
std::optional<std::string> SymbolTable::query(Symbol::Type type,
uint32_t value) const
{
for(auto &sym: symbols)
{
if(sym.type == type && sym.value == value) return sym.name;
}
return std::nullopt;
}
std::optional<Symbol> SymbolTable::lookup(std::string name) const
{
for(auto &sym: symbols)
{
if(sym.name == name) return sym;
}
return std::nullopt;
}
} /* namespace FxOS */