aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-09-25 19:11:41 +0200
committerAdrian Kummerlaender2014-09-25 19:11:41 +0200
commit5be4662e4d7da993373aff1435c68e68c349f09f (patch)
tree559bd440de3d6c7a7b7f2e982438ba3298f2a06f /src
parent2fcef9b48bb97da82d5828776e9be50be1fdafbc (diff)
downloadSimpleParser-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
Diffstat (limited to 'src')
-rw-r--r--src/tree.cc30
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),