2012-12-09 20:17:13 +00:00
|
|
|
/*
|
|
|
|
* RepeatStatement.h
|
|
|
|
*
|
|
|
|
* Created on: Dec 9, 2012
|
|
|
|
* Author: attero
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef REPEATSTATEMENT_H_
|
|
|
|
#define REPEATSTATEMENT_H_
|
|
|
|
|
|
|
|
#include "ASTStatement.h"
|
2013-01-07 16:15:47 +00:00
|
|
|
#include "ASTExpression.h"
|
2012-12-28 10:41:43 +00:00
|
|
|
/**
|
|
|
|
* Repeat statement if very useful, when you need to do something n-times
|
|
|
|
* you just repeat(n) {block_of_code}
|
|
|
|
* It stores how many times it should be executed
|
|
|
|
* and what should be executed, that is body.
|
|
|
|
*/
|
2012-12-09 20:17:13 +00:00
|
|
|
class RepeatStatement: public ASTStatement {
|
|
|
|
public:
|
2013-01-07 16:15:47 +00:00
|
|
|
RepeatStatement(ASTExpression * expr, ASTStatement * statement);
|
2012-12-09 20:17:13 +00:00
|
|
|
ASTStatement * body;
|
2013-01-07 16:15:47 +00:00
|
|
|
ASTExpression * how_many_times_expr;
|
2012-12-31 16:10:37 +00:00
|
|
|
virtual SenchaObject execute();
|
2013-01-10 10:46:41 +00:00
|
|
|
virtual SenchaObject evaluate() { return execute(); }
|
2012-12-09 20:17:13 +00:00
|
|
|
void add_body(ASTStatement * statement);
|
|
|
|
virtual ~RepeatStatement();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* REPEATSTATEMENT_H_ */
|