mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-07 15:38:49 +00:00
name tree mostly finished
This commit is contained in:
parent
263b58a17c
commit
fc114ff959
14 changed files with 116 additions and 38 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue