summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/AST
diff options
context:
space:
mode:
Diffstat (limited to 'Sencha-lang/AST')
-rw-r--r--Sencha-lang/AST/Assignment.cpp1
-rw-r--r--Sencha-lang/AST/BasicStatement.cpp1
-rw-r--r--Sencha-lang/AST/ConstantExpression.cpp4
-rw-r--r--Sencha-lang/AST/DeclarationStatement.cpp1
-rw-r--r--Sencha-lang/AST/IfNode.cpp1
-rw-r--r--Sencha-lang/AST/IfNode.h3
-rw-r--r--Sencha-lang/AST/IncorrectExpression.cpp1
-rw-r--r--Sencha-lang/AST/PostfixExpression.cpp1
-rw-r--r--Sencha-lang/AST/ProgramNode.cpp2
-rw-r--r--Sencha-lang/AST/RepeatStatement.cpp1
-rw-r--r--Sencha-lang/AST/VariableExpression.cpp1
-rw-r--r--Sencha-lang/AST/WhileNode.cpp1
12 files changed, 17 insertions, 1 deletions
diff --git a/Sencha-lang/AST/Assignment.cpp b/Sencha-lang/AST/Assignment.cpp
index 20ff698..33f817c 100644
--- a/Sencha-lang/AST/Assignment.cpp
+++ b/Sencha-lang/AST/Assignment.cpp
@@ -69,6 +69,7 @@ Assignment::Assignment(ASTNode * parent, Context * context)
{
this->parent = parent;
this->context = context;
+ this->type = "Assignment";
}
diff --git a/Sencha-lang/AST/BasicStatement.cpp b/Sencha-lang/AST/BasicStatement.cpp
index b8dc1bf..26d1adf 100644
--- a/Sencha-lang/AST/BasicStatement.cpp
+++ b/Sencha-lang/AST/BasicStatement.cpp
@@ -9,6 +9,7 @@
BasicStatement::BasicStatement(ASTNode * parent) {
this->parent = parent;
+ this->type = "BasicStatement";
}
BasicStatement::~BasicStatement() {
diff --git a/Sencha-lang/AST/ConstantExpression.cpp b/Sencha-lang/AST/ConstantExpression.cpp
index 51db3cf..ec8cbd5 100644
--- a/Sencha-lang/AST/ConstantExpression.cpp
+++ b/Sencha-lang/AST/ConstantExpression.cpp
@@ -11,6 +11,7 @@ ConstantExpression::ConstantExpression(ASTNode * parent) //Constructor which set
{
this->parent = parent;
value = SenchaObject();
+ this->type = "ConstantExpression";
}
ConstantExpression::~ConstantExpression() {
@@ -46,16 +47,19 @@ void ConstantExpression::accept(Visitor * visitor)
ConstantExpression::ConstantExpression(ASTNode * parent, int number)
{
this->parent = parent; value = SenchaObject(number);
+ this->type = "ConstantExpression";
}
ConstantExpression::ConstantExpression(ASTNode * parent, double number)
{
this->parent = parent;
+ this->type = "ConstantExpression";
value = SenchaObject(number);
}
ConstantExpression::ConstantExpression(ASTNode * parent, std::string text)
{
+ this->type = "ConstantExpression";
this->parent = parent; value = SenchaObject(text);
}
diff --git a/Sencha-lang/AST/DeclarationStatement.cpp b/Sencha-lang/AST/DeclarationStatement.cpp
index a734cbb..bcfb5c4 100644
--- a/Sencha-lang/AST/DeclarationStatement.cpp
+++ b/Sencha-lang/AST/DeclarationStatement.cpp
@@ -34,6 +34,7 @@ DeclarationStatement::DeclarationStatement(ASTNode * parent, Context * context)
body = NULL;
right_value = SenchaObject();
children.push_back(new ConstantExpression(this));
+ this->type = "DeclarationStatement";
}
std::string DeclarationStatement::debug()
diff --git a/Sencha-lang/AST/IfNode.cpp b/Sencha-lang/AST/IfNode.cpp
index ada71af..ba80f3d 100644
--- a/Sencha-lang/AST/IfNode.cpp
+++ b/Sencha-lang/AST/IfNode.cpp
@@ -11,6 +11,7 @@
IfNode::IfNode(ASTNode * parent) {
this->parent = parent;
is_else = false;
+ this->type = "IfNode";
}
std::string IfNode::debug()
diff --git a/Sencha-lang/AST/IfNode.h b/Sencha-lang/AST/IfNode.h
index 9121260..7cc0515 100644
--- a/Sencha-lang/AST/IfNode.h
+++ b/Sencha-lang/AST/IfNode.h
@@ -21,6 +21,9 @@ public:
virtual std::string debug();
virtual void execute();
bool evaluate_condition();
+ ASTNode * condition() { return children[0]; }
+ ASTNode * then_block() { return children[1]; }
+ ASTNode * else_block() { return children[2]; }
IfNode(ASTNode * parent);
virtual ~IfNode();
};
diff --git a/Sencha-lang/AST/IncorrectExpression.cpp b/Sencha-lang/AST/IncorrectExpression.cpp
index 986c1d4..5d1fb71 100644
--- a/Sencha-lang/AST/IncorrectExpression.cpp
+++ b/Sencha-lang/AST/IncorrectExpression.cpp
@@ -11,6 +11,7 @@ IncorrectExpression::IncorrectExpression(ASTNode * parent, std::string error_mes
{
this->parent = parent;
this->error_message = error_message;
+ this->type = "IncorrectExpression";
}
IncorrectExpression::~IncorrectExpression() {
diff --git a/Sencha-lang/AST/PostfixExpression.cpp b/Sencha-lang/AST/PostfixExpression.cpp
index 7c75def..fb2345e 100644
--- a/Sencha-lang/AST/PostfixExpression.cpp
+++ b/Sencha-lang/AST/PostfixExpression.cpp
@@ -12,6 +12,7 @@ PostfixExpression::PostfixExpression(ASTNode * parent, Context * context) {
this->context = context;
name = "";
native = false;
+ this->type = "PostfixExpression";
}
PostfixExpression::~PostfixExpression() {
diff --git a/Sencha-lang/AST/ProgramNode.cpp b/Sencha-lang/AST/ProgramNode.cpp
index aced5bf..cab01be 100644
--- a/Sencha-lang/AST/ProgramNode.cpp
+++ b/Sencha-lang/AST/ProgramNode.cpp
@@ -9,7 +9,7 @@
ProgramNode::ProgramNode() {
//Do nothing
-
+ this->type = "ProgramNode";
}
ProgramNode::~ProgramNode() {
diff --git a/Sencha-lang/AST/RepeatStatement.cpp b/Sencha-lang/AST/RepeatStatement.cpp
index 3fc96da..404b13a 100644
--- a/Sencha-lang/AST/RepeatStatement.cpp
+++ b/Sencha-lang/AST/RepeatStatement.cpp
@@ -12,6 +12,7 @@ RepeatStatement::RepeatStatement(ASTNode * parent)
this->parent = parent;
how_many_times = 0;
body = NULL;
+ this->type = "RepeatStatement";
}
RepeatStatement::~RepeatStatement()
diff --git a/Sencha-lang/AST/VariableExpression.cpp b/Sencha-lang/AST/VariableExpression.cpp
index 93856f0..5ac4a5e 100644
--- a/Sencha-lang/AST/VariableExpression.cpp
+++ b/Sencha-lang/AST/VariableExpression.cpp
@@ -12,6 +12,7 @@ VariableExpression::VariableExpression(ASTNode * parent, Context * context, std:
this->name = name;
this->parent = parent;
this->context = context;
+ this->type = "VariableExpression";
}
std::string VariableExpression::debug()
diff --git a/Sencha-lang/AST/WhileNode.cpp b/Sencha-lang/AST/WhileNode.cpp
index 84144df..0d10214 100644
--- a/Sencha-lang/AST/WhileNode.cpp
+++ b/Sencha-lang/AST/WhileNode.cpp
@@ -10,6 +10,7 @@
WhileNode::WhileNode(ASTNode * parent) {
body = NULL;
this->parent = parent;
+ this->type = "WhileNode";
}
WhileNode::~WhileNode() {