symbol.hpp (1002B)
1 #pragma once 2 3 #include <string> 4 #include <vector> 5 6 #include "symbol_type.hpp" 7 8 class Symbol { 9 public: 10 explicit Symbol(std::string name, SymbolType type, std::string data_type, int scope_level); 11 std::string getName(); 12 SymbolType getSymbolType(); 13 std::string getDataType(); 14 int getScopeLevel(); 15 bool isInitialized(); 16 void setInitialized(bool init); 17 bool isParameter(); 18 void setParameter(bool is_param); 19 std::vector<std::string> getParameterTypes(); 20 void setParameterTypes(std::vector<std::string> types); 21 std::string getReturnType(); 22 void setReturnType(std::string type); 23 int getLineDeclared(); 24 void setLineDeclared(int line); 25 std::string toString(); 26 27 private: 28 std::string symbol_name; 29 SymbolType symbol_type; 30 std::string data_type; 31 int scope_level; 32 bool is_initialized; 33 bool is_parameter; 34 std::vector<std::string> parameter_types; 35 std::string return_type; 36 int line_declared; 37 int column_declared; 38 };