9 m_macroprocessor(macroprocessor)
The base class for all MacroExecutors.
Handles the macros and their expansion in ArkScript source code.
Node evaluate(Node &node, bool is_not_body)
Evaluate only the macros.
MacroExecutor(MacroProcessor *macroprocessor, unsigned debug=0)
Construct a new Macro Executor object.
MacroProcessor * m_macroprocessor
bool isTruthy(const Node &node)
Check if a node can be evaluated to true.
void throwMacroProcessingError(const std::string &message, const Node &node)
Throw a macro processing error.
virtual ~MacroExecutor()
Need a virtual destructor to correctly destory object.
void registerMacro(Node &node)
Registers macros based on their type.
void unify(const std::unordered_map< std::string, Node > &, Node &, Node *)
Applies the spread operator.
bool isPredefined(const std::string &symbol)
Check if a given symbol is a predefined macro.
const Node * findNearestMacro(const std::string &name) const
Find the nearest macro matching a giving name.
bool applyMacroProxy(Node &node)
Execute a node, trying to emplace macros calls.
The class handling the macros definitions and calls, given an AST.
void unify(const std::unordered_map< std::string, Node > &map, Node &target, Node *parent, std::size_t index=0)
Unify a target node with a given map symbol => replacement node, recursively.
void registerMacro(Node &node)
Registers macros based on their type.
Node evaluate(Node &node, bool is_not_body=false)
Evaluate only the macros.
const Node * findNearestMacro(const std::string &name) const
Find the nearest macro matching a given name.
bool isTruthy(const Node &node)
Check if a node can be evaluated to true.
void throwMacroProcessingError(const std::string &message, const Node &node)
Throw a macro processing error.
bool isPredefined(const std::string &symbol)
Check if a given symbol is a predefined macro or not.
bool applyMacro(Node &node)
Apply a macro on a given node.
A node of an Abstract Syntax Tree for ArkScript.