From 5be4662e4d7da993373aff1435c68e68c349f09f Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 25 Sep 2014 19:11:41 +0200 Subject: Declared "{top|pop}Node" helper methods local to their compilation unit * there is no reason for exposing them to be potentially linked to from other compilation units --- src/tree.cc | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/tree.cc b/src/tree.cc index bc1414b..77d9f4e 100644 --- a/src/tree.cc +++ b/src/tree.cc @@ -7,28 +7,26 @@ #include "utils.h" -namespace SimpleParser { +namespace { + using SimpleParser::Node; -inline Node* topNode(const std::stack& stack) { - if ( !stack.empty() ) { - return stack.top(); - } else { - throw operator_exception(); + inline Node* topNode(const std::stack& stack) { + if ( !stack.empty() ) { + return stack.top(); + } else { + throw SimpleParser::operator_exception(); + } } -} -inline Node* popNode(std::stack& stack) { - Node*const tmp = topNode(stack); - stack.pop(); + inline Node* popNode(std::stack& stack) { + Node*const tmp = topNode(stack); + stack.pop(); - return tmp; + return tmp; + } } -Tree::Tree(std::string term): - term_(term), - constants_(nullptr) { - this->root_node_ = this->buildTree(term); -} +namespace SimpleParser { Tree::Tree(std::string term, const ConstantMap* constants): term_(term), -- cgit v1.2.3