From 5d57361bacf4d816206000612010a8095bd67e44 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Wed, 25 Sep 2019 10:42:00 +0200
Subject: [PATCH] Improve code readability for SymbolTable manipulation

Actually replaced the vector of pairs or (string/Attributes), by a vector of
Symbol. Symbol is a simple new class to give better readability than ->first and
->second access.
---
 src/language/ASTNodeDataTypeBuilder.cpp       |  8 +-
 .../ASTSymbolInitializationChecker.cpp        | 10 +--
 src/language/ASTSymbolTableBuilder.cpp        |  2 +-
 src/language/SymbolTable.hpp                  | 56 +++++++++++--
 .../node_processor/AffectationProcessor.hpp   |  2 +-
 .../AffectationToStringProcessor.hpp          |  2 +-
 .../IncDecExpressionProcessor.hpp             |  2 +-
 src/language/node_processor/NameProcessor.hpp |  2 +-
 tests/test_ASTSymbolInitializationChecker.cpp | 24 +++---
 tests/test_AffectationProcessor.cpp           | 54 ++++++-------
 tests/test_AffectationToStringProcessor.cpp   | 54 ++++++-------
 .../test_BinaryExpressionProcessor_utils.hpp  | 54 ++++++-------
 tests/test_ConcatExpressionProcessor.cpp      | 54 ++++++-------
 tests/test_DoWhileProcessor.cpp               | 54 ++++++-------
 tests/test_ForProcessor.cpp                   | 80 +++++++------------
 tests/test_IfProcessor.cpp                    | 54 ++++++-------
 tests/test_IncDecExpressionProcessor.cpp      | 54 ++++++-------
 tests/test_NameProcessor.cpp                  |  4 +-
 tests/test_SymbolTable.cpp                    |  8 +-
 tests/test_UnaryExpressionProcessor.cpp       | 54 ++++++-------
 tests/test_WhileProcessor.cpp                 | 54 ++++++-------
 21 files changed, 350 insertions(+), 336 deletions(-)

diff --git a/src/language/ASTNodeDataTypeBuilder.cpp b/src/language/ASTNodeDataTypeBuilder.cpp
index 7b249e79c..0a6223c4f 100644
--- a/src/language/ASTNodeDataTypeBuilder.cpp
+++ b/src/language/ASTNodeDataTypeBuilder.cpp
@@ -49,7 +49,7 @@ ASTNodeDataTypeBuilder::_buildNodeDataTypes(ASTNode& n)
 
         auto [i_symbol, found] = symbol_table->find(symbol, n.children[1]->begin());
         Assert(found);
-        i_symbol->second.setDataType(data_type);
+        i_symbol->attributes().setDataType(data_type);
         n.m_data_type = data_type;
       } else if (n.is<language::let_declaration>()) {
         n.children[0]->m_data_type = ASTNodeDataType::function_t;
@@ -71,7 +71,7 @@ ASTNodeDataTypeBuilder::_buildNodeDataTypes(ASTNode& n)
 
           auto [i_symbol, found] = symbol_table->find(symbol, n.children[0]->begin());
           Assert(found);
-          i_symbol->second.setDataType(n.children[0]->m_data_type);
+          i_symbol->attributes().setDataType(n.children[0]->m_data_type);
         }
 
         if (n.children[1]->children[0]->children.size() != n.children[2]->children[0]->children.size()) {
@@ -107,7 +107,7 @@ ASTNodeDataTypeBuilder::_buildNodeDataTypes(ASTNode& n)
 
           auto [i_symbol, found] = symbol_table->find(symbol, symbol_node.begin());
           Assert(found);
-          i_symbol->second.setDataType(data_type);
+          i_symbol->attributes().setDataType(data_type);
         };
 
         if (n.children[1]->children[0]->children.size() == 0) {
@@ -124,7 +124,7 @@ ASTNodeDataTypeBuilder::_buildNodeDataTypes(ASTNode& n)
 
         auto [i_symbol, found] = symbol_table->find(n.string(), n.begin());
         Assert(found);
-        n.m_data_type = i_symbol->second.dataType();
+        n.m_data_type = i_symbol->attributes().dataType();
       }
     }
     for (auto& child : n.children) {
diff --git a/src/language/ASTSymbolInitializationChecker.cpp b/src/language/ASTSymbolInitializationChecker.cpp
index 1c75f86a4..c111a95a7 100644
--- a/src/language/ASTSymbolInitializationChecker.cpp
+++ b/src/language/ASTSymbolInitializationChecker.cpp
@@ -13,7 +13,7 @@ ASTSymbolInitializationChecker::_checkSymbolInitialization(ASTNode& node)
     Assert(found, "unexpected error, should have been detected through declaration checking");
     if (node.children.size() == 3) {
       this->_checkSymbolInitialization(*node.children[2]);
-      i_symbol->second.setIsInitialized();
+      i_symbol->attributes().setIsInitialized();
     }
   } else if (node.is<language::let_declaration>()) {
     const std::string& symbol = node.children[0]->string();
@@ -21,13 +21,13 @@ ASTSymbolInitializationChecker::_checkSymbolInitialization(ASTNode& node)
     Assert(found, "unexpected error, should have been detected through declaration checking");
     if (node.children.size() == 3) {
       this->_checkSymbolInitialization(*node.children[2]);
-      i_symbol->second.setIsInitialized();
+      i_symbol->attributes().setIsInitialized();
     }
   } else if (node.is<language::function_definition>()) {
     const std::string& symbol = node.children[0]->string();
     auto [i_symbol, found]    = node.m_symbol_table->find(symbol, node.children[0]->begin());
     Assert(found, "unexpected error, should have been detected through declaration checking");
-    i_symbol->second.setIsInitialized();
+    i_symbol->attributes().setIsInitialized();
     this->_checkSymbolInitialization(*node.children[1]);
   } else if (node.is<language::eq_op>()) {
     // first checks for right hand side
@@ -36,11 +36,11 @@ ASTSymbolInitializationChecker::_checkSymbolInitialization(ASTNode& node)
     const std::string& symbol = node.children[0]->string();
     auto [i_symbol, found]    = node.m_symbol_table->find(symbol, node.children[0]->begin());
     Assert(found, "unexpected error, should have been detected through declaration checking");
-    i_symbol->second.setIsInitialized();
+    i_symbol->attributes().setIsInitialized();
   } else if (node.is<language::name>()) {
     auto [i_symbol, found] = node.m_symbol_table->find(node.string(), node.begin());
     Assert(found, "unexpected error, should have been detected through declaration checking");
-    if (not i_symbol->second.isInitialized()) {
+    if (not i_symbol->attributes().isInitialized()) {
       std::ostringstream error_message;
       error_message << "uninitialized symbol '" << rang::fg::red << node.string() << rang::fg::reset << '\'';
       throw parse_error(error_message.str(), std::vector{node.begin()});
diff --git a/src/language/ASTSymbolTableBuilder.cpp b/src/language/ASTSymbolTableBuilder.cpp
index 3d0ad6942..441b8a242 100644
--- a/src/language/ASTSymbolTableBuilder.cpp
+++ b/src/language/ASTSymbolTableBuilder.cpp
@@ -49,7 +49,7 @@ ASTSymbolTableBuilder::buildSymbolTable(ASTNode& n, std::shared_ptr<SymbolTable>
             throw parse_error(error_message.str(), std::vector{n.begin()});
           }
           // Symbols will be initialized at call
-          i_symbol->second.setIsInitialized();
+          i_symbol->attributes().setIsInitialized();
         };
 
         if (n.children[0]->is<language::name>()) {
diff --git a/src/language/SymbolTable.hpp b/src/language/SymbolTable.hpp
index 1e2d22872..f955d45d3 100644
--- a/src/language/SymbolTable.hpp
+++ b/src/language/SymbolTable.hpp
@@ -1,6 +1,8 @@
 #ifndef SYMBOL_TABLE_HPP
 #define SYMBOL_TABLE_HPP
 
+#include <PugsMacros.hpp>
+
 #include <ASTNodeDataType.hpp>
 #include <ASTNodeDataVariant.hpp>
 
@@ -85,8 +87,47 @@ class SymbolTable
     Attributes(const Attributes&) = default;
   };
 
+  class Symbol
+  {
+   private:
+    std::string m_name;
+    Attributes m_attributes;
+
+   public:
+    PUGS_INLINE
+    const std::string&
+    name() const
+    {
+      return m_name;
+    }
+
+    PUGS_INLINE
+    const Attributes&
+    attributes() const
+    {
+      return m_attributes;
+    }
+
+    PUGS_INLINE
+    Attributes&
+    attributes()
+    {
+      return m_attributes;
+    }
+
+    Symbol(const std::string& name, const Attributes& attributes) : m_name(name), m_attributes(attributes) {}
+
+    Symbol& operator=(Symbol&&) = default;
+    Symbol& operator=(const Symbol&) = default;
+
+    Symbol(const Symbol&) = default;
+    Symbol(Symbol&&)      = default;
+    Symbol()              = default;
+    ~Symbol()             = default;
+  };
+
  private:
-  std::vector<std::pair<std::string, Attributes>> m_symbol_list;
+  std::vector<Symbol> m_symbol_list;
   std::shared_ptr<SymbolTable> m_parent_table;
 
  public:
@@ -95,7 +136,7 @@ class SymbolTable
   {
     os << "-- Symbol table state -- parent : " << symbol_table.m_parent_table.get() << "\n";
     for (auto i_symbol : symbol_table.m_symbol_list) {
-      os << ' ' << i_symbol.first << ": " << std::boolalpha << i_symbol.second << '\n';
+      os << ' ' << i_symbol.name() << ": " << std::boolalpha << i_symbol.attributes() << '\n';
     }
     os << "------------------------\n";
     return os;
@@ -107,13 +148,13 @@ class SymbolTable
     auto i_symbol = m_symbol_list.end();
 
     for (auto i_stored_symbol = m_symbol_list.begin(); i_stored_symbol != m_symbol_list.end(); ++i_stored_symbol) {
-      if (i_stored_symbol->first == symbol) {
+      if (i_stored_symbol->name() == symbol) {
         i_symbol = i_stored_symbol;
         break;
       }
     }
 
-    if (i_symbol != m_symbol_list.end() and (use_position.byte >= i_symbol->second.position().byte)) {
+    if (i_symbol != m_symbol_list.end() and (use_position.byte >= i_symbol->attributes().position().byte)) {
       return std::make_pair(i_symbol, true);
     } else {
       if (m_parent_table) {
@@ -125,15 +166,14 @@ class SymbolTable
   }
 
   auto
-  add(const std::string& symbol, const TAO_PEGTL_NAMESPACE::position& symbol_position)
+  add(const std::string& symbol_name, const TAO_PEGTL_NAMESPACE::position& symbol_position)
   {
     for (auto i_stored_symbol = m_symbol_list.begin(); i_stored_symbol != m_symbol_list.end(); ++i_stored_symbol) {
-      if (i_stored_symbol->first == symbol) {
+      if (i_stored_symbol->name() == symbol_name) {
         return std::make_pair(i_stored_symbol, false);
       }
     }
-    return std::make_pair(m_symbol_list.emplace(m_symbol_list.end(),
-                                                std::make_pair(symbol, Attributes(symbol_position))),
+    return std::make_pair(m_symbol_list.emplace(m_symbol_list.end(), Symbol{symbol_name, Attributes(symbol_position)}),
                           true);
   }
 
diff --git a/src/language/node_processor/AffectationProcessor.hpp b/src/language/node_processor/AffectationProcessor.hpp
index ac0819697..50b1fd69c 100644
--- a/src/language/node_processor/AffectationProcessor.hpp
+++ b/src/language/node_processor/AffectationProcessor.hpp
@@ -93,7 +93,7 @@ class AffectationProcessor final : public INodeProcessor
       const std::string& symbol = m_node.children[0]->string();
       auto [i_symbol, found]    = m_node.m_symbol_table->find(symbol, m_node.children[0]->begin());
       Assert(found);
-      p_value = &i_symbol->second.value();
+      p_value = &i_symbol->attributes().value();
     } else {
       throw parse_error("invalid operands to affectation expression", std::vector{m_node.begin()});
     }
diff --git a/src/language/node_processor/AffectationToStringProcessor.hpp b/src/language/node_processor/AffectationToStringProcessor.hpp
index 7bba4111b..7c22c095d 100644
--- a/src/language/node_processor/AffectationToStringProcessor.hpp
+++ b/src/language/node_processor/AffectationToStringProcessor.hpp
@@ -38,7 +38,7 @@ class AffectationToStringProcessor final : public INodeProcessor
     const std::string& symbol = m_node.children[0]->string();
     auto [i_symbol, found]    = m_node.m_symbol_table->find(symbol, m_node.children[0]->begin());
     Assert(found);
-    p_value = &i_symbol->second.value();
+    p_value = &i_symbol->attributes().value();
   }
 };
 
diff --git a/src/language/node_processor/IncDecExpressionProcessor.hpp b/src/language/node_processor/IncDecExpressionProcessor.hpp
index ca3c387c1..961adbddc 100644
--- a/src/language/node_processor/IncDecExpressionProcessor.hpp
+++ b/src/language/node_processor/IncDecExpressionProcessor.hpp
@@ -73,7 +73,7 @@ class IncDecExpressionProcessor final : public INodeProcessor
     const std::string& symbol = m_node.children[0]->string();
     auto [i_symbol, found]    = m_node.m_symbol_table->find(symbol, m_node.children[0]->begin());
     Assert(found);
-    p_value = &i_symbol->second.value();
+    p_value = &i_symbol->attributes().value();
   }
 };
 
diff --git a/src/language/node_processor/NameProcessor.hpp b/src/language/node_processor/NameProcessor.hpp
index f78ae7195..edb5d026c 100644
--- a/src/language/node_processor/NameProcessor.hpp
+++ b/src/language/node_processor/NameProcessor.hpp
@@ -24,7 +24,7 @@ class NameProcessor final : public INodeProcessor
     const std::string& symbol = m_node.string();
     auto [i_symbol, found]    = m_node.m_symbol_table->find(symbol, m_node.begin());
     Assert(found);
-    p_value = &(i_symbol->second.value());
+    p_value = &(i_symbol->attributes().value());
   }
 };
 
diff --git a/tests/test_ASTSymbolInitializationChecker.cpp b/tests/test_ASTSymbolInitializationChecker.cpp
index a592dfe4f..0c71c3a69 100644
--- a/tests/test_ASTSymbolInitializationChecker.cpp
+++ b/tests/test_ASTSymbolInitializationChecker.cpp
@@ -24,17 +24,17 @@ N p;
     position position{internal::iterator{"fixture"}, "fixture"};
     position.byte = data.size();   // ensure that variables are declared at this point
 
-    auto [attribute_m, found_m] = ast->m_symbol_table->find("m", position);
+    auto [symbol_m, found_m] = ast->m_symbol_table->find("m", position);
     REQUIRE(found_m);
-    REQUIRE(attribute_m->second.isInitialized());
+    REQUIRE(symbol_m->attributes().isInitialized());
 
-    auto [attribute_n, found_n] = ast->m_symbol_table->find("n", position);
+    auto [symbol_n, found_n] = ast->m_symbol_table->find("n", position);
     REQUIRE(found_n);
-    REQUIRE(attribute_n->second.isInitialized());
+    REQUIRE(symbol_n->attributes().isInitialized());
 
-    auto [attribute_p, found_p] = ast->m_symbol_table->find("p", position);
+    auto [symbol_p, found_p] = ast->m_symbol_table->find("p", position);
     REQUIRE(found_p);
-    REQUIRE(not attribute_p->second.isInitialized());
+    REQUIRE(not symbol_p->attributes().isInitialized());
   }
 
   SECTION("Declaration plus affectation")
@@ -56,17 +56,17 @@ m = n;
     position position{internal::iterator{"fixture"}, "fixture"};
     position.byte = data.size();   // ensure that variables are declared at this point
 
-    auto [attribute_m, found_m] = ast->m_symbol_table->find("m", position);
+    auto [symbol_m, found_m] = ast->m_symbol_table->find("m", position);
     REQUIRE(found_m);
-    REQUIRE(attribute_m->second.isInitialized());
+    REQUIRE(symbol_m->attributes().isInitialized());
 
-    auto [attribute_n, found_n] = ast->m_symbol_table->find("n", position);
+    auto [symbol_n, found_n] = ast->m_symbol_table->find("n", position);
     REQUIRE(found_n);
-    REQUIRE(attribute_n->second.isInitialized());
+    REQUIRE(symbol_n->attributes().isInitialized());
 
-    auto [attribute_z, found_z] = ast->m_symbol_table->find("z", position);
+    auto [symbol_z, found_z] = ast->m_symbol_table->find("z", position);
     REQUIRE(found_z);
-    REQUIRE(not attribute_z->second.isInitialized());
+    REQUIRE(not symbol_z->attributes().isInitialized());
   }
 
   SECTION("used uninitialized")
diff --git a/tests/test_AffectationProcessor.cpp b/tests/test_AffectationProcessor.cpp
index 351a3af9d..2ce8f79be 100644
--- a/tests/test_AffectationProcessor.cpp
+++ b/tests/test_AffectationProcessor.cpp
@@ -22,33 +22,33 @@
 
 #include <sstream>
 
-#define CHECK_AFFECTATION_RESULT(data, variable_name, expected_value)       \
-  {                                                                         \
-    string_input input{data, "test.pgs"};                                   \
-    auto ast = ASTBuilder::build(input);                                    \
-                                                                            \
-    ASTSymbolTableBuilder{*ast};                                            \
-    ASTNodeDataTypeBuilder{*ast};                                           \
-    ASTNodeValueBuilder{*ast};                                              \
-                                                                            \
-    ASTNodeDeclarationToAffectationConverter{*ast};                         \
-    ASTNodeDeclarationCleaner{*ast};                                        \
-                                                                            \
-    ASTNodeExpressionBuilder{*ast};                                         \
-    ExecUntilBreakOrContinue exec_policy;                                   \
-    ast->execute(exec_policy);                                              \
-                                                                            \
-    auto symbol_table = ast->m_symbol_table;                                \
-                                                                            \
-    using namespace TAO_PEGTL_NAMESPACE;                                    \
-    position use_position{internal::iterator{"fixture"}, "fixture"};        \
-    use_position.byte    = 10000;                                           \
-    auto [symbol, found] = symbol_table->find(variable_name, use_position); \
-                                                                            \
-    auto attribute = symbol->second;                                        \
-    auto value     = std::get<decltype(expected_value)>(attribute.value()); \
-                                                                            \
-    REQUIRE(value == expected_value);                                       \
+#define CHECK_AFFECTATION_RESULT(data, variable_name, expected_value)         \
+  {                                                                           \
+    string_input input{data, "test.pgs"};                                     \
+    auto ast = ASTBuilder::build(input);                                      \
+                                                                              \
+    ASTSymbolTableBuilder{*ast};                                              \
+    ASTNodeDataTypeBuilder{*ast};                                             \
+    ASTNodeValueBuilder{*ast};                                                \
+                                                                              \
+    ASTNodeDeclarationToAffectationConverter{*ast};                           \
+    ASTNodeDeclarationCleaner{*ast};                                          \
+                                                                              \
+    ASTNodeExpressionBuilder{*ast};                                           \
+    ExecUntilBreakOrContinue exec_policy;                                     \
+    ast->execute(exec_policy);                                                \
+                                                                              \
+    auto symbol_table = ast->m_symbol_table;                                  \
+                                                                              \
+    using namespace TAO_PEGTL_NAMESPACE;                                      \
+    position use_position{internal::iterator{"fixture"}, "fixture"};          \
+    use_position.byte    = 10000;                                             \
+    auto [symbol, found] = symbol_table->find(variable_name, use_position);   \
+                                                                              \
+    auto attributes = symbol->attributes();                                   \
+    auto value      = std::get<decltype(expected_value)>(attributes.value()); \
+                                                                              \
+    REQUIRE(value == expected_value);                                         \
   }
 
 #define CHECK_AFFECTATION_THROWS(data)                                                       \
diff --git a/tests/test_AffectationToStringProcessor.cpp b/tests/test_AffectationToStringProcessor.cpp
index fb2ba5824..18831ae21 100644
--- a/tests/test_AffectationToStringProcessor.cpp
+++ b/tests/test_AffectationToStringProcessor.cpp
@@ -22,33 +22,33 @@
 
 #include <sstream>
 
-#define CHECK_AFFECTATION_RESULT(data, variable_name, expected_value)       \
-  {                                                                         \
-    string_input input{data, "test.pgs"};                                   \
-    auto ast = ASTBuilder::build(input);                                    \
-                                                                            \
-    ASTSymbolTableBuilder{*ast};                                            \
-    ASTNodeDataTypeBuilder{*ast};                                           \
-    ASTNodeValueBuilder{*ast};                                              \
-                                                                            \
-    ASTNodeDeclarationToAffectationConverter{*ast};                         \
-    ASTNodeDeclarationCleaner{*ast};                                        \
-                                                                            \
-    ASTNodeExpressionBuilder{*ast};                                         \
-    ExecUntilBreakOrContinue exec_policy;                                   \
-    ast->execute(exec_policy);                                              \
-                                                                            \
-    auto symbol_table = ast->m_symbol_table;                                \
-                                                                            \
-    using namespace TAO_PEGTL_NAMESPACE;                                    \
-    position use_position{internal::iterator{"fixture"}, "fixture"};        \
-    use_position.byte    = 10000;                                           \
-    auto [symbol, found] = symbol_table->find(variable_name, use_position); \
-                                                                            \
-    auto attribute = symbol->second;                                        \
-    auto value     = std::get<decltype(expected_value)>(attribute.value()); \
-                                                                            \
-    REQUIRE(value == expected_value);                                       \
+#define CHECK_AFFECTATION_RESULT(data, variable_name, expected_value)         \
+  {                                                                           \
+    string_input input{data, "test.pgs"};                                     \
+    auto ast = ASTBuilder::build(input);                                      \
+                                                                              \
+    ASTSymbolTableBuilder{*ast};                                              \
+    ASTNodeDataTypeBuilder{*ast};                                             \
+    ASTNodeValueBuilder{*ast};                                                \
+                                                                              \
+    ASTNodeDeclarationToAffectationConverter{*ast};                           \
+    ASTNodeDeclarationCleaner{*ast};                                          \
+                                                                              \
+    ASTNodeExpressionBuilder{*ast};                                           \
+    ExecUntilBreakOrContinue exec_policy;                                     \
+    ast->execute(exec_policy);                                                \
+                                                                              \
+    auto symbol_table = ast->m_symbol_table;                                  \
+                                                                              \
+    using namespace TAO_PEGTL_NAMESPACE;                                      \
+    position use_position{internal::iterator{"fixture"}, "fixture"};          \
+    use_position.byte    = 10000;                                             \
+    auto [symbol, found] = symbol_table->find(variable_name, use_position);   \
+                                                                              \
+    auto attributes = symbol->attributes();                                   \
+    auto value      = std::get<decltype(expected_value)>(attributes.value()); \
+                                                                              \
+    REQUIRE(value == expected_value);                                         \
   }
 
 TEST_CASE("ASTAffectationToStringProcessor", "[language]")
diff --git a/tests/test_BinaryExpressionProcessor_utils.hpp b/tests/test_BinaryExpressionProcessor_utils.hpp
index ddd8ce2c8..c6d7a8bd6 100644
--- a/tests/test_BinaryExpressionProcessor_utils.hpp
+++ b/tests/test_BinaryExpressionProcessor_utils.hpp
@@ -23,33 +23,33 @@
 
 #include <sstream>
 
-#define CHECK_BINARY_EXPRESSION_RESULT(data, variable_name, expected_value) \
-  {                                                                         \
-    string_input input{data, "test.pgs"};                                   \
-    auto ast = ASTBuilder::build(input);                                    \
-                                                                            \
-    ASTSymbolTableBuilder{*ast};                                            \
-    ASTNodeDataTypeBuilder{*ast};                                           \
-    ASTNodeValueBuilder{*ast};                                              \
-                                                                            \
-    ASTNodeDeclarationToAffectationConverter{*ast};                         \
-    ASTNodeDeclarationCleaner{*ast};                                        \
-                                                                            \
-    ASTNodeExpressionBuilder{*ast};                                         \
-    ExecUntilBreakOrContinue exec_policy;                                   \
-    ast->execute(exec_policy);                                              \
-                                                                            \
-    auto symbol_table = ast->m_symbol_table;                                \
-                                                                            \
-    using namespace TAO_PEGTL_NAMESPACE;                                    \
-    position use_position{internal::iterator{"fixture"}, "fixture"};        \
-    use_position.byte    = 10000;                                           \
-    auto [symbol, found] = symbol_table->find(variable_name, use_position); \
-                                                                            \
-    auto attribute = symbol->second;                                        \
-    auto value     = std::get<decltype(expected_value)>(attribute.value()); \
-                                                                            \
-    REQUIRE(value == expected_value);                                       \
+#define CHECK_BINARY_EXPRESSION_RESULT(data, variable_name, expected_value)   \
+  {                                                                           \
+    string_input input{data, "test.pgs"};                                     \
+    auto ast = ASTBuilder::build(input);                                      \
+                                                                              \
+    ASTSymbolTableBuilder{*ast};                                              \
+    ASTNodeDataTypeBuilder{*ast};                                             \
+    ASTNodeValueBuilder{*ast};                                                \
+                                                                              \
+    ASTNodeDeclarationToAffectationConverter{*ast};                           \
+    ASTNodeDeclarationCleaner{*ast};                                          \
+                                                                              \
+    ASTNodeExpressionBuilder{*ast};                                           \
+    ExecUntilBreakOrContinue exec_policy;                                     \
+    ast->execute(exec_policy);                                                \
+                                                                              \
+    auto symbol_table = ast->m_symbol_table;                                  \
+                                                                              \
+    using namespace TAO_PEGTL_NAMESPACE;                                      \
+    position use_position{internal::iterator{"fixture"}, "fixture"};          \
+    use_position.byte    = 10000;                                             \
+    auto [symbol, found] = symbol_table->find(variable_name, use_position);   \
+                                                                              \
+    auto attributes = symbol->attributes();                                   \
+    auto value      = std::get<decltype(expected_value)>(attributes.value()); \
+                                                                              \
+    REQUIRE(value == expected_value);                                         \
   }
 
 #endif   // TEST_BINARY_EXPRESSION_PROCESSOR_UTILS_HPP
diff --git a/tests/test_ConcatExpressionProcessor.cpp b/tests/test_ConcatExpressionProcessor.cpp
index 3b4430248..3baa9c59f 100644
--- a/tests/test_ConcatExpressionProcessor.cpp
+++ b/tests/test_ConcatExpressionProcessor.cpp
@@ -22,33 +22,33 @@
 
 #include <sstream>
 
-#define CHECK_CONCAT_EXPRESSION_RESULT(data, variable_name, expected_value) \
-  {                                                                         \
-    string_input input{data, "test.pgs"};                                   \
-    auto ast = ASTBuilder::build(input);                                    \
-                                                                            \
-    ASTSymbolTableBuilder{*ast};                                            \
-    ASTNodeDataTypeBuilder{*ast};                                           \
-    ASTNodeValueBuilder{*ast};                                              \
-                                                                            \
-    ASTNodeDeclarationToAffectationConverter{*ast};                         \
-    ASTNodeDeclarationCleaner{*ast};                                        \
-                                                                            \
-    ASTNodeExpressionBuilder{*ast};                                         \
-    ExecUntilBreakOrContinue exec_policy;                                   \
-    ast->execute(exec_policy);                                              \
-                                                                            \
-    auto symbol_table = ast->m_symbol_table;                                \
-                                                                            \
-    using namespace TAO_PEGTL_NAMESPACE;                                    \
-    position use_position{internal::iterator{"fixture"}, "fixture"};        \
-    use_position.byte    = 10000;                                           \
-    auto [symbol, found] = symbol_table->find(variable_name, use_position); \
-                                                                            \
-    auto attribute = symbol->second;                                        \
-    auto value     = std::get<decltype(expected_value)>(attribute.value()); \
-                                                                            \
-    REQUIRE(value == expected_value);                                       \
+#define CHECK_CONCAT_EXPRESSION_RESULT(data, variable_name, expected_value)   \
+  {                                                                           \
+    string_input input{data, "test.pgs"};                                     \
+    auto ast = ASTBuilder::build(input);                                      \
+                                                                              \
+    ASTSymbolTableBuilder{*ast};                                              \
+    ASTNodeDataTypeBuilder{*ast};                                             \
+    ASTNodeValueBuilder{*ast};                                                \
+                                                                              \
+    ASTNodeDeclarationToAffectationConverter{*ast};                           \
+    ASTNodeDeclarationCleaner{*ast};                                          \
+                                                                              \
+    ASTNodeExpressionBuilder{*ast};                                           \
+    ExecUntilBreakOrContinue exec_policy;                                     \
+    ast->execute(exec_policy);                                                \
+                                                                              \
+    auto symbol_table = ast->m_symbol_table;                                  \
+                                                                              \
+    using namespace TAO_PEGTL_NAMESPACE;                                      \
+    position use_position{internal::iterator{"fixture"}, "fixture"};          \
+    use_position.byte    = 10000;                                             \
+    auto [symbol, found] = symbol_table->find(variable_name, use_position);   \
+                                                                              \
+    auto attributes = symbol->attributes();                                   \
+    auto value      = std::get<decltype(expected_value)>(attributes.value()); \
+                                                                              \
+    REQUIRE(value == expected_value);                                         \
   }
 
 TEST_CASE("ConcatExpressionProcessor", "[language]")
diff --git a/tests/test_DoWhileProcessor.cpp b/tests/test_DoWhileProcessor.cpp
index a04801163..8cbc13823 100644
--- a/tests/test_DoWhileProcessor.cpp
+++ b/tests/test_DoWhileProcessor.cpp
@@ -22,33 +22,33 @@
 
 #include <sstream>
 
-#define CHECK_WHILE_PROCESSOR_RESULT(data, variable_name, expected_value)   \
-  {                                                                         \
-    string_input input{data, "test.pgs"};                                   \
-    auto ast = ASTBuilder::build(input);                                    \
-                                                                            \
-    ASTSymbolTableBuilder{*ast};                                            \
-    ASTNodeDataTypeBuilder{*ast};                                           \
-    ASTNodeValueBuilder{*ast};                                              \
-                                                                            \
-    ASTNodeDeclarationToAffectationConverter{*ast};                         \
-    ASTNodeDeclarationCleaner{*ast};                                        \
-                                                                            \
-    ASTNodeExpressionBuilder{*ast};                                         \
-    ExecUntilBreakOrContinue exec_policy;                                   \
-    ast->execute(exec_policy);                                              \
-                                                                            \
-    auto symbol_table = ast->m_symbol_table;                                \
-                                                                            \
-    using namespace TAO_PEGTL_NAMESPACE;                                    \
-    position use_position{internal::iterator{"fixture"}, "fixture"};        \
-    use_position.byte    = 10000;                                           \
-    auto [symbol, found] = symbol_table->find(variable_name, use_position); \
-                                                                            \
-    auto attribute = symbol->second;                                        \
-    auto value     = std::get<decltype(expected_value)>(attribute.value()); \
-                                                                            \
-    REQUIRE(value == expected_value);                                       \
+#define CHECK_WHILE_PROCESSOR_RESULT(data, variable_name, expected_value)     \
+  {                                                                           \
+    string_input input{data, "test.pgs"};                                     \
+    auto ast = ASTBuilder::build(input);                                      \
+                                                                              \
+    ASTSymbolTableBuilder{*ast};                                              \
+    ASTNodeDataTypeBuilder{*ast};                                             \
+    ASTNodeValueBuilder{*ast};                                                \
+                                                                              \
+    ASTNodeDeclarationToAffectationConverter{*ast};                           \
+    ASTNodeDeclarationCleaner{*ast};                                          \
+                                                                              \
+    ASTNodeExpressionBuilder{*ast};                                           \
+    ExecUntilBreakOrContinue exec_policy;                                     \
+    ast->execute(exec_policy);                                                \
+                                                                              \
+    auto symbol_table = ast->m_symbol_table;                                  \
+                                                                              \
+    using namespace TAO_PEGTL_NAMESPACE;                                      \
+    position use_position{internal::iterator{"fixture"}, "fixture"};          \
+    use_position.byte    = 10000;                                             \
+    auto [symbol, found] = symbol_table->find(variable_name, use_position);   \
+                                                                              \
+    auto attributes = symbol->attributes();                                   \
+    auto value      = std::get<decltype(expected_value)>(attributes.value()); \
+                                                                              \
+    REQUIRE(value == expected_value);                                         \
   }
 
 TEST_CASE("DoWhileProcessor", "[language]")
diff --git a/tests/test_ForProcessor.cpp b/tests/test_ForProcessor.cpp
index bd833f7f5..9f0371d06 100644
--- a/tests/test_ForProcessor.cpp
+++ b/tests/test_ForProcessor.cpp
@@ -22,33 +22,33 @@
 
 #include <sstream>
 
-#define CHECK_FOR_PROCESSOR_RESULT(data, variable_name, expected_value)     \
-  {                                                                         \
-    string_input input{data, "test.pgs"};                                   \
-    auto ast = ASTBuilder::build(input);                                    \
-                                                                            \
-    ASTSymbolTableBuilder{*ast};                                            \
-    ASTNodeDataTypeBuilder{*ast};                                           \
-    ASTNodeValueBuilder{*ast};                                              \
-                                                                            \
-    ASTNodeDeclarationToAffectationConverter{*ast};                         \
-    ASTNodeDeclarationCleaner{*ast};                                        \
-                                                                            \
-    ASTNodeExpressionBuilder{*ast};                                         \
-    ExecUntilBreakOrContinue exec_policy;                                   \
-    ast->execute(exec_policy);                                              \
-                                                                            \
-    auto symbol_table = ast->m_symbol_table;                                \
-                                                                            \
-    using namespace TAO_PEGTL_NAMESPACE;                                    \
-    position use_position{internal::iterator{"fixture"}, "fixture"};        \
-    use_position.byte    = 10000;                                           \
-    auto [symbol, found] = symbol_table->find(variable_name, use_position); \
-                                                                            \
-    auto attribute = symbol->second;                                        \
-    auto value     = std::get<decltype(expected_value)>(attribute.value()); \
-                                                                            \
-    REQUIRE(value == expected_value);                                       \
+#define CHECK_FOR_PROCESSOR_RESULT(data, variable_name, expected_value)       \
+  {                                                                           \
+    string_input input{data, "test.pgs"};                                     \
+    auto ast = ASTBuilder::build(input);                                      \
+                                                                              \
+    ASTSymbolTableBuilder{*ast};                                              \
+    ASTNodeDataTypeBuilder{*ast};                                             \
+    ASTNodeValueBuilder{*ast};                                                \
+                                                                              \
+    ASTNodeDeclarationToAffectationConverter{*ast};                           \
+    ASTNodeDeclarationCleaner{*ast};                                          \
+                                                                              \
+    ASTNodeExpressionBuilder{*ast};                                           \
+    ExecUntilBreakOrContinue exec_policy;                                     \
+    ast->execute(exec_policy);                                                \
+                                                                              \
+    auto symbol_table = ast->m_symbol_table;                                  \
+                                                                              \
+    using namespace TAO_PEGTL_NAMESPACE;                                      \
+    position use_position{internal::iterator{"fixture"}, "fixture"};          \
+    use_position.byte    = 10000;                                             \
+    auto [symbol, found] = symbol_table->find(variable_name, use_position);   \
+                                                                              \
+    auto attributes = symbol->attributes();                                   \
+    auto value      = std::get<decltype(expected_value)>(attributes.value()); \
+                                                                              \
+    REQUIRE(value == expected_value);                                         \
   }
 
 TEST_CASE("ForProcessor", "[language]")
@@ -87,30 +87,4 @@ for(N l=0; l<10; ++l) {
 )";
     CHECK_FOR_PROCESSOR_RESULT(data, "i", 42ul);
   }
-
-  //   SECTION("simple if(true)else")
-  //   {
-  //     std::string_view data = R"(
-  // N i = 0;
-  // if(true) {
-  //   i = 1;
-  // } else {
-  //   i = 2;
-  // }
-  // )";
-  //     CHECK_FOR_PROCESSOR_RESULT(data, "i", 1ul);
-  //   }
-
-  //   SECTION("simple if(false)")
-  //   {
-  //     std::string_view data = R"(
-  // N i = 0;
-  // if(false) {
-  //   i = 1;
-  // } else {
-  //   i = 2;
-  // }
-  // )";
-  //     CHECK_FOR_PROCESSOR_RESULT(data, "i", 2ul);
-  //   }
 }
diff --git a/tests/test_IfProcessor.cpp b/tests/test_IfProcessor.cpp
index a316f2d31..5e6014b75 100644
--- a/tests/test_IfProcessor.cpp
+++ b/tests/test_IfProcessor.cpp
@@ -22,33 +22,33 @@
 
 #include <sstream>
 
-#define CHECK_IF_PROCESSOR_RESULT(data, variable_name, expected_value)      \
-  {                                                                         \
-    string_input input{data, "test.pgs"};                                   \
-    auto ast = ASTBuilder::build(input);                                    \
-                                                                            \
-    ASTSymbolTableBuilder{*ast};                                            \
-    ASTNodeDataTypeBuilder{*ast};                                           \
-    ASTNodeValueBuilder{*ast};                                              \
-                                                                            \
-    ASTNodeDeclarationToAffectationConverter{*ast};                         \
-    ASTNodeDeclarationCleaner{*ast};                                        \
-                                                                            \
-    ASTNodeExpressionBuilder{*ast};                                         \
-    ExecUntilBreakOrContinue exec_policy;                                   \
-    ast->execute(exec_policy);                                              \
-                                                                            \
-    auto symbol_table = ast->m_symbol_table;                                \
-                                                                            \
-    using namespace TAO_PEGTL_NAMESPACE;                                    \
-    position use_position{internal::iterator{"fixture"}, "fixture"};        \
-    use_position.byte    = 10000;                                           \
-    auto [symbol, found] = symbol_table->find(variable_name, use_position); \
-                                                                            \
-    auto attribute = symbol->second;                                        \
-    auto value     = std::get<decltype(expected_value)>(attribute.value()); \
-                                                                            \
-    REQUIRE(value == expected_value);                                       \
+#define CHECK_IF_PROCESSOR_RESULT(data, variable_name, expected_value)        \
+  {                                                                           \
+    string_input input{data, "test.pgs"};                                     \
+    auto ast = ASTBuilder::build(input);                                      \
+                                                                              \
+    ASTSymbolTableBuilder{*ast};                                              \
+    ASTNodeDataTypeBuilder{*ast};                                             \
+    ASTNodeValueBuilder{*ast};                                                \
+                                                                              \
+    ASTNodeDeclarationToAffectationConverter{*ast};                           \
+    ASTNodeDeclarationCleaner{*ast};                                          \
+                                                                              \
+    ASTNodeExpressionBuilder{*ast};                                           \
+    ExecUntilBreakOrContinue exec_policy;                                     \
+    ast->execute(exec_policy);                                                \
+                                                                              \
+    auto symbol_table = ast->m_symbol_table;                                  \
+                                                                              \
+    using namespace TAO_PEGTL_NAMESPACE;                                      \
+    position use_position{internal::iterator{"fixture"}, "fixture"};          \
+    use_position.byte    = 10000;                                             \
+    auto [symbol, found] = symbol_table->find(variable_name, use_position);   \
+                                                                              \
+    auto attributes = symbol->attributes();                                   \
+    auto value      = std::get<decltype(expected_value)>(attributes.value()); \
+                                                                              \
+    REQUIRE(value == expected_value);                                         \
   }
 
 TEST_CASE("IfProcessor", "[language]")
diff --git a/tests/test_IncDecExpressionProcessor.cpp b/tests/test_IncDecExpressionProcessor.cpp
index c25887322..3cba4f901 100644
--- a/tests/test_IncDecExpressionProcessor.cpp
+++ b/tests/test_IncDecExpressionProcessor.cpp
@@ -22,33 +22,33 @@
 
 #include <sstream>
 
-#define CHECK_INC_DEC_RESULT(data, variable_name, expected_value)           \
-  {                                                                         \
-    string_input input{data, "test.pgs"};                                   \
-    auto ast = ASTBuilder::build(input);                                    \
-                                                                            \
-    ASTSymbolTableBuilder{*ast};                                            \
-    ASTNodeDataTypeBuilder{*ast};                                           \
-    ASTNodeValueBuilder{*ast};                                              \
-                                                                            \
-    ASTNodeDeclarationToAffectationConverter{*ast};                         \
-    ASTNodeDeclarationCleaner{*ast};                                        \
-                                                                            \
-    ASTNodeExpressionBuilder{*ast};                                         \
-    ExecUntilBreakOrContinue exec_policy;                                   \
-    ast->execute(exec_policy);                                              \
-                                                                            \
-    auto symbol_table = ast->m_symbol_table;                                \
-                                                                            \
-    using namespace TAO_PEGTL_NAMESPACE;                                    \
-    position use_position{internal::iterator{"fixture"}, "fixture"};        \
-    use_position.byte    = 10000;                                           \
-    auto [symbol, found] = symbol_table->find(variable_name, use_position); \
-                                                                            \
-    auto attribute = symbol->second;                                        \
-    auto value     = std::get<decltype(expected_value)>(attribute.value()); \
-                                                                            \
-    REQUIRE(value == expected_value);                                       \
+#define CHECK_INC_DEC_RESULT(data, variable_name, expected_value)             \
+  {                                                                           \
+    string_input input{data, "test.pgs"};                                     \
+    auto ast = ASTBuilder::build(input);                                      \
+                                                                              \
+    ASTSymbolTableBuilder{*ast};                                              \
+    ASTNodeDataTypeBuilder{*ast};                                             \
+    ASTNodeValueBuilder{*ast};                                                \
+                                                                              \
+    ASTNodeDeclarationToAffectationConverter{*ast};                           \
+    ASTNodeDeclarationCleaner{*ast};                                          \
+                                                                              \
+    ASTNodeExpressionBuilder{*ast};                                           \
+    ExecUntilBreakOrContinue exec_policy;                                     \
+    ast->execute(exec_policy);                                                \
+                                                                              \
+    auto symbol_table = ast->m_symbol_table;                                  \
+                                                                              \
+    using namespace TAO_PEGTL_NAMESPACE;                                      \
+    position use_position{internal::iterator{"fixture"}, "fixture"};          \
+    use_position.byte    = 10000;                                             \
+    auto [symbol, found] = symbol_table->find(variable_name, use_position);   \
+                                                                              \
+    auto attributes = symbol->attributes();                                   \
+    auto value      = std::get<decltype(expected_value)>(attributes.value()); \
+                                                                              \
+    REQUIRE(value == expected_value);                                         \
   }
 
 TEST_CASE("IncDecExpressionProcessor", "[language]")
diff --git a/tests/test_NameProcessor.cpp b/tests/test_NameProcessor.cpp
index 73d7f7cae..4152b3ae0 100644
--- a/tests/test_NameProcessor.cpp
+++ b/tests/test_NameProcessor.cpp
@@ -51,12 +51,12 @@ n = 2;
   using namespace TAO_PEGTL_NAMESPACE;
   position use_position{internal::iterator{"fixture"}, "fixture"};
   use_position.byte = 100;   // after declarative position
-  auto symbol_n     = symbol_table->find("n", use_position).first->second;
+  auto symbol_n     = symbol_table->find("n", use_position).first->attributes();
   auto value_n      = std::get<long unsigned int>(symbol_n.value());
 
   REQUIRE(value_n == 2);
 
-  auto symbol_m = symbol_table->find("m", use_position).first->second;
+  auto symbol_m = symbol_table->find("m", use_position).first->attributes();
   auto value_m  = std::get<long unsigned int>(symbol_m.value());
 
   REQUIRE(value_m == 3);
diff --git a/tests/test_SymbolTable.cpp b/tests/test_SymbolTable.cpp
index aa15ef0c1..1bf8a63b8 100644
--- a/tests/test_SymbolTable.cpp
+++ b/tests/test_SymbolTable.cpp
@@ -18,7 +18,7 @@ TEST_CASE("SymbolTable", "[language]")
     auto [i_symbol_a, created_a] = root_st->add("a", begin_position);
     REQUIRE(created_a);
 
-    REQUIRE(i_symbol_a->second.position().byte == 2);
+    REQUIRE(i_symbol_a->attributes().position().byte == 2);
 
     // Check that one cannot build another "a" in this table
     REQUIRE(not root_st->add("a", begin_position).second);
@@ -47,7 +47,7 @@ TEST_CASE("SymbolTable", "[language]")
     SECTION("Attributes")
     {
       // undefined data
-      auto& attributes_a = i_search_a->second;
+      auto& attributes_a = i_search_a->attributes();
       REQUIRE(attributes_a.dataType() == ASTNodeDataType::undefined_t);
       REQUIRE(not attributes_a.isInitialized());
 
@@ -121,8 +121,8 @@ TEST_CASE("SymbolTable", "[language]")
 
     REQUIRE(found_nested_a);
     // found the symbol created in nested symbol table
-    REQUIRE(&(i_search_nested_a->second) != &(i_root_symbol_a->second));
-    REQUIRE(&(i_search_nested_a->second) == &(i_nested_symbol_a->second));
+    REQUIRE(&(i_search_nested_a->attributes()) != &(i_root_symbol_a->attributes()));
+    REQUIRE(&(i_search_nested_a->attributes()) == &(i_nested_symbol_a->attributes()));
 
     auto [i_search_b, found_b] = nested_st->find("b", use_position);
     REQUIRE(not found_b);   // "b" is not defined in any symbol table
diff --git a/tests/test_UnaryExpressionProcessor.cpp b/tests/test_UnaryExpressionProcessor.cpp
index f20c42e6d..7947f3f60 100644
--- a/tests/test_UnaryExpressionProcessor.cpp
+++ b/tests/test_UnaryExpressionProcessor.cpp
@@ -22,33 +22,33 @@
 
 #include <sstream>
 
-#define CHECK_UNARY_EXPRESSION_RESULT(data, variable_name, expected_value)  \
-  {                                                                         \
-    string_input input{data, "test.pgs"};                                   \
-    auto ast = ASTBuilder::build(input);                                    \
-                                                                            \
-    ASTSymbolTableBuilder{*ast};                                            \
-    ASTNodeDataTypeBuilder{*ast};                                           \
-    ASTNodeValueBuilder{*ast};                                              \
-                                                                            \
-    ASTNodeDeclarationToAffectationConverter{*ast};                         \
-    ASTNodeDeclarationCleaner{*ast};                                        \
-                                                                            \
-    ASTNodeExpressionBuilder{*ast};                                         \
-    ExecUntilBreakOrContinue exec_policy;                                   \
-    ast->execute(exec_policy);                                              \
-                                                                            \
-    auto symbol_table = ast->m_symbol_table;                                \
-                                                                            \
-    using namespace TAO_PEGTL_NAMESPACE;                                    \
-    position use_position{internal::iterator{"fixture"}, "fixture"};        \
-    use_position.byte    = 10000;                                           \
-    auto [symbol, found] = symbol_table->find(variable_name, use_position); \
-                                                                            \
-    auto attribute = symbol->second;                                        \
-    auto value     = std::get<decltype(expected_value)>(attribute.value()); \
-                                                                            \
-    REQUIRE(value == expected_value);                                       \
+#define CHECK_UNARY_EXPRESSION_RESULT(data, variable_name, expected_value)    \
+  {                                                                           \
+    string_input input{data, "test.pgs"};                                     \
+    auto ast = ASTBuilder::build(input);                                      \
+                                                                              \
+    ASTSymbolTableBuilder{*ast};                                              \
+    ASTNodeDataTypeBuilder{*ast};                                             \
+    ASTNodeValueBuilder{*ast};                                                \
+                                                                              \
+    ASTNodeDeclarationToAffectationConverter{*ast};                           \
+    ASTNodeDeclarationCleaner{*ast};                                          \
+                                                                              \
+    ASTNodeExpressionBuilder{*ast};                                           \
+    ExecUntilBreakOrContinue exec_policy;                                     \
+    ast->execute(exec_policy);                                                \
+                                                                              \
+    auto symbol_table = ast->m_symbol_table;                                  \
+                                                                              \
+    using namespace TAO_PEGTL_NAMESPACE;                                      \
+    position use_position{internal::iterator{"fixture"}, "fixture"};          \
+    use_position.byte    = 10000;                                             \
+    auto [symbol, found] = symbol_table->find(variable_name, use_position);   \
+                                                                              \
+    auto attributes = symbol->attributes();                                   \
+    auto value      = std::get<decltype(expected_value)>(attributes.value()); \
+                                                                              \
+    REQUIRE(value == expected_value);                                         \
   }
 
 TEST_CASE("UnaryExpressionProcessor", "[language]")
diff --git a/tests/test_WhileProcessor.cpp b/tests/test_WhileProcessor.cpp
index 0b947150c..9d58d96e0 100644
--- a/tests/test_WhileProcessor.cpp
+++ b/tests/test_WhileProcessor.cpp
@@ -22,33 +22,33 @@
 
 #include <sstream>
 
-#define CHECK_WHILE_PROCESSOR_RESULT(data, variable_name, expected_value)   \
-  {                                                                         \
-    string_input input{data, "test.pgs"};                                   \
-    auto ast = ASTBuilder::build(input);                                    \
-                                                                            \
-    ASTSymbolTableBuilder{*ast};                                            \
-    ASTNodeDataTypeBuilder{*ast};                                           \
-    ASTNodeValueBuilder{*ast};                                              \
-                                                                            \
-    ASTNodeDeclarationToAffectationConverter{*ast};                         \
-    ASTNodeDeclarationCleaner{*ast};                                        \
-                                                                            \
-    ASTNodeExpressionBuilder{*ast};                                         \
-    ExecUntilBreakOrContinue exec_policy;                                   \
-    ast->execute(exec_policy);                                              \
-                                                                            \
-    auto symbol_table = ast->m_symbol_table;                                \
-                                                                            \
-    using namespace TAO_PEGTL_NAMESPACE;                                    \
-    position use_position{internal::iterator{"fixture"}, "fixture"};        \
-    use_position.byte    = 10000;                                           \
-    auto [symbol, found] = symbol_table->find(variable_name, use_position); \
-                                                                            \
-    auto attribute = symbol->second;                                        \
-    auto value     = std::get<decltype(expected_value)>(attribute.value()); \
-                                                                            \
-    REQUIRE(value == expected_value);                                       \
+#define CHECK_WHILE_PROCESSOR_RESULT(data, variable_name, expected_value)     \
+  {                                                                           \
+    string_input input{data, "test.pgs"};                                     \
+    auto ast = ASTBuilder::build(input);                                      \
+                                                                              \
+    ASTSymbolTableBuilder{*ast};                                              \
+    ASTNodeDataTypeBuilder{*ast};                                             \
+    ASTNodeValueBuilder{*ast};                                                \
+                                                                              \
+    ASTNodeDeclarationToAffectationConverter{*ast};                           \
+    ASTNodeDeclarationCleaner{*ast};                                          \
+                                                                              \
+    ASTNodeExpressionBuilder{*ast};                                           \
+    ExecUntilBreakOrContinue exec_policy;                                     \
+    ast->execute(exec_policy);                                                \
+                                                                              \
+    auto symbol_table = ast->m_symbol_table;                                  \
+                                                                              \
+    using namespace TAO_PEGTL_NAMESPACE;                                      \
+    position use_position{internal::iterator{"fixture"}, "fixture"};          \
+    use_position.byte    = 10000;                                             \
+    auto [symbol, found] = symbol_table->find(variable_name, use_position);   \
+                                                                              \
+    auto attributes = symbol->attributes();                                   \
+    auto value      = std::get<decltype(expected_value)>(attributes.value()); \
+                                                                              \
+    REQUIRE(value == expected_value);                                         \
   }
 
 TEST_CASE("WhileProcessor", "[language]")
-- 
GitLab