aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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),