From 0b3eebbf3b8644f06b2ae9d512135870938fb1c3 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Sat, 19 Oct 2013 22:06:53 +0200 Subject: Merged Node factory-methods into template method Added ConstantNode blueprint --- src/nodes.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/nodes.h') diff --git a/src/nodes.h b/src/nodes.h index e90669c..6783f3d 100644 --- a/src/nodes.h +++ b/src/nodes.h @@ -3,13 +3,14 @@ #include -#include "utils.h" - namespace SimpleParser { +enum class TokenType : int8_t; + enum class NodeType { OPERAND, OPERATOR, + CONSTANT, }; class Node { @@ -50,6 +51,18 @@ class OperandNode: public Node { double value_; }; +class ConstantNode: public Node { + public: + explicit ConstantNode(std::string); + + virtual double solve(); + virtual NodeType getType(); + virtual std::string print(); + + private: + std::string identifier_; +}; + } #endif // PARSER_SRC_NODES_H_ -- cgit v1.2.3