2012-12-10 08:43:16 +00:00
|
|
|
/*
|
|
|
|
* WhileNode.h
|
|
|
|
*
|
|
|
|
* Created on: Dec 10, 2012
|
|
|
|
* Author: attero
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WHILENODE_H_
|
|
|
|
#define WHILENODE_H_
|
|
|
|
|
|
|
|
#include "ASTStatement.h"
|
2012-12-10 11:37:29 +00:00
|
|
|
#include "ASTExpression.h"
|
2012-12-28 10:41:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* WhileNode is a while construct. It evaluates condition and executes
|
|
|
|
* body if it's true, when condition turn into false, WhileNode breaks loop.
|
|
|
|
*/
|
2012-12-10 08:43:16 +00:00
|
|
|
class WhileNode: public ASTStatement {
|
|
|
|
public:
|
2012-12-28 10:01:48 +00:00
|
|
|
WhileNode();
|
2012-12-10 08:43:16 +00:00
|
|
|
virtual ~WhileNode();
|
2012-12-10 11:37:29 +00:00
|
|
|
ASTStatement * body;
|
|
|
|
void add_condition(ASTExpression * expression);
|
|
|
|
void add_body(ASTStatement * statement);
|
|
|
|
virtual void execute();
|
|
|
|
bool evaluate_condition();
|
|
|
|
|
2012-12-10 08:43:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* WHILENODE_H_ */
|