![]() |
ArkScript
A small, fast, functional and scripting language for video games
|
Handles Conditional macros. More...
#include <Conditional.hpp>
Public Member Functions | |
bool | applyMacro (Node &node) override |
Executes macros in the Node if the Executor can handle it. | |
bool | canHandle (Node &node) override |
Checks if the executor can apply a macro on the passed Node. | |
MacroExecutor (MacroProcessor *macroprocessor, unsigned debug=0) | |
Construct a new Macro Executor object. | |
![]() | |
MacroExecutor (MacroProcessor *macroprocessor, unsigned debug=0) | |
Construct a new Macro Executor object. | |
virtual | ~MacroExecutor () |
Need a virtual destructor to correctly destory object. | |
virtual bool | applyMacro (Node &node)=0 |
Executes macros in the Node if the Executor can handle it. | |
virtual bool | canHandle (Node &node)=0 |
Checks if the executor can apply a macro on the passed Node. | |
Additional Inherited Members | |
![]() | |
const Node * | findNearestMacro (const std::string &name) const |
Find the nearest macro matching a giving name. | |
void | registerMacro (Node &node) |
Registers macros based on their type. | |
bool | isTruthy (const Node &node) |
Check if a node can be evaluated to true. | |
Node | evaluate (Node &node, bool is_not_body) |
Evaluate only the macros. | |
void | unify (const std::unordered_map< std::string, Node > &, Node &, Node *) |
Applies the spread operator. | |
void | throwMacroProcessingError (const std::string &message, const Node &node) |
Throw a macro processing error. | |
bool | applyMacroProxy (Node &node) |
Execute a node, trying to emplace macros calls. | |
bool | isPredefined (const std::string &symbol) |
Check if a given symbol is a predefined macro. | |
![]() | |
unsigned int | m_debug |
MacroProcessor * | m_macroprocessor |
Handles Conditional macros.
Definition at line 24 of file Conditional.hpp.
|
overridevirtual |
Executes macros in the Node if the Executor can handle it.
node | the node that contains a macro |
Implements Ark::internal::MacroExecutor.
Definition at line 5 of file Conditional.cpp.
References Ark::internal::Node::constList(), Ark::internal::MacroExecutor::evaluate(), Ark::internal::Node::getNilNode(), Ark::internal::If, Ark::internal::MacroExecutor::isTruthy(), Ark::internal::Node::keyword(), Ark::internal::Node::list(), Ark::internal::Macro, Ark::internal::Node::nodeType(), Ark::internal::MacroExecutor::registerMacro(), Ark::internal::Node::setNodeType(), and Ark::internal::Unused.
|
overridevirtual |
Checks if the executor can apply a macro on the passed Node.
node | the node that contains a macro |
Implements Ark::internal::MacroExecutor.
Definition at line 37 of file Conditional.cpp.
References Ark::internal::Keyword, Ark::internal::Node::list(), Ark::internal::Macro, and Ark::internal::Node::nodeType().
Ark::internal::MacroExecutor::MacroExecutor | ( | MacroProcessor * | macroprocessor, |
unsigned | debug = 0 |
||
) |
Construct a new Macro Executor object.
macroprocessor | |
debug |
Definition at line 36 of file Executor.cpp.
References Ark::internal::MacroExecutor::m_macroprocessor, and Ark::internal::MacroProcessor::unify().