ArkScript
A small, fast, functional and scripting language for video games
Ark::internal::FunctionExecutor Class Referencefinal

Handles function macros. More...

#include <Function.hpp>

+ Inheritance diagram for Ark::internal::FunctionExecutor:
+ Collaboration diagram for Ark::internal::FunctionExecutor:

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 *processor, unsigned debug=0)
 Construct a new Macro Executor object.
 
- Public Member Functions inherited from Ark::internal::MacroExecutor
 MacroExecutor (MacroProcessor *processor, unsigned debug=0)
 Construct a new Macro Executor object.
 
virtual ~MacroExecutor ()=default
 Need a virtual destructor to correctly destroy 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

- Protected Member Functions inherited from Ark::internal::MacroExecutor
const NodefindNearestMacro (const std::string &name) const
 Find the nearest macro matching a giving name.
 
void registerMacro (Node &node) const
 Registers macros based on their type.
 
bool isTruthy (const Node &node) const
 Check if a node can be evaluated to true.
 
Node evaluate (Node &node, bool is_not_body) const
 Evaluate only the macros.
 
void unify (const std::unordered_map< std::string, Node > &, Node &, Node *) const
 Applies the spread operator.
 
void throwMacroProcessingError (const std::string &message, const Node &node) const
 Throw a macro processing error.
 
bool applyMacroProxy (Node &node) const
 Execute a node, trying to emplace macros calls.
 
bool isPredefined (const std::string &symbol) const
 Check if a given symbol is a predefined macro.
 
- Protected Attributes inherited from Ark::internal::MacroExecutor
unsigned int m_debug
 
MacroProcessorm_processor
 This is a non-owned pointer.
 

Detailed Description

Handles function macros.

Definition at line 24 of file Function.hpp.

Member Function Documentation

◆ applyMacro()

◆ canHandle()

bool Ark::internal::FunctionExecutor::canHandle ( Node node)
overridevirtual

Checks if the executor can apply a macro on the passed Node.

Parameters
nodethe node that contains a macro

Implements Ark::internal::MacroExecutor.

Definition at line 7 of file Function.cpp.

References Ark::internal::Node::constList(), Ark::internal::List, Ark::internal::Node::nodeType(), and Ark::internal::Symbol.

◆ MacroExecutor()

Ark::internal::MacroExecutor::MacroExecutor ( MacroProcessor processor,
unsigned  debug = 0 
)
explicit

Construct a new Macro Executor object.

Parameters
processor
debug

Definition at line 36 of file Executor.cpp.


The documentation for this class was generated from the following files: