No more introspection ;).
parent
89e84f0a83
commit
4bbba3bdc9
|
@ -21,7 +21,6 @@ public:
|
||||||
virtual void accept(Visitor * visitor){ visitor->visit(this); };
|
virtual void accept(Visitor * visitor){ visitor->visit(this); };
|
||||||
|
|
||||||
virtual SenchaObject evaluate() = 0;
|
virtual SenchaObject evaluate() = 0;
|
||||||
virtual std::string debug() = 0;
|
|
||||||
virtual void execute() = 0;
|
virtual void execute() = 0;
|
||||||
virtual ~ASTNode();
|
virtual ~ASTNode();
|
||||||
};
|
};
|
||||||
|
|
|
@ -132,12 +132,3 @@ void BasicExpression::accept(Visitor * visitor)
|
||||||
visitor->visit(this);
|
visitor->visit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BasicExpression::debug()
|
|
||||||
{
|
|
||||||
std::string debug_note = "Basic expression:\n";
|
|
||||||
debug_note += "left operand: \n";
|
|
||||||
debug_note += this->children[0]->debug();
|
|
||||||
debug_note += "\nright operand:\n" + this->children[1]->debug();
|
|
||||||
debug_note += "\nOperator: " + this->oper +"\n###\n";
|
|
||||||
return debug_note;
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ public:
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
virtual void execute_quietly();
|
virtual void execute_quietly();
|
||||||
std::string get_operator() { return oper; }
|
std::string get_operator() { return oper; }
|
||||||
std::string debug() ;
|
|
||||||
virtual void accept(Visitor * visitor);
|
virtual void accept(Visitor * visitor);
|
||||||
|
|
||||||
BasicExpression(ASTNode * parent);
|
BasicExpression(ASTNode * parent);
|
||||||
|
|
|
@ -25,10 +25,6 @@ void BasicStatement::add_expression(ASTExpression * expr)
|
||||||
children.push_back(expr);
|
children.push_back(expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BasicStatement::debug()
|
|
||||||
{
|
|
||||||
return "Basic statement with expression:\n" + children[0]->debug() + "\n;\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
void BasicStatement::execute()
|
void BasicStatement::execute()
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
class BasicStatement : public ASTStatement {
|
class BasicStatement : public ASTStatement {
|
||||||
public:
|
public:
|
||||||
BasicStatement(ASTNode * parent);
|
BasicStatement(ASTNode * parent);
|
||||||
virtual std::string debug();
|
|
||||||
void add_expression(ASTExpression * expr);
|
void add_expression(ASTExpression * expr);
|
||||||
virtual SenchaObject evaluate();
|
virtual SenchaObject evaluate();
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
|
@ -62,5 +62,3 @@ ConstantExpression::ConstantExpression(ASTNode * parent, std::string text)
|
||||||
this->type = "ConstantExpression";
|
this->type = "ConstantExpression";
|
||||||
this->parent = parent; value = SenchaObject(text);
|
this->parent = parent; value = SenchaObject(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ConstantExpression::debug() { return "Constant expression:\n" + value.repr() + "\n"; }
|
|
||||||
|
|
|
@ -62,9 +62,6 @@ public:
|
||||||
/** Here's value of constant expression */
|
/** Here's value of constant expression */
|
||||||
SenchaObject value;
|
SenchaObject value;
|
||||||
|
|
||||||
/** Provides some useful information */
|
|
||||||
std::string debug();
|
|
||||||
|
|
||||||
/** Implements visitor pattern */
|
/** Implements visitor pattern */
|
||||||
virtual void accept(Visitor * visitor);
|
virtual void accept(Visitor * visitor);
|
||||||
|
|
||||||
|
|
|
@ -37,12 +37,6 @@ DeclarationStatement::DeclarationStatement(ASTNode * parent, Context * context)
|
||||||
this->type = "DeclarationStatement";
|
this->type = "DeclarationStatement";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DeclarationStatement::debug()
|
|
||||||
{
|
|
||||||
std::string debug_note = "Declaration";
|
|
||||||
return debug_note;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarationStatement::add_name(std::string name)
|
void DeclarationStatement::add_name(std::string name)
|
||||||
{
|
{
|
||||||
this->name = name;
|
this->name = name;
|
||||||
|
|
|
@ -25,7 +25,6 @@ public:
|
||||||
|
|
||||||
void add_right_value(ASTExpression * right);
|
void add_right_value(ASTExpression * right);
|
||||||
DeclarationStatement(ASTNode * parent, Context * context);
|
DeclarationStatement(ASTNode * parent, Context * context);
|
||||||
virtual std::string debug();
|
|
||||||
void add_name(std::string);
|
void add_name(std::string);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,16 +14,6 @@ IfNode::IfNode(ASTNode * parent) {
|
||||||
this->type = "IfNode";
|
this->type = "IfNode";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string IfNode::debug()
|
|
||||||
{
|
|
||||||
std::string debug_note;
|
|
||||||
debug_note = "If node, condition is: " + to_string(evaluate_condition());
|
|
||||||
if(evaluate_condition())
|
|
||||||
debug_note += "Doing first branch";
|
|
||||||
else
|
|
||||||
debug_note += "Doing second branch";
|
|
||||||
return debug_note;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IfNode::evaluate_condition()
|
bool IfNode::evaluate_condition()
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,6 @@ public:
|
||||||
void add_body(ASTStatement * statement);
|
void add_body(ASTStatement * statement);
|
||||||
void add_else_block(ASTStatement * statement);
|
void add_else_block(ASTStatement * statement);
|
||||||
bool is_else;
|
bool is_else;
|
||||||
virtual std::string debug();
|
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
bool evaluate_condition();
|
bool evaluate_condition();
|
||||||
ASTNode * condition() { return children[0]; }
|
ASTNode * condition() { return children[0]; }
|
||||||
|
|
|
@ -46,9 +46,3 @@ void PostfixExpression::execute() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string PostfixExpression::debug()
|
|
||||||
{
|
|
||||||
//TODO implement it or something
|
|
||||||
return "Postfix expression tadadah!";
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,9 +25,6 @@ public:
|
||||||
virtual void execute_quietly(){ execute();
|
virtual void execute_quietly(){ execute();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
std::string debug() ;
|
|
||||||
|
|
||||||
PostfixExpression(ASTNode * parent, Context * context);
|
PostfixExpression(ASTNode * parent, Context * context);
|
||||||
virtual ~PostfixExpression();
|
virtual ~PostfixExpression();
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,16 +43,6 @@ SenchaObject ProgramNode::evaluate_last()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ProgramNode::debug()
|
|
||||||
{
|
|
||||||
std::string debug_note = "Program started debugging\n";
|
|
||||||
|
|
||||||
for (std::vector<ASTNode *>::iterator it = children.begin(); it!=children.end(); ++it) {
|
|
||||||
debug_note += (*it)->debug() + "\n";
|
|
||||||
}
|
|
||||||
debug_note += "END\n";
|
|
||||||
return debug_note;
|
|
||||||
}
|
|
||||||
void ProgramNode::add_statement(ASTStatement * statement)
|
void ProgramNode::add_statement(ASTStatement * statement)
|
||||||
{
|
{
|
||||||
children.push_back(statement);
|
children.push_back(statement);
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
class ProgramNode : public ASTNode {
|
class ProgramNode : public ASTNode {
|
||||||
public:
|
public:
|
||||||
ProgramNode();
|
ProgramNode();
|
||||||
std::string debug();
|
|
||||||
void add_statement(ASTStatement * statement);
|
void add_statement(ASTStatement * statement);
|
||||||
virtual ~ProgramNode();
|
virtual ~ProgramNode();
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
|
@ -39,10 +39,6 @@ void RepeatStatement::execute_quietly()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string RepeatStatement::debug()
|
|
||||||
{
|
|
||||||
return "Repeats!";
|
|
||||||
}
|
|
||||||
|
|
||||||
void RepeatStatement::add_iteration_number(SenchaObject so)
|
void RepeatStatement::add_iteration_number(SenchaObject so)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,9 +19,6 @@ public:
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
virtual void execute_quietly();
|
virtual void execute_quietly();
|
||||||
void add_body(ASTStatement * statement);
|
void add_body(ASTStatement * statement);
|
||||||
|
|
||||||
|
|
||||||
virtual std::string debug() ;
|
|
||||||
virtual ~RepeatStatement();
|
virtual ~RepeatStatement();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,6 @@ VariableExpression::VariableExpression(ASTNode * parent, Context * context, std:
|
||||||
this->type = "VariableExpression";
|
this->type = "VariableExpression";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string VariableExpression::debug()
|
|
||||||
{
|
|
||||||
std::string debug_note = "variable: " + name;
|
|
||||||
return debug_note;
|
|
||||||
}
|
|
||||||
VariableExpression::~VariableExpression() {
|
VariableExpression::~VariableExpression() {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ public:
|
||||||
VariableExpression(ASTNode * parent, Context * context, std::string name);
|
VariableExpression(ASTNode * parent, Context * context, std::string name);
|
||||||
|
|
||||||
Context * context;
|
Context * context;
|
||||||
std::string debug();
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
void execute();
|
void execute();
|
||||||
|
|
|
@ -32,11 +32,6 @@ void WhileNode::add_body(ASTStatement * statement)
|
||||||
body = statement;
|
body = statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string WhileNode::debug()
|
|
||||||
{
|
|
||||||
std::string debug_note = "While";
|
|
||||||
return debug_note;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WhileNode::execute()
|
void WhileNode::execute()
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,6 @@ public:
|
||||||
ASTStatement * body;
|
ASTStatement * body;
|
||||||
void add_condition(ASTExpression * expression);
|
void add_condition(ASTExpression * expression);
|
||||||
void add_body(ASTStatement * statement);
|
void add_body(ASTStatement * statement);
|
||||||
virtual std::string debug();
|
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
bool evaluate_condition();
|
bool evaluate_condition();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue