35 static T get() {
return nullptr; }
39 static bool get() {
return false; }
76 if(it->second.empty()) {
110 if(it !=
mSymTable.end() && !it->second.empty()) {
111 auto&
entry = it->second.top();
136 if(it !=
mSymTable.end() && !it->second.empty()) {
137 return it->second.top().symbol;
145 if(it !=
mSymTable.end() && !it->second.empty()) {
146 const auto&
sym = it->second.top();
159 if(!
sym.second.empty()) {
160 const auto&
symRef =
sym.second.top().symbol;
Definition SymbolTable.hpp:231
bool addSymbolRef(AST *ast)
FunctionDeclaration * fetchFunctionDeclaration(bool throwOnFailure=true) const
Vector< AST * > mRefs
Definition SymbolTable.hpp:256
String mIdent
Definition SymbolTable.hpp:255
FunctionDeclaration * fetchFunctionDeclaration(const Vector< TypeDenoterPtr > &argTypeDenoters) const
Declaration * fetchType(bool throwOnFailure=true) const
Fetches a type declaration (StructDecl, AliasDecl).
ASTSymbolOverload(const String &ident, AST *ast)
VarDeclaration * fetchVarDeclaration(bool throwOnFailure=true) const
AST * fetch(bool throwOnFailure=true) const
Definition SymbolTable.hpp:43
SymbolType fetch(const String &ident) const
Definition SymbolTable.hpp:134
UniqueFunction< bool(const SymbolType &symbol) const > SearchPredicateProc
Definition SymbolTable.hpp:52
Map< String, Stack< Symbol > > mSymTable
Definition SymbolTable.hpp:217
UniqueFunction< void(const SymbolType &symbol) const > OnReleaseProc
Definition SymbolTable.hpp:49
bool isInsideGlobalScope() const
Definition SymbolTable.hpp:208
UniqueFunction< bool(SymbolType &prevSymbol) const > OnOverrideProc
Definition SymbolTable.hpp:46
void openScope()
Definition SymbolTable.hpp:57
std::size_t getScopeLevel() const
Definition SymbolTable.hpp:205
Vector< Vector< Symbol > > mSymTableAnonymous
Definition SymbolTable.hpp:220
String fetchSimilar(const String &ident) const
Definition SymbolTable.hpp:182
bool register_(const String &ident, SymbolType symbol, const OnOverrideProc &overrideProc=nullptr, const bool throwOnFailure=true)
Registers the specified symbol in the current scope (if the identifier is not empty).
Definition SymbolTable.hpp:98
void closeScope(const OnReleaseProc &releaseProc=nullptr)
Definition SymbolTable.hpp:63
SymbolTable()
Definition SymbolTable.hpp:54
Stack< Vector< String > > mScopeStack
Stores all identifiers for the current stack.
Definition SymbolTable.hpp:224
SymbolType fetchFromCurrentScope(const String &ident) const
Definition SymbolTable.hpp:143
SymbolType find(const SearchPredicateProc &searchPredicate) const
Definition SymbolTable.hpp:155
AST * fetchASTFromSymbol< ASTSymbolOverloadPtr >(const ASTSymbolOverloadPtr &symbol)
Definition SymbolTable.hpp:267
void runtimeErrIdentAlreadyDeclared(const String &ident, const AST *prevDeclarationAST=nullptr)
UInt32 stringDistance(const String &a, const String &b)
AST * fetchASTFromSymbol(const SymbolType &symbol)
Definition SymbolTable.hpp:265
SPtr< ASTSymbolOverload > ASTSymbolOverloadPtr
Definition SymbolTable.hpp:259
void runtimeErrNoActiveScope()
std::stack< T, Container > Stack
The Stack class is a container adapter that gives the programmer the functionality of a stack - speci...
Definition Stack.hpp:18
std::shared_ptr< T > SPtr
SPtr is a smart pointer that retains shared ownership of an object through a pointer.
Definition SmartPtr.hpp:37
std::vector< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Vector
Vector is a sequence container that encapsulates dynamic size arrays.
Definition Vector.hpp:17
std::uint32_t UInt32
Definition DataTypes.hpp:23
FunctionBase< true, false, fu2::capacity_default, true, false, Signatures... > UniqueFunction
An owning non copyable function wrapper for arbitrary callable types.
Definition Function.hpp:59
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
std::map< Key, T, Compare, ScopedAllocatorAdaptor< StdAllocator< Pair< const Key, T >, RawAllocator > > > Map
Map is a sorted associative container that contains key-value pairs with unique keys.
Definition Map.hpp:24
static bool get()
Definition SymbolTable.hpp:39
Definition SymbolTable.hpp:34
static T get()
Definition SymbolTable.hpp:35
Definition SymbolTable.hpp:211
std::size_t scopeLevel
Definition SymbolTable.hpp:213
SymbolType symbol
Definition SymbolTable.hpp:212