VapourSynth-llvmexpr
Loading...
Searching...
No Matches
infix2postfix::SymbolTable Class Reference

#include <llvmexpr/frontend/infix2postfix/SymbolTable.hpp>

Public Member Functions

 SymbolTable (SymbolTable *parent=nullptr)
bool define (const std::shared_ptr< Symbol > &symbol)
std::shared_ptr< Symbolresolve (const std::string &name) const
SymbolTablegetParent () const
const std::map< std::string, std::shared_ptr< Symbol > > & getSymbols () const

Detailed Description

Definition at line 31 of file SymbolTable.hpp.

Constructor & Destructor Documentation

◆ SymbolTable()

infix2postfix::SymbolTable::SymbolTable ( SymbolTable * parent = nullptr)
explicit

Definition at line 24 of file SymbolTable.cpp.

24: parent(parent) {}

References SymbolTable().

Referenced by getParent(), and SymbolTable().

Member Function Documentation

◆ define()

bool infix2postfix::SymbolTable::define ( const std::shared_ptr< Symbol > & symbol)

Definition at line 26 of file SymbolTable.cpp.

26 {
27 if (symbols.contains(symbol->name)) {
28 return false;
29 }
30 symbols[symbol->name] = symbol;
31 return true;
32}

◆ getParent()

SymbolTable * infix2postfix::SymbolTable::getParent ( ) const
inlinenodiscard

Definition at line 40 of file SymbolTable.hpp.

40{ return parent; }

References SymbolTable().

◆ getSymbols()

const std::map< std::string, std::shared_ptr< Symbol > > & infix2postfix::SymbolTable::getSymbols ( ) const
inlinenodiscard

Definition at line 43 of file SymbolTable.hpp.

43 {
44 return symbols;
45 }

◆ resolve()

std::shared_ptr< Symbol > infix2postfix::SymbolTable::resolve ( const std::string & name) const
nodiscard

Definition at line 34 of file SymbolTable.cpp.

34 {
35 auto it = symbols.find(name);
36 if (it != symbols.end()) {
37 return it->second;
38 }
39 if (parent != nullptr) {
40 return parent->resolve(name);
41 }
42 return nullptr;
43}

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