2012-11-17 16:02:32 +00:00
|
|
|
/*
|
|
|
|
* ASTNode.h
|
|
|
|
*
|
|
|
|
* Created on: Nov 4, 2012
|
|
|
|
* Author: attero
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ASTNODE_H_
|
|
|
|
#define ASTNODE_H_
|
|
|
|
#include <vector>
|
2012-12-05 20:31:06 +00:00
|
|
|
#include <string>
|
2012-12-30 13:59:30 +00:00
|
|
|
#include "../Elements/SenchaObject.h"
|
2012-12-17 22:59:16 +00:00
|
|
|
#include "../Visitor.h"
|
2012-11-17 16:02:32 +00:00
|
|
|
|
2012-12-28 10:41:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ASTNode is an ancestor of all former ASTNodes.
|
|
|
|
* It implements Visitable, which is an abstraction of something, which
|
|
|
|
* can be visited, by visitor.
|
|
|
|
* It is very important in our tree relation and creating tree crawlers,
|
|
|
|
* such as ASTInspector, which is very helpful for debugging.
|
|
|
|
* ASTNode stores its children in vector of pointers to other ASTNodes,
|
|
|
|
* It allows us to use features of polymorphism.
|
|
|
|
*/
|
|
|
|
class ASTNode : public Visitable
|
|
|
|
{
|
2012-11-17 16:02:32 +00:00
|
|
|
public:
|
|
|
|
ASTNode();
|
|
|
|
std::vector<ASTNode *> children;
|
2012-12-17 08:25:58 +00:00
|
|
|
|
2012-12-18 21:41:39 +00:00
|
|
|
virtual void accept(Visitor * visitor){ visitor->visit(this); };
|
2012-12-05 22:27:03 +00:00
|
|
|
|
2012-12-22 17:52:19 +00:00
|
|
|
virtual SenchaObject evaluate() = 0;
|
2012-12-31 16:10:37 +00:00
|
|
|
virtual SenchaObject execute() = 0;
|
2012-11-17 16:02:32 +00:00
|
|
|
virtual ~ASTNode();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ASTNODE_H_ */
|