name tree mostly finished

This commit is contained in:
ProgramSnail 2023-07-28 19:42:09 +03:00
parent 263b58a17c
commit fc114ff959
14 changed files with 116 additions and 38 deletions

View file

@ -19,6 +19,8 @@ public:
bool insert(const std::string &path, nodes::Statement &&statement);
bool insert(const std::string &path, const nodes::Statement &statement);
std::optional<nodes::Statement *> find(const std::string &path);
std::optional<const nodes::Statement *> find(const std::string &path) const;
@ -48,6 +50,14 @@ private:
return true;
}
bool set_statement(const nodes::Statement &statement) {
if (statement_.has_value()) {
return false;
}
statement_ = statement;
return true;
}
std::optional<size_t> find(size_t name_id) const {
auto name_iter = children_.find(name_id);