Load symbols from the json

This commit is contained in:
2026-05-19 19:35:52 +02:00
parent 7eee6a08c8
commit 3e3330b046

View File

@@ -3,6 +3,9 @@
#include <string> #include <string>
#include <cctype> #include <cctype>
#include <map> #include <map>
#include <fstream>
#include <nlohmann/json.hpp>
// Comp map // Comp map
const std::map<std::string, std::string> compMap = { const std::map<std::string, std::string> compMap = {
@@ -92,7 +95,14 @@ static inline std::string strip(const std::string &s) {
return result; return result;
} }
using symbolsMap = std::map<std::string, int>;
int main() { int main() {
// Load predefined symbols
std::ifstream file("./symbols.json");
nlohmann::json symbols_json = nlohmann::json::parse(file);
symbolsMap symbols_map = symbols_json.get<symbolsMap>();
std::string line; std::string line;
while (std::getline(std::cin, line)) { while (std::getline(std::cin, line)) {
line = trim(line); line = trim(line);