diff options
Diffstat (limited to 'src/tree.cc')
-rw-r--r-- | src/tree.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tree.cc b/src/tree.cc index 2dfb786..e63b7b3 100644 --- a/src/tree.cc +++ b/src/tree.cc @@ -41,7 +41,7 @@ std::string Tree::print() { << "\"];" << std::endl; - if ( (*it)->getType() == NodeType::OPERATOR_NODE ) { + if ( (*it)->getType() == NodeType::OPERATOR ) { for ( auto iter = this->node_collection_.begin(); iter != this->node_collection_.end(); ++iter ) { @@ -96,9 +96,9 @@ Node* Tree::addOperand(Node** place, std::string value) { return this->node_collection_.back().get(); } -Node* Tree::addOperator(Node** place, char oper) { +Node* Tree::addOperator(Node** place, TokenType token) { this->node_collection_.emplace_back( - new OperatorNode(oper) + new OperatorNode(token) ); if ( place != nullptr ) { @@ -137,9 +137,9 @@ Node* Tree::buildTree(std::string term) { static_cast<OperatorNode*>(topNodeFrom(operatorStack)) ); - if ( token > getTokenType(lastNode->getFunction()) ) { + if ( token > lastNode->getToken() ) { operatorStack.push( - this->addOperator(nullptr, currTerm[0]) + this->addOperator(nullptr, token) ); } else { Node* currOperator = topNodeFrom(operatorStack); @@ -157,7 +157,7 @@ Node* Tree::buildTree(std::string term) { } } else { operatorStack.push( - this->addOperator(nullptr, currTerm[0]) + this->addOperator(nullptr, token) ); } } else { |