aboutsummaryrefslogtreecommitdiff
path: root/src/scope.cpp
diff options
context:
space:
mode:
authorCori Barker <coribarker2@gmail.com>2026-03-07 18:33:21 +0000
committerCori Barker <coribarker2@gmail.com>2026-03-07 18:33:21 +0000
commit50a51df0404ee4f057fbc19657672d1c7d3eef68 (patch)
tree9cb9ed4572a357448f2b78c4ac0add7eaf6a1e7e /src/scope.cpp
parent6761fdd434a7e54551fe28398361f9eed5268406 (diff)
removed implementations of symbol table related classes, need to fix the parser to use the new AST node classes then i can write the symbol table classes and refactor the lexer and parser to use the symbol table
Diffstat (limited to 'src/scope.cpp')
-rw-r--r--src/scope.cpp52
1 files changed, 0 insertions, 52 deletions
diff --git a/src/scope.cpp b/src/scope.cpp
deleted file mode 100644
index 86e2668..0000000
--- a/src/scope.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "scope.hpp"
-
-Scope::Scope(std::string name, int level, std::unique_ptr<Scope> parent) : scope_name(name), scope_level(level), parent_scope(parent) {}
-
-std::string Scope::getScopeName() {
- return scope_name;
-}
-
-int Scope::getScopeLevel() {
- return scope_level;
-}
-
-std::unique_ptr<Scope> Scope::getParentScope() {
- return parent_scope;
-}
-
-void Scope::define(Symbol symbol) {
- if (isDeclared(symbol->getName())) {
- // error
- }
-
- else {
- symobls.add(symbol->getName(), symbol);
- }
-}
-
-std::unique_ptr<Symbol> Scope::lookup(std::string name) {
- auto it = symbols.find(name);
- if (it != symbols.end()) {
- return &(it->second);
- }
-
- return nullptr;
-}
-
-bool Scope::isDeclared(std::string name) {
- return lookup(name) != nullptr;
-}
-
-std::unordered_map<std::string, Symbol> Scope::getAllSymbols() {
- return symbols;
-}
-
-std::string Scope::toString() {
- std::string result = "Scope: " + scope_name + "(level " + std::to_string(scope_level) + ") \n";
-
- for (auto& pair : symbols) {
- result += " " + pair.first + " : " + pair.second.getDataType() + "\n";
- }
-
- return result;
-}