aboutsummaryrefslogtreecommitdiff
path: root/src/tree.h
blob: 0db1404d5f71c9d9c42c233b4e4ff88e821fee3c (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 {

typedef std::vector<std::unique_ptr<Node>> NodeCollection;

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

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

	private:
		template <class NType, typename... Args>
		Node* addNode(Node**, Args&&... args);
		Node* buildTree(std::string);

		std::string term_;
		Node* root_node_;
		NodeCollection node_collection_;
		const ConstantMap* constants_;
};

}

#endif  // PARSER_SRC_NODE_H_