aboutsummaryrefslogtreecommitdiff
path: root/src/nodes.h
diff options
context:
space:
mode:
authorAdrian Kummerländer2013-10-19 21:41:19 +0200
committerAdrian Kummerländer2013-10-19 21:41:19 +0200
commit69ce370c9ebf92caea64ef1ba28a502affdad3d5 (patch)
tree35d84b2c3080622f990bfe75396966c861d75e92 /src/nodes.h
parentc292b29f3bb87cf11edf899c023cfb574c20ed6c (diff)
downloadSimpleParser-69ce370c9ebf92caea64ef1ba28a502affdad3d5.tar
SimpleParser-69ce370c9ebf92caea64ef1ba28a502affdad3d5.tar.gz
SimpleParser-69ce370c9ebf92caea64ef1ba28a502affdad3d5.tar.bz2
SimpleParser-69ce370c9ebf92caea64ef1ba28a502affdad3d5.tar.lz
SimpleParser-69ce370c9ebf92caea64ef1ba28a502affdad3d5.tar.xz
SimpleParser-69ce370c9ebf92caea64ef1ba28a502affdad3d5.tar.zst
SimpleParser-69ce370c9ebf92caea64ef1ba28a502affdad3d5.zip
Switched OperatorNode to TokenType
* OperatorNode class now uses TokenType for internal operator storage and logic selection * print-Method resolves the TokenType back into its character representation
Diffstat (limited to 'src/nodes.h')
-rw-r--r--src/nodes.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nodes.h b/src/nodes.h
index a59f4a5..e90669c 100644
--- a/src/nodes.h
+++ b/src/nodes.h
@@ -3,11 +3,13 @@
#include <string>
+#include "utils.h"
+
namespace SimpleParser {
-enum NodeType {
- OPERAND_NODE,
- OPERATOR_NODE,
+enum class NodeType {
+ OPERAND,
+ OPERATOR,
};
class Node {
@@ -24,22 +26,21 @@ class Node {
class OperatorNode: public Node {
public:
- explicit OperatorNode(char);
+ explicit OperatorNode(TokenType);
virtual double solve();
virtual NodeType getType();
virtual std::string print();
- char getFunction();
+ TokenType getToken();
private:
- char function_;
+ TokenType operator_;
};
class OperandNode: public Node {
public:
explicit OperandNode(double);
- explicit OperandNode(std::string);
virtual double solve();
virtual NodeType getType();