blob: 76d9153313ce0c3b0a66aa54a9dcc692e83b680b (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 | #include "cru/parse/ParsingTreeNode.h"
namespace cru::parse {
ParsingTreeNode::ParsingTreeNode(Symbol* symbol, Production* production)
    : symbol_(symbol), production_(production) {}
ParsingTreeNode::~ParsingTreeNode() {
  for (auto child : children_) {
    delete child;
  }
}
Grammar* ParsingTreeNode::GetGrammar() const { return symbol_->GetGrammar(); }
void ParsingTreeNode::AddChild(ParsingTreeNode* child) {
  children_.push_back(child);
}
void ParsingTreeNode::AddChild(ParsingTreeNode* child, Index index) {
  children_.insert(children_.begin() + index, child);
}
void ParsingTreeNode::RemoveChild(Index index) {
  delete children_[index];
  children_.erase(children_.begin() + index);
}
}  // namespace cru::parse
 |