<commit_before>// symbol_table.cpp
// Copyright (C) 2015 <NAME> <<EMAIL>>
//
// Distributed under terms of the MIT license.

#include "./symbol_table.h"

#include <map>

#include "./hash_map.h"
#include "./string.h"
#include "./vector.h"
#include "./nodes/program_nodes.h"

namespace SymbolTable {
static String current_table_;
static HashMap<String, HashMap<String, int, StringHash<String>>*,
               StringHash<String>>* symbol_table_;
static HashMap<String, DefunNode*, StringHash<String>>* function_list_;

void Initialize() {
  symbol_table_ = new HashMap<String, HashMap<String, int, StringHash<String>>*,
                              StringHash<String>>;
  symbol_table_->Put(String("main"),
                     new HashMap<String, int, StringHash<String>>);
  current_table_ = String{"main"};

  function_list_ = new HashMap<String, DefunNode*, StringHash<String>>;
}

void AddSymbol(String name, int value) {
  if (symbol_table_->Get(current_table_)->ContainsKey(name)) {
    printf("variable %s incorrectly re-initialiezd\n", name.c_str());
  }
  symbol_table_->Get(current_table_)->Put(name, value);<commit_msg>Removed STL Map<commit_after>// symbol_table.cpp
// Copyright (C) 2015 <NAME> <<EMAIL>>
//
// Distributed under terms of the MIT license.

#include "./symbol_table.h"

#include "./hash_map.h"
#include "./string.h"
#include "./vector.h"
#include "./nodes/program_nodes.h"

namespace SymbolTable {
static String current_table_;
static HashMap<String, HashMap<String, int, StringHash<String>>*,
               StringHash<String>>* symbol_table_;
static HashMap<String, DefunNode*, StringHash<String>>* function_list_;

void Initialize() {
  symbol_table_ = new HashMap<String, HashMap<String, int, StringHash<String>>*,
                              StringHash<String>>;
  symbol_table_->Put(String("main"),
                     new HashMap<String, int, StringHash<String>>);
  current_table_ = String{"main"};

  function_list_ = new HashMap<String, DefunNode*, StringHash<String>>;
}

void AddSymbol(String name, int value) {
  if (symbol_table_->Get(current_table_)->ContainsKey(name)) {
    printf("variable %s incorrectly re-initialiezd\n", name.c_str());
  }
  symbol_table_->Get(current_table_)->Put(name, value);
{'fraction_non_alphanumeric': 0.14902135231316727, 'fraction_numerical': 0.0035587188612099642, 'mean_word_length': 4.2546728971962615, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5348811', 'n_tokens_mistral': 694, 'n_tokens_neox': 675, 'n_words': 155}