// SymbolContainer.hpp #ifndef SYMBOL_CONTAINER_HPP #define SYMBOL_CONTAINER_HPP #include "SymbolTable.hpp" namespace Symbols { class SymbolContainer { std::shared_ptr globalScope_; std::shared_ptr currentScope_; public: SymbolContainer() { globalScope_ = std::make_shared(); currentScope_ = globalScope_; } void enterScope() { currentScope_ = std::make_shared(currentScope_); } void leaveScope() { if (currentScope_->getParent()) { currentScope_ = currentScope_->getParent(); } } void define(const std::string& ns, const SymbolPtr& symbol) { currentScope_->define(ns, symbol); } SymbolPtr resolve(const std::string& ns, const std::string& name) const { return currentScope_->get(ns, name); } bool exists(const std::string& ns, const std::string& name) const { return currentScope_->exists(ns, name); } std::vector listNamespace(const std::string& ns) const { return currentScope_->listAll(ns); } std::shared_ptr getGlobalScope() const { return globalScope_; } std::shared_ptr getCurrentScope() const { return currentScope_; } }; } // namespace Symbols #endif