aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerländer2013-10-29 18:08:01 +0100
committerAdrian Kummerländer2013-10-29 18:08:01 +0100
commit5b773d6a0ec801161f97fc5159d1f9c5a75c29c9 (patch)
tree6429401e040dc70bf294803b9c2586ec51801d7b
parent39c61cd1064efc870dc2b79dc1fbb40f4a3fa879 (diff)
downloadSimpleParser-5b773d6a0ec801161f97fc5159d1f9c5a75c29c9.tar
SimpleParser-5b773d6a0ec801161f97fc5159d1f9c5a75c29c9.tar.gz
SimpleParser-5b773d6a0ec801161f97fc5159d1f9c5a75c29c9.tar.bz2
SimpleParser-5b773d6a0ec801161f97fc5159d1f9c5a75c29c9.tar.lz
SimpleParser-5b773d6a0ec801161f97fc5159d1f9c5a75c29c9.tar.xz
SimpleParser-5b773d6a0ec801161f97fc5159d1f9c5a75c29c9.tar.zst
SimpleParser-5b773d6a0ec801161f97fc5159d1f9c5a75c29c9.zip
Added previously missing parser.cc
-rw-r--r--src/parser.cc21
-rw-r--r--src/tree.h2
2 files changed, 22 insertions, 1 deletions
diff --git a/src/parser.cc b/src/parser.cc
new file mode 100644
index 0000000..4106fc0
--- /dev/null
+++ b/src/parser.cc
@@ -0,0 +1,21 @@
+#include "parser.h"
+
+namespace SimpleParser {
+
+double calculate(std::string term) {
+ return Tree(term).solve();
+}
+
+double calculate(std::string term, const ConstantMap* constants) {
+ return Tree(term, constants).solve();
+}
+
+std::string print(std::string term) {
+ return Tree(term).print();
+}
+
+std::string print(std::string term, const ConstantMap* constants) {
+ return Tree(term, constants).print();
+}
+
+}
diff --git a/src/tree.h b/src/tree.h
index 0db1404..31d661c 100644
--- a/src/tree.h
+++ b/src/tree.h
@@ -13,7 +13,7 @@ typedef std::vector<std::unique_ptr<Node>> NodeCollection;
class Tree {
public:
- Tree(std::string);
+ explicit Tree(std::string);
Tree(std::string, const ConstantMap*);
double solve();