adding RandomForStatement and fixing typo
This commit is contained in:
@@ -71,6 +71,7 @@ SET(SCULLY_SOURCE
|
||||
src/AST/IfStatement.cpp
|
||||
src/AST/ParameterList.cpp
|
||||
src/AST/ReturnStatement.cpp
|
||||
src/AST/RandomForStatement.cpp
|
||||
src/AST/RandomIfStatement.cpp
|
||||
src/AST/Scope.cpp
|
||||
src/AST/Statement.cpp
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "FunctionDefinition.h"
|
||||
#include "IfStatement.h"
|
||||
#include "ParameterList.h"
|
||||
#include "RandomForStatement.h"
|
||||
#include "RandomIfStatement.h"
|
||||
#include "ReturnStatement.h"
|
||||
#include "Scope.h"
|
||||
@@ -32,6 +33,7 @@ public:
|
||||
virtual void visit(FunctionDefinition* e) = 0;
|
||||
virtual void visit(IfStatement* e) = 0;
|
||||
virtual void visit(ParameterList* e) = 0;
|
||||
virtual void visit(RandomForStatement* e) = 0;
|
||||
virtual void visit(RandomIfStatement* e) = 0;
|
||||
virtual void visit(ReturnStatement* e) = 0;
|
||||
virtual void visit(Scope* e) = 0;
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
Expression* getInit();
|
||||
Expression* getCond();
|
||||
Expression* getStep();
|
||||
Statement* GetStmt();
|
||||
Statement* getStmt();
|
||||
private:
|
||||
Expression* init_;
|
||||
Expression* cond_;
|
||||
|
||||
26
inc/AST/RandomForStatement.h
Normal file
26
inc/AST/RandomForStatement.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef RANDOMFORSTATEMENT_H
|
||||
#define RANDOMFORSTATEMENT_H
|
||||
|
||||
#include "AST/Expression.h"
|
||||
#include "AST/Statement.h"
|
||||
|
||||
class RandomForStatement : public Statement
|
||||
{
|
||||
public:
|
||||
RandomForStatement(Expression* init, Expression* prob, Expression* step, Statement* stmt);
|
||||
virtual ~RandomForStatement();
|
||||
|
||||
virtual void accept(ASTVisitor *visitor);
|
||||
|
||||
Expression* getInit();
|
||||
Expression* getProb();
|
||||
Expression* getStep();
|
||||
Statement* getStmt();
|
||||
private:
|
||||
Expression* init_;
|
||||
Expression* prob_;
|
||||
Expression* step_;
|
||||
Statement* stmt_;
|
||||
};
|
||||
|
||||
#endif // RANDOMFORSTATEMENT_H
|
||||
@@ -25,6 +25,6 @@ Expression* ForStatement::getStep() {
|
||||
return step_;
|
||||
}
|
||||
|
||||
Statement* ForStatement::GetStmt() {
|
||||
Statement* ForStatement::getStmt() {
|
||||
return stmt_;
|
||||
}
|
||||
|
||||
32
src/AST/RandomForStatement.cpp
Normal file
32
src/AST/RandomForStatement.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "AST/RandomForStatement.h"
|
||||
#include "AST/ASTVisitor.h"
|
||||
|
||||
RandomForStatement::RandomForStatement(Expression *init, Expression *prob, Expression *step, Statement *stmt) : init_(init),prob_(prob),step_(step),stmt_(stmt)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
RandomForStatement::~RandomForStatement() {
|
||||
//
|
||||
}
|
||||
|
||||
void RandomForStatement::accept(ASTVisitor *visitor) {
|
||||
visitor->visit(this);
|
||||
}
|
||||
|
||||
Expression* RandomForStatement::getInit() {
|
||||
return init_;
|
||||
}
|
||||
|
||||
Expression* RandomForStatement::getProb() {
|
||||
return prob_;
|
||||
}
|
||||
|
||||
Expression* RandomForStatement::getStep() {
|
||||
return step_;
|
||||
}
|
||||
|
||||
Statement* RandomForStatement::getStmt() {
|
||||
return stmt_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user