11#ifndef ARK_COMPILER_EXECUTOR_HPP 
   12#define ARK_COMPILER_EXECUTOR_HPP 
   15#include <unordered_map> 
AST node used by the parser, optimizer and compiler.
 
A class that applies macros in a Node.
 
void applyMacroProxy(Node &node, unsigned depth)
Apply a macro on a given node.
 
virtual Node macroNode(Node &node)=0
Returns the macro node that will be expanded.
 
virtual bool canHandle(Node &node)=0
Checks if the executor can apply a macro on the passed Node.
 
MacroExecutor(MacroProcessor *processor, unsigned debug=0)
Construct a new Macro Executor object.
 
virtual bool applyMacro(Node &node, unsigned depth)=0
Executes macros in the Node if the Executor can handle it.
 
virtual ~MacroExecutor()=default
Need a virtual destructor to correctly destroy object.
 
void throwMacroProcessingError(const std::string &message, const Node &node)
Throw a macro processing error.
 
MacroProcessor * m_processor
This is a non-owned pointer.
 
Node evaluate(Node &node, unsigned depth, bool is_not_body) const
Evaluate only the macros.
 
bool isTruthy(const Node &node) const
Check if a node can be evaluated to true.
 
void handleMacroNode(Node &node) const
Registers macros based on their type, expand conditional macros.
 
const Node * findNearestMacro(const std::string &name) const
Find the nearest macro matching a giving name.
 
The class handling the macros definitions and calls, given an AST.
 
A node of an Abstract Syntax Tree for ArkScript.