public SymbolTable(SymbolTable theParentScope) { parentScope = theParentScope; theVariableTable = new Dictionary<string, Symbol>(); theMethodTable = new Dictionary<string, Symbol>(); theStructDeclTable = new Dictionary<string, Symbol>(); }
/// <summary> /// Initializes a new scopemanager instance /// </summary> public ScopeManager(SymbolTable theCurrentScope) { currentScope = theCurrentScope; }
/// <summary> /// Initializes a new scope manager instance /// </summary> public ScopeManager() { currentScope = new SymbolTable(); }
/// <summary> /// Pushes a certain symboTable as the current scope. /// </summary> /// <param name="theTable"></param> internal void PushSymbolTable(SymbolTable theTable) { currentScope = new SymbolTable(theTable); }
/// <summary> /// Gets and pops the current scope /// </summary> /// <returns>The current scope</returns> internal SymbolTable GetAndExitScope() { currentScope = currentScope.getEnclosingScope(); return currentScope; }
/// <summary> /// Creates a new scope and sets it as the current scope /// </summary> internal void EnterScope() { currentScope = new SymbolTable(currentScope); }