![]() |
ArkScript
A small, lisp-inspired, functional scripting language
|
#include <MacroScope.hpp>
Public Member Functions | |
| MacroScope (unsigned int depth) | |
| Construct a new MacroScope object given a depth in the scope hierarchy. | |
| const Node * | has (const std::string &name) const |
| Check if the current scope holds a value for a given symbol, and returns it as a pointer. | |
| void | add (const std::string &name, const Node &node) |
| Add a new entry in the scope. | |
| bool | remove (const std::string &name) |
| Remove a macro in the scope, if it exists. | |
| bool | empty () const |
| Return true if the current scope is empty. | |
| unsigned int | depth () const |
Private Attributes | |
| std::unordered_map< std::string, Node > | m_macros |
| unsigned int | m_depth { 0 } |
Definition at line 21 of file MacroScope.hpp.
|
explicit |
Construct a new MacroScope object given a depth in the scope hierarchy.
| depth |
Definition at line 5 of file MacroScope.cpp.
| void Ark::internal::MacroScope::add | ( | const std::string & | name, |
| const Node & | node ) |
Add a new entry in the scope.
| name | |
| node |
Definition at line 16 of file MacroScope.cpp.
References m_macros.
|
inlinenodiscard |
Definition at line 67 of file MacroScope.hpp.
References m_depth.
|
inlinenodiscard |
Return true if the current scope is empty.
Definition at line 62 of file MacroScope.hpp.
References m_macros.
|
nodiscard |
Check if the current scope holds a value for a given symbol, and returns it as a pointer.
| name |
Definition at line 9 of file MacroScope.cpp.
References m_macros.
| bool Ark::internal::MacroScope::remove | ( | const std::string & | name | ) |
Remove a macro in the scope, if it exists.
| name |
Definition at line 21 of file MacroScope.cpp.
References m_macros.
|
private |
Definition at line 74 of file MacroScope.hpp.
Referenced by depth().
|
private |