add RandomIfStatement
This commit is contained in:
@@ -69,6 +69,7 @@ SET(SCULLY_SOURCE
|
||||
src/AST/IfStatement.cpp
|
||||
src/AST/ParameterList.cpp
|
||||
src/AST/ReturnStatement.cpp
|
||||
src/AST/RandomIfStatement.cpp
|
||||
src/AST/Scope.cpp
|
||||
src/AST/Statement.cpp
|
||||
src/AST/StatementList.cpp
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "FunctionDefinition.h"
|
||||
#include "IfStatement.h"
|
||||
#include "ParameterList.h"
|
||||
#include "RandomIfStatement.h"
|
||||
#include "ReturnStatement.h"
|
||||
#include "Scope.h"
|
||||
#include "StatementList.h"
|
||||
@@ -27,6 +28,7 @@ public:
|
||||
virtual void visit(FunctionDefinition* e) = 0;
|
||||
virtual void visit(IfStatement* e) = 0;
|
||||
virtual void visit(ParameterList* e) = 0;
|
||||
virtual void visit(RandomIfStatement* e) = 0;
|
||||
virtual void visit(ReturnStatement* e) = 0;
|
||||
virtual void visit(Scope* e) = 0;
|
||||
virtual void visit(StatementList* e) = 0;
|
||||
|
||||
22
inc/AST/RandomIfStatement.h
Normal file
22
inc/AST/RandomIfStatement.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef RANDOMIFSTATEMENT_H
|
||||
#define RANDOMIFSTATEMENT_H
|
||||
|
||||
#include "AST/Expression.h"
|
||||
#include "AST/Statement.h"
|
||||
|
||||
class RandomIfStatement : public Statement
|
||||
{
|
||||
public:
|
||||
RandomIfStatement(Expression* prob, Statement* stmt);
|
||||
virtual ~RandomIfStatement();
|
||||
|
||||
virtual void accept(ASTVisitor *visitor);
|
||||
|
||||
Expression* getProb();
|
||||
Statement* getStmt();
|
||||
private:
|
||||
Expression* prob_;
|
||||
Statement* stmt_;
|
||||
};
|
||||
|
||||
#endif // RANDOMIFSTATEMENT_H
|
||||
23
src/AST/RandomIfStatement.cpp
Normal file
23
src/AST/RandomIfStatement.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "AST/RandomIfStatement.h"
|
||||
#include "AST/ASTVisitor.h"
|
||||
|
||||
RandomIfStatement::RandomIfStatement(Expression *prob, Statement *stmt) : prob_(prob),stmt_(stmt)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
RandomIfStatement::~RandomIfStatement() {
|
||||
//
|
||||
}
|
||||
|
||||
void RandomIfStatement::accept(ASTVisitor *visitor) {
|
||||
visitor->visit(this);
|
||||
}
|
||||
|
||||
Expression* RandomIfStatement::getProb() {
|
||||
return prob_;
|
||||
}
|
||||
|
||||
Statement* RandomIfStatement::getStmt() {
|
||||
return stmt_;
|
||||
}
|
||||
Reference in New Issue
Block a user