VapourSynth-llvmexpr
Loading...
Searching...
No Matches
SymbolTable.hpp
Go to the documentation of this file.
1
19
20#ifndef LLVMEXPR_FRONTEND_INFIX2POSTFIX_SYMBOLTABLE_HPP
21#define LLVMEXPR_FRONTEND_INFIX2POSTFIX_SYMBOLTABLE_HPP
22
23#include "Symbol.hpp"
24
25#include <map>
26#include <memory>
27#include <string>
28
29namespace infix2postfix {
30
32 public:
33 explicit SymbolTable(SymbolTable* parent = nullptr);
34
35 bool define(const std::shared_ptr<Symbol>& symbol);
36
37 [[nodiscard]] std::shared_ptr<Symbol>
38 resolve(const std::string& name) const;
39
40 [[nodiscard]] SymbolTable* getParent() const { return parent; }
41
42 [[nodiscard]] const std::map<std::string, std::shared_ptr<Symbol>>&
43 getSymbols() const {
44 return symbols;
45 }
46
47 private:
48 SymbolTable* parent;
49 std::map<std::string, std::shared_ptr<Symbol>> symbols;
50};
51
52} // namespace infix2postfix
53
54#endif // LLVMEXPR_FRONTEND_INFIX2POSTFIX_SYMBOLTABLE_HPP
const std::map< std::string, std::shared_ptr< Symbol > > & getSymbols() const
bool define(const std::shared_ptr< Symbol > &symbol)
SymbolTable * getParent() const
std::shared_ptr< Symbol > resolve(const std::string &name) const
SymbolTable(SymbolTable *parent=nullptr)