diff options
author | Justyna Ilczuk <justyna.ilczuk@gmail.com> | 2012-12-17 23:59:16 +0100 |
---|---|---|
committer | Justyna Ilczuk <justyna.ilczuk@gmail.com> | 2012-12-17 23:59:16 +0100 |
commit | cc3e55c8885ca2ea145b5a811f038d7e4128b1ee (patch) | |
tree | 9e0b1e8f16888929d99a839c97f17a61f2ff9580 | |
parent | ba6497e5a50dd7a7b0c9fa74f585ff5f4d56ead1 (diff) | |
download | sencha-lang-cc3e55c8885ca2ea145b5a811f038d7e4128b1ee.tar.gz sencha-lang-cc3e55c8885ca2ea145b5a811f038d7e4128b1ee.tar.bz2 sencha-lang-cc3e55c8885ca2ea145b5a811f038d7e4128b1ee.tar.xz sencha-lang-cc3e55c8885ca2ea145b5a811f038d7e4128b1ee.zip |
I'm starting visitors pattern.
-rw-r--r-- | Sencha-lang/AST/ASTNode.h | 2 | ||||
-rw-r--r-- | Sencha-lang/ASTInspector.cpp | 18 | ||||
-rw-r--r-- | Sencha-lang/ASTInspector.h | 19 | ||||
-rw-r--r-- | Sencha-lang/Visitor.cpp | 18 | ||||
-rw-r--r-- | Sencha-lang/Visitor.h | 19 |
5 files changed, 76 insertions, 0 deletions
diff --git a/Sencha-lang/AST/ASTNode.h b/Sencha-lang/AST/ASTNode.h index 7afe190..feee8bd 100644 --- a/Sencha-lang/AST/ASTNode.h +++ b/Sencha-lang/AST/ASTNode.h @@ -10,6 +10,7 @@ #include <vector> #include <string> #include "SenchaObject.h" +#include "../Visitor.h" class ASTNode { public: @@ -17,6 +18,7 @@ public: ASTNode * parent; std::vector<ASTNode *> children; + virtual void accept(Visitor *) = 0; virtual std::string debug() = 0; virtual void execute() = 0; diff --git a/Sencha-lang/ASTInspector.cpp b/Sencha-lang/ASTInspector.cpp new file mode 100644 index 0000000..de4edbe --- /dev/null +++ b/Sencha-lang/ASTInspector.cpp @@ -0,0 +1,18 @@ +/* + * ASTInspector.cpp + * + * Created on: Dec 17, 2012 + * Author: att + */ + +#include "ASTInspector.h" + +ASTInspector::ASTInspector() { + // TODO Auto-generated constructor stub + +} + +ASTInspector::~ASTInspector() { + // TODO Auto-generated destructor stub +} + diff --git a/Sencha-lang/ASTInspector.h b/Sencha-lang/ASTInspector.h new file mode 100644 index 0000000..941c82e --- /dev/null +++ b/Sencha-lang/ASTInspector.h @@ -0,0 +1,19 @@ +/* + * ASTInspector.h + * + * Created on: Dec 17, 2012 + * Author: att + */ + +#ifndef ASTINSPECTOR_H_ +#define ASTINSPECTOR_H_ + +#include "Visitor.h" + +class ASTInspector: public Visitor { +public: + ASTInspector(); + virtual ~ASTInspector(); +}; + +#endif /* ASTINSPECTOR_H_ */ diff --git a/Sencha-lang/Visitor.cpp b/Sencha-lang/Visitor.cpp new file mode 100644 index 0000000..1fa2479 --- /dev/null +++ b/Sencha-lang/Visitor.cpp @@ -0,0 +1,18 @@ +/* + * Visitor.cpp + * + * Created on: Dec 17, 2012 + * Author: att + */ + +#include "Visitor.h" + +Visitor::Visitor() { + // TODO Auto-generated constructor stub + +} + +Visitor::~Visitor() { + // TODO Auto-generated destructor stub +} + diff --git a/Sencha-lang/Visitor.h b/Sencha-lang/Visitor.h new file mode 100644 index 0000000..85d4dfa --- /dev/null +++ b/Sencha-lang/Visitor.h @@ -0,0 +1,19 @@ +/* + * Visitor.h + * + * Created on: Dec 17, 2012 + * Author: att + */ + +#ifndef VISITOR_H_ +#define VISITOR_H_ +#include "AST/ASTNode.h" + +class Visitor { +public: + Visitor(); + virtual void visit(ASTNode * node/*something*/) = 0; + virtual ~Visitor(); +}; + +#endif /* VISITOR_H_ */ |