Add default constructor for Symbol

SymbolTable should probably have different methods for adding a Symbol
to the table, instead of [] operator.
This commit is contained in:
Teon Banek 2017-03-11 15:39:02 +01:00
parent 425e1f8907
commit 3adce8313c

View File

@ -7,6 +7,7 @@
namespace query { namespace query {
struct Symbol { struct Symbol {
Symbol() {}
Symbol(std::string& name, int position) : name_(name), position_(position) {} Symbol(std::string& name, int position) : name_(name), position_(position) {}
std::string name_; std::string name_;
int position_; int position_;
@ -19,10 +20,6 @@ class SymbolTable {
return Symbol(name, position); return Symbol(name, position);
} }
void AssignSymbol(const Tree& tree, Symbol symbol) {
table_[tree.uid()] = symbol;
}
auto& operator[](const Tree& tree) { return table_[tree.uid()]; } auto& operator[](const Tree& tree) { return table_[tree.uid()]; }
int max_position() const { return position_; } int max_position() const { return position_; }