aboutsummaryrefslogtreecommitdiff
path: root/src/tree.h
blob: e2eb7a665cec81ace01968c3f512bb359064736f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef PARSER_SRC_NODE_H_
#define PARSER_SRC_NODE_H_

#include <memory>
#include <string>
#include <vector>

#include "nodes.h"

namespace SimpleParser {

class Tree {
	public:
		Tree(const std::string&, const ConstantMap*);
		explicit Tree(const std::string&);

		double solve()      const;
		std::string print() const;

	private:
		template <class NodeType, typename... Args>
		Node* addNode(Args&&... args);

		Node* buildTree(const std::string&);

		const std::string  term_;
		const ConstantMap* constants_;

		std::vector<std::unique_ptr<Node>> node_collection_;
		Node* const root_node_;
};

}

#endif  // PARSER_SRC_NODE_H_