12#ifndef COMPILER_MACROS_SCOPE_HPP
13#define COMPILER_MACROS_SCOPE_HPP
17#include <unordered_map>
38 [[nodiscard]]
const Node*
has(
const std::string& name)
const;
46 void add(
const std::string& name,
const Node& node);
55 bool remove(
const std::string& name);
63 [[nodiscard]]
bool empty()
const
68 [[nodiscard]]
unsigned int depth()
const
74 std::unordered_map<std::string, Node>
m_macros;
AST node used by the parser, optimizer and compiler.
bool remove(const std::string &name)
Remove a macro in the scope, if it exists.
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.
std::unordered_map< std::string, Node > m_macros
MacroScope(unsigned int depth)
Construct a new MacroScope object given a depth in the scope hierarchy.
unsigned int depth() const
void add(const std::string &name, const Node &node)
Add a new entry in the scope.
bool empty() const
Return true if the current scope is empty.
A node of an Abstract Syntax Tree for ArkScript.