diff options
author | Adrian Kummerlaender | 2014-09-25 19:11:41 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2014-09-25 19:11:41 +0200 |
commit | 5be4662e4d7da993373aff1435c68e68c349f09f (patch) | |
tree | 559bd440de3d6c7a7b7f2e982438ba3298f2a06f | |
parent | 2fcef9b48bb97da82d5828776e9be50be1fdafbc (diff) | |
download | SimpleParser-5be4662e4d7da993373aff1435c68e68c349f09f.tar SimpleParser-5be4662e4d7da993373aff1435c68e68c349f09f.tar.gz SimpleParser-5be4662e4d7da993373aff1435c68e68c349f09f.tar.bz2 SimpleParser-5be4662e4d7da993373aff1435c68e68c349f09f.tar.lz SimpleParser-5be4662e4d7da993373aff1435c68e68c349f09f.tar.xz SimpleParser-5be4662e4d7da993373aff1435c68e68c349f09f.tar.zst SimpleParser-5be4662e4d7da993373aff1435c68e68c349f09f.zip |
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
-rw-r--r-- | src/tree.cc | 30 |
1 files 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<Node*>& stack) { - if ( !stack.empty() ) { - return stack.top(); - } else { - throw operator_exception(); + inline Node* topNode(const std::stack<Node*>& stack) { + if ( !stack.empty() ) { + return stack.top(); + } else { + throw SimpleParser::operator_exception(); + } } -} -inline Node* popNode(std::stack<Node*>& stack) { - Node*const tmp = topNode(stack); - stack.pop(); + inline Node* popNode(std::stack<Node*>& 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), |