@@ -55,8 +55,9 @@ namespace Ark::internal
5555 friend class MacroExecutor ;
5656
5757 private:
58- Node m_ast; // /< The modified AST
59- std::vector<MacroScope> m_macros; // /< Handling macros in a scope fashion
58+ Node m_ast; // /< The modified AST
59+ std::vector<MacroScope> m_macros; // /< Handling macros in a scope fashion
60+ std::vector<Node> m_macros_being_applied; // /< Stack of macros being applied. The last one is the current one we are working on
6061 std::shared_ptr<MacroExecutor> m_conditional_executor;
6162 std::vector<std::shared_ptr<MacroExecutor>> m_executors;
6263 std::unordered_map<std::string, Node> m_defined_functions;
@@ -152,7 +153,7 @@ namespace Ark::internal
152153 * @param name the name of the macro being applied
153154 * @param kind the macro kind, empty by default (eg "operator", "condition")
154155 */
155- static void checkMacroArgCountEq (const Node& node, std::size_t expected, const std::string& name, const std::string& kind = " " );
156+ void checkMacroArgCountEq (const Node& node, std::size_t expected, const std::string& name, const std::string& kind = " " );
156157
157158 /* *
158159 * @brief Check if the given node has at least the provided argument count, otherwise throws an error
@@ -162,7 +163,7 @@ namespace Ark::internal
162163 * @param name the name of the macro being applied
163164 * @param kind the macro kind, empty by default (eg "operator", "condition")
164165 */
165- static void checkMacroArgCountGe (const Node& node, std::size_t expected, const std::string& name, const std::string& kind = " " );
166+ void checkMacroArgCountGe (const Node& node, std::size_t expected, const std::string& name, const std::string& kind = " " );
166167
167168 /* *
168169 * @brief Evaluate only the macros
@@ -181,15 +182,15 @@ namespace Ark::internal
181182 * @return true
182183 * @return false
183184 */
184- static bool isTruthy (const Node& node);
185+ bool isTruthy (const Node& node);
185186
186187 /* *
187188 * @brief Throw a macro processing error
188189 *
189190 * @param message the error
190191 * @param node the node in which there is an error
191192 */
192- [[noreturn]] static void throwMacroProcessingError (const std::string& message, const Node& node);
193+ [[noreturn]] void throwMacroProcessingError (const std::string& message, const Node& node) const ;
193194 };
194195}
195196
0 commit comments