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:
[legend]
Collaboration diagram for Ark::internal::FunctionExecutor:
[legend]

Public Member Functions

bool applyMacro (Node &node, unsigned depth) override
 
bool canHandle (Node &node) override
 
 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.
 

Private Member Functions

void unify (const std::unordered_map< std::string, Node > &map, Node &target, Node *parent, std::size_t index=0, std::size_t unify_depth=0)
 

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 applyMacroProxy (Node &node, unsigned depth)
 Apply a macro on a given node.
 
void handleMacroNode (Node &node) const
 Registers macros based on their type, expand conditional macros.
 
bool isTruthy (const Node &node) const
 Check if a node can be evaluated to true.
 
Node evaluate (Node &node, unsigned depth, bool is_not_body) const
 Evaluate only the macros.
 
- Static Protected Member Functions inherited from Ark::internal::MacroExecutor
static void throwMacroProcessingError (const std::string &message, const Node &node)
 Throw a macro processing error.
 
- 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)
nodiscardoverridevirtual
Parameters
node
Returns
true if the executor can handle the given node

Implements Ark::internal::MacroExecutor.

Definition at line 11 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 37 of file Executor.cpp.

◆ unify()

void Ark::internal::FunctionExecutor::unify ( const std::unordered_map< std::string, Node > & map,
Node & target,
Node * parent,
std::size_t index = 0,
std::size_t unify_depth = 0 )
private

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